A
AD
I have a ASP.NET application with <authentication mode="Windows" /> and
<identity impersonate="false" />. IIS is configured to use only "Integrated
Windows authentication".
I need to get the NetworkCredential object from the logged in WINDOWS user
to pass it to another application. I tried to use the code below, however
the Domian, UserName and Password property of the NetworkCredential object
are all empty. Is there any way I can get the NetworkCredential object
using Impersonation in code.
//--Impersonation
System.Security.Principal.WindowsImpersonationContext impersonationContext;
impersonationContext =
((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();
impersonationContext
=System.Security.Principal.WindowsIdentity.GetCurrent().Impersonate();
System.Net.NetworkCredential
cred=(System.Net.NetworkCredential)System.Net.CredentialCache.DefaultCredent
ials;
string s="cred.Domain=" + cred.Domain + "<br>";
s+="cred.UserName=" + cred.UserName + "<br>";
s+="cred.Password=" + cred.Password + "<br>";
Response.Write(s);
Any help is much appreciated.
Thanks
AD
<identity impersonate="false" />. IIS is configured to use only "Integrated
Windows authentication".
I need to get the NetworkCredential object from the logged in WINDOWS user
to pass it to another application. I tried to use the code below, however
the Domian, UserName and Password property of the NetworkCredential object
are all empty. Is there any way I can get the NetworkCredential object
using Impersonation in code.
//--Impersonation
System.Security.Principal.WindowsImpersonationContext impersonationContext;
impersonationContext =
((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();
impersonationContext
=System.Security.Principal.WindowsIdentity.GetCurrent().Impersonate();
System.Net.NetworkCredential
cred=(System.Net.NetworkCredential)System.Net.CredentialCache.DefaultCredent
ials;
string s="cred.Domain=" + cred.Domain + "<br>";
s+="cred.UserName=" + cred.UserName + "<br>";
s+="cred.Password=" + cred.Password + "<br>";
Response.Write(s);
Any help is much appreciated.
Thanks
AD