By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,971 Members | 1,199 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,971 IT Pros & Developers. It's quick & easy.

capture window username

P: n/a
Hi

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

Cheers,
James
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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


"Z0gS" <an*******@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Hi

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

Nov 18 '05 #2

P: n/a
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.

----- Steve C. Orr [MVP, MCSD] wrote: -----

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


"Z0gS" <an*******@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Hi
How do I the the username that was used when you logged into Windows from asp .net or c#? Thanks Cheers,

James


Nov 18 '05 #3

P: n/a
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/de...ersonation.asp

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

"Z0gS" <an*******@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
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.
----- Steve C. Orr [MVP, MCSD] wrote: -----

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


"Z0gS" <an*******@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
> Hi
>> How do I the the username that was used when you logged into
Windows from
asp .net or c#? Thanks >> Cheers,

> James


Nov 18 '05 #4

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

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

//perform action here

context.Undo();
----- Steve C. Orr [MVP, MCSD] wrote: -----

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/de...ersonation.asp

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

"Z0gS" <an*******@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
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.
----- Steve C. Orr [MVP, MCSD] wrote: -----
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> "Z0gS" <an*******@discussions.microsoft.com> wrote in message news:C7**********************************@microsof t.com...
Hi
How do I the the username that was used when you logged into

Windows from asp .net or c#? Thanks Cheers,

James

Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.