WindowsIdentity vs User.Identity ??
From: Claude Vernier (ClaudeVernier_at_discussions.microsoft.com)
Date: 04/28/05
- Next message: Claude Vernier: "WindowsIdentity vs User.Identity ??"
- Previous message: Claude Vernier: "WindowsIdentity vs User.Identity ??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 28 Apr 2005 05:22:07 -0700
Hello,
I have a web application for our intranet.
Built in ASP.Net using C# running on WinXp and IIS.
I wanted the application to impersonate the current user that logged onto
Windows.
So, in IIS, I checked only the Windows authentication.
In web config, I used
<authentication mode="Windows"/>
<identity impersonate="true"/>
That's all well.
But now, I want all users to connect as the same one user and it doesn't work.
Right now, when I use the application, the current user is myself:
"MyBigDomain\ClaudeVernier".
Off course, if my colleague is using it, the current user is himself:
"MyBigDomain\colleaguehimself".
I wanted to change only the web.config so any user are impersonating a new
NT user called: "MyBigDomain\ThisUserIsGod"
<authentication mode="Windows"/>
<identity impersonate="true" userName="MyBigDomain\ThisUserIsGod"
password="PasswordForGod"/>
I have this strange behavior, I guess its ok, but I don't understand it.
I tried to find the name of the current user using this line:
User.Identity.Name //Returns: "MyBigDomain\ClaudeVernier"
while I was expecting God, so I tried this one, and it was ok.
System.Security.Principal.WindowsIdentity.GetCurrent().Name //Returns:
"MyBigDomain\ThisUserIsGod"
So, I'd like to understand the difference between the two and should I do
this differently.
Also, if anyone knows a trick so the user could change the impersonation
himself, it would be great.
For example, using a "Login As" button, it would popup the logon window
provided by Windows.
Thanks a lot,
Claude Vernier
ps: Please excuse me if my english is not yet perfect.
- Next message: Claude Vernier: "WindowsIdentity vs User.Identity ??"
- Previous message: Claude Vernier: "WindowsIdentity vs User.Identity ??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]