Asp.Net >> capture window username

by WjBnUw » Wed, 04 Feb 2004 11:31:06 GMT

Hi

How do I the the username that was used when you logged into Windows from asp .net or c#? Thanks

Cheers,
James

Asp.Net >> capture window username

by Steve C. Orr [MVP, MCSD] » Wed, 04 Feb 2004 11:56:26 GMT


Try Request.ServerVariables("LOGON_USER").

Note that it may not work consistently if you allow anonymous users in IIS.
Here's more info:
http://www.4guysfromrolla.com/webtech/092298-3.shtml

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net






asp .net or c#? Thanks

Asp.Net >> capture window username

by WjBnUw » Wed, 04 Feb 2004 14:26:05 GMT


I need the window username and password information so that I can imporsonate to access a remote file server using the UNC path. How can I do that not using asp server object but asp .net or c# code.



Try Request.ServerVariables("LOGON_USER").

Note that it may not work consistently if you allow anonymous users in IIS.
Here's more info:
http://www.4guysfromrolla.com/webtech/092298-3.shtml

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net






> Hi
>> How do I the the username that was used when you logged into Windows from
asp .net or c#? Thanks
>> Cheers,
> James

Asp.Net >> capture window username

by Steve C. Orr [MVP, MCSD] » Wed, 04 Feb 2004 14:46:46 GMT

It's the same syntax for ASP and ASP.NET and C# and VB.NET:
Request.ServerVariables("LOGON_USER")

For impersonation details you can look here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetimpersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net





imporsonate to access a remote file server using the UNC path. How can I do
that not using asp server object but asp .net or c# code.

in IIS.


Windows from

Asp.Net >> capture window username

by WjBnUw » Wed, 04 Feb 2004 15:56:06 GMT

Can I do in the following way and setting <identity impersonate="false"/>

WindowsImpersonationContext context = WindowsIdentity.Impersonate(System.Security.Principal.WindowsIdentity.GetCurrent().Token);

//perform action here

context.Undo();




It's the same syntax for ASP and ASP.NET and C# and VB.NET:
Request.ServerVariables("LOGON_USER")

For impersonation details you can look here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetimpersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net





> I need the window username and password information so that I can
imporsonate to access a remote file server using the UNC path. How can I do
that not using asp server object but asp .net or c# code.

>> Try Request.ServerVariables("LOGON_USER").
>> Note that it may not work consistently if you allow anonymous users
in IIS.
> Here's more info:
> http://www.4guysfromrolla.com/webtech/092298-3.shtml
>> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net


>> Hi
>>> How do I the the username that was used when you logged into
Windows from
> asp .net or c#? Thanks
>>> Cheers,
>> James
>>>

Similar Threads

1. Capturing Windows Username without popping challenge box in the browser

Hi,
I am currenty working on a site for intranet.
I have a user control in the header of every page that will be
displayed only if people with certain username are surfing the site.
These lists of usernames is stored on the server side in a xml based
file

So what I am doing at the moment is inside the user control pageload
method, i get the username of the current person logged in using
HttpContext.Current.User.Identity.Name and if the username is within
the list of 'allowed-access-usernames', I continue loading the
usercontrol else I set its visibility to false
so they can't see it.

It all works fine if I try to access the site from localhost.
The application grabs my windows username and verfies it against the
list, if i am present in the list, I see the control else I don't

The problem comes when I try to access the site from different machine.
As soon as i try to access the page, IE pops up a window asking for
username and password which I don;t want to.
I want to just grab the username of currenty logged in user on the
machine and give it to the server.

Can anyone help me how do i achieve this?

BTW, I am doing this using windows authentication.
In the IIS 5.1, I have
Anonymous Access unchecked
Integrated Windows Authentication checked

In web.config file
I have windows authentication
and 
<identity impersonate="true" />


Thanks, 
Raj

2. capture window username to imporsonate - CSharp/C#

3. capturing username

I am trying to capture the Windows Authenticated username, but I want to be
able to capture the login name that exists in IIS, not Windows. In order to
enter my company's intranet through the internet, they have to login. I want
to be able to capture that login versus their Windows login because I need
to know who they are from any computer rather than only their computer.  Any
ideas?

Thanks




4. Capture username of who is connecting to my machine - VB.Net

5. capturing windows messages in window service application

Hello.

I am tryring to find a way to capture some of the windows messages ( eg.
messages for creating, deleting files ) in c#.

In windows application,  i can override wndProc method to capture OS's
messages but in windows service application, i don't have the access to
that.

is there a way to access windows api(wndProc) directly to this?

Thanx in advance


6. Capture windows.alert and windows.prompt with axWebBrowser - CSharp/C#

7. loginview control displays network username instead of (web) username

Hi,
I placed loginview control on aspx page to be navigated after login. And in 
loggedin view template I typed custom message and dragged-dropped loginname 
control on that template.

When I view this page in browser after login, it displays network username 
instead login name.
Any idea? Am I missing to set anything?

Thank you for your reply.

Shailesh 


8. processModel userName="MyDomain\UserName" - .Net Framework