Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WindowsIdentity.GetCurrent.Name does not work 2

Status
Not open for further replies.

Katya85S

Programmer
Jul 19, 2004
190
In asp.net application, intranet, Windows Authentication, I have to identify user credentials (to respond on users' questions, send e-mails and so on).
To find user name I use
Protected strUser As String = CStr(System.Security.Principal.WindowsIdentity.GetCurrent.Name.ToStrin())
And then I would use DirectoryEntry and DirectorySearch objects to find User Name, Email and so on.
Till recent it worked fine. But now, I don’t know what could possibly happen, the strUser instead of bringing logged on user name (Domain/UserName) gives me the following data “NT AUTHORITY\NETWORK SERVICE”. How can I fix it? The application has to identify real user name and credentials….
In IIS the anonymus authentication is turned off for these pages.
Any ideas?
Thank you all in advance
 
Is impersonation still turned on in the web.config file?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Where should i look for it in the web.config? I was literally looking for "impersonation" but didn't find anything similar.
As for teh authorization section, I have:
<authorization>
<allow users="*" /> <!-- Allow all users -->
</authorization>
 
There should be a section called identity e.g.
Code:
<identity impersonate="true" />


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Many-many thank you!
I've added the identity section with true impersonate value and this fixed the problem.
Thank you very much! :)
 
Thanks. I found this and it was very helpful to me in capturing the current userid for another purpose. Thanks again.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top