WindowsIdentity wi2 = new WindowsIdentity("test1");
test1 is in the ActiveDirectory on the DomainController
when running the code I get an IncorrectFunction error
at System.Security.Principal.WindowsIdentity.KerbS4ULogon(String upn)
at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName, String type)
at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName)
at Hisco.Intranet.LoginForm.OnInit(EventArgs e) in F:\Hisco\DCS\WebEventsManager\HiscoDCS\DCS\LoginForm.aspx.cs:line 17
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I have windows auth for the website and outside users will logon that are not in the network and I need to impersonate them to login on without offering a login form( quietly behind the scenes) with the test account.
I guess what I actually need is the UserTaken pointer. Is there a way to get one without ising the LogOnUser unmanaged call?
I have a UserPrincipal object also so is there way to get the token from ActiveDirectory somehow?
nick5454
Member
587 Points
486 Posts
Getting a WindowsIdentity is failing with Incorrect function
Mar 25, 2010 05:06 PM|LINK
i have this line of code
WindowsIdentity wi2 = new WindowsIdentity("test1");
test1 is in the ActiveDirectory on the DomainController
when running the code I get an IncorrectFunction error
at System.Security.Principal.WindowsIdentity.KerbS4ULogon(String upn)
at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName, String type)
at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName)
at Hisco.Intranet.LoginForm.OnInit(EventArgs e) in F:\Hisco\DCS\WebEventsManager\HiscoDCS\DCS\LoginForm.aspx.cs:line 17
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I have windows auth for the website and outside users will logon that are not in the network and I need to impersonate them to login on without offering a login form( quietly behind the scenes) with the test account.
I guess what I actually need is the UserTaken pointer. Is there a way to get one without ising the LogOnUser unmanaged call?
I have a UserPrincipal object also so is there way to get the token from ActiveDirectory somehow?
Any advice would be helpful.
Thanks,
Nick