473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

capture window username

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
4 1492
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Me Mine | last post by:
i, I have trying to code a small console app that will allow a user to select a window and then create a screen capture of the window. I haven't been able to figure out how to do the screen...
6
by: Clara | last post by:
Hi,... I meant to write an application where there is a button in a window and when you click on the button, it will open a new window, but I want the first window to close, replaced by the second...
2
by: aimee | last post by:
Hi. Is there a way to capture the events fired in a PrintDialog? I would like to capture when the user presses "Print" so I can do some cleanup. The asp.net (IE6) application I'm working on has 6...
2
by: Z0gS | last post by:
How do I get the window username and password information so that I can imporsonate to access a remote file server using the UNC path using asp .net or c# code.
1
by: DalePres | last post by:
I need to be able to do screen captures of a window that is covered by another window. All the examples I find capture the display at the target window coordinates, so it shows a section of the...
3
by: William Stacey [MVP] | last post by:
Is this a bug in fx2? I expect they did not carry forward all the StartInfo properties to api used with Username/Password. When you remove UserName/password, the window does not show as expected....
1
by: Marie Mercier | last post by:
Hi, would anyone know how, in VB.NET to capture a username of anyone who accesses my machine from our LAN. I have used System.Diagnostics, but I get no username or machine name. I have been asked...
3
by: Newbie Coder | last post by:
Hello All VB.NET 2003 Code Only (not C#) How do I capture a window by knowing its class name & save it as a jpg on a button click? Of course the window won't be in focus Any help would be...
1
by: geetamadhavi | last post by:
Hi All, I have developed a php applciaiton where a new window is opening on checking the whether valid user orntot how to make that in same window after checking i have die(' not valid user ' ); i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.