PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

capture window username

 
 
=?Utf-8?B?WjBnUw==?=
Guest
Posts: n/a
 
      4th Feb 2004
Hi

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

Cheers,
James
 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      4th Feb 2004
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" <(E-Mail Removed)> wrote in message
news:C78BD2D5-2803-40E0-A0D3-(E-Mail Removed)...
> Hi
>
> How do I the the username that was used when you logged into Windows from

asp .net or c#? Thanks
>
> Cheers,
> James



 
Reply With Quote
 
=?Utf-8?B?WjBnUw==?=
Guest
Posts: n/a
 
      4th Feb 2004
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" <(E-Mail Removed)> wrote in message
news:C78BD2D5-2803-40E0-A0D3-(E-Mail Removed)...
> Hi
>> How do I the the username that was used when you logged into Windows from

asp .net or c#? Thanks
>> Cheers,

> James




 
Reply With Quote
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      4th Feb 2004
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" <(E-Mail Removed)> wrote in message
news:73203DEE-60D5-43EF-AA4A-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:C78BD2D5-2803-40E0-A0D3-(E-Mail Removed)...
> > Hi
> >> How do I the the username that was used when you logged into

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

> > James

>
>
>



 
Reply With Quote
 
=?Utf-8?B?WjBnUw==?=
Guest
Posts: n/a
 
      4th Feb 2004
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();


----- 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" <(E-Mail Removed)> wrote in message
news:73203DEE-60D5-43EF-AA4A-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message

> news:C78BD2D5-2803-40E0-A0D3-(E-Mail Removed)...
>> Hi
>>> How do I the the username that was used when you logged into

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

>> James
>>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capture NT username AndrewB Microsoft Access Security 4 19th Dec 2008 11:01 PM
Capture UserName =?Utf-8?B?Um9lQ2FzdGxl?= Microsoft Access VBA Modules 1 26th Jan 2007 04:09 PM
Capture NT username for form =?Utf-8?B?Q2FmZmU=?= Microsoft Access Security 3 2nd Jun 2005 05:21 PM
capture window username to imporsonate =?Utf-8?B?WjBnUw==?= Microsoft C# .NET 2 4th Feb 2004 01:53 PM
Capture UserName for Log Terry Microsoft Access Security 2 25th Aug 2003 04:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:04 PM.