Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 27, 2013 09:21 AM by Pengzhen Song - MSFT
Feb 26, 2013 10:56 AM|LINK
I have a page that will need to be able to write to the AD of another domain so requires logging in as another user when it runs that code.
I found this on the MSDN site
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Label1.Text = Me.User.Identity.Name
Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
currentWindowsIdentity = CType(User.Identity, System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()
'Insert your code that runs under the security context of the authenticating user here.
Label2.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name
but do not understand where i am supposed to pass in the credentials of the user i wish to log in as.
also .impersonate seems to require a login type that i am at complete loss as to how to obtain.
if anyone could explain this i would be very greatful.
Feb 27, 2013 09:21 AM|LINK
try enabling windows authention on both the sites. Make the following changes in the web.config.
And you can share the authentication cookie across multiple
domains. Please refer here
Hope it can help you.