PDA

View Full Version : WindowsIdentity


pongourcom1
03-11-2005, 02:54 AM
How can we check WindowsIdentity on client machine using our webfrom? Please help me out.
Thanks.

pongourcom1
03-11-2005, 04:09 AM
I think this code is for Windows application. If we use it in a webform it always returnmy Discountasp.net server machine ID: WEB110\aspnet_1280.. What I wish to know is the machine ID the user uses to connect to my web sites. Thanks.

bruce
03-11-2005, 07:50 AM
I do not think it is possible. Webform application (on the server) do not have access to security information on the client machine.

Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

pongourcom1
03-11-2005, 08:31 AM
Thank you for your kind responses. You might be right. I'm now turning to VBScripts for a solution. Do you have any suggestions on this subject?

Deprecated
03-11-2005, 08:37 AM
try reading through the WindowsIdentity class: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemsecurityprincipalwindowsidentityclassto pic.asp


[quote]


System.Security.Principal.WindowsIdentity.GetCurre nt()That'll get your the current WindowsIdentity.

----
Brian H. Madsen
Microsoft SQL Server IG Perth - Organiser
http://www.sqlserver.org.au

pongourcom1
03-12-2005, 04:32 AM
Now Ihave managed toobtain the information I need through a VBScript but I don't know how to migrate it to server side code. Could you please help me out? Thanks.

womalley
06-01-2005, 05:55 AM
System.Security.Principal.WindowsImpersonationCont ext userID;
this.userID = ((System.Security.Principal.WindowsIdentity)User.I dentity).Impersonate();








try that one :)





Will

pongourcom1
06-01-2005, 07:18 AM
After adding references to Windows.Form and System.Security I plugged your code into a test web application as follows:


protected System.Security.Principal.WindowsImpersonationCont ext userID;


private void Page_Load(object sender, System.EventArgs e){


this.userID = ((System.Security.Principal.WindowsIdentity)User.I dentity).Impersonate();


}


ERROR: An anonymous identity cannot perform an impersonation.


Thank you for your kind response.

womalley
06-01-2005, 07:57 AM
you need to change the settings for the project in IIS
you are not using Windows Authentication



run Microsoft Management Console (MMC)


Add the IIS Add-In


Right click on your website project folder


Goto Directory Security


Hit the Edit Button


Make sure that Integrated Windows Authentication is checked.





I believe this will only work for computers logged into your domain using their Windows Password (Intranet) not Internet users


I could be wrong =)





other then that I am not sure.





Will

Post Edited (womalley) : 6/1/2005 9:15:11 PM GMT

pongourcom1
06-01-2005, 08:24 AM
Internet users are my primary targets.


Thank you for your response.