Hi there,
I am trying to move a working application from IIS 6 to IIS7 integrated mode but I'm running into a bit of a problem that I cannot solve.
My app is based on windowsauthentication and I use this throughout my app.
In the app itself I'm using a self defined prinicpal that inherits from WindowsPrincipal like so:
MyWindowsPrincipal : WindowsPrincipal
MyWindowsPrincipal(WindowsIdentity Id) :base(Id)
{}
Now when I run this app in classic mode all is fine however when I switch to Integrated mode things go downhill.
I have a masterpage that tries to go into HttpContext.Current.User to obtain the users name. This fails with the following error:
Safe handle has been closed
Source = mscorlib, Type = System.ObjectDisposedException, Time = 1-4-2011 19:18:12
StackTrace of the exception =
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean success)
at Microsoft.Win32.Win32Native.GetTokenInformation(SafeTokenHandle TokenHandle, UInt32 TokenInformationClass, SafeLocalAllocHandle TokenInformation, UInt32 TokenInformationLength, UInt32 ReturnLength)
at System.Security.Principal.WindowsIdentity.GetTokenInformation(SafeTokenHandle tokenHandle, TokenInformationClass tokenInformationClass)
at System.Security.Principal.WindowsIdentity.get_User()
at System.Security.Principal.WindowsIdentity.GetName()
at System.Security.Principal.WindowsIdentity.get_Name()
at Rabobank.LIA.Pages.Sitemaster.OnInit(EventArgs e) in C:\Users\haanfc\Documents\Projects\RAD.LIA\Development\Source\WebApplication\Pages\LIA.Master.cs:line 43
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
For some reason the windowsIdentity is no longer available to me. How do I keep a reference to it, or, how do I get a new reference to it?
I am trying to move a working application from IIS 6 to IIS7 integrated mode but I'm running into a bit of a problem that I cannot solve.
My app is based on windowsauthentication and I use this throughout my app.
In the app itself I'm using a self defined prinicpal that inherits from WindowsPrincipal like so:
MyWindowsPrincipal : WindowsPrincipal
MyWindowsPrincipal(WindowsIdentity Id) :base(Id)
{}
Now when I run this app in classic mode all is fine however when I switch to Integrated mode things go downhill.
I have a masterpage that tries to go into HttpContext.Current.User to obtain the users name. This fails with the following error:
Safe handle has been closed
Source = mscorlib, Type = System.ObjectDisposedException, Time = 1-4-2011 19:18:12
StackTrace of the exception =
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean success)
at Microsoft.Win32.Win32Native.GetTokenInformation(SafeTokenHandle TokenHandle, UInt32 TokenInformationClass, SafeLocalAllocHandle TokenInformation, UInt32 TokenInformationLength, UInt32 ReturnLength)
at System.Security.Principal.WindowsIdentity.GetTokenInformation(SafeTokenHandle tokenHandle, TokenInformationClass tokenInformationClass)
at System.Security.Principal.WindowsIdentity.get_User()
at System.Security.Principal.WindowsIdentity.GetName()
at System.Security.Principal.WindowsIdentity.get_Name()
at Rabobank.LIA.Pages.Sitemaster.OnInit(EventArgs e) in C:\Users\haanfc\Documents\Projects\RAD.LIA\Development\Source\WebApplication\Pages\LIA.Master.cs:line 43
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
For some reason the windowsIdentity is no longer available to me. How do I keep a reference to it, or, how do I get a new reference to it?