Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 6th, 2006, 09:10 AM
Authorized User
 
Join Date: Sep 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default login name

Can someone help me. I'm using this code: "System.Security.Principal.WindowsIdentity.GetCurr ent.Name" to get the current user login name from their computer, but in terms it gives me IUSR_servername instead. What shall i do to correct this. Also on my table in sql I have the curret_user to record the person who imputs an entry and it give me the same IUSR_servername instead of the login name. Please Help!!!

Alexander Nelson
Programmer
__________________
Alexander Nelson
Programmer
 
Old September 6th, 2006, 09:44 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Is this a Windows Application or an ASP.NET application?

Since you are getting the IUSR_[machineName] I am going to assume that this is an ASP application. To get the currently logged on Domain User do this:

Request.ServerVariables("Remote_User")

This will return [domain]\[user] but only works when the User requesting the application is on the same network as the Webserver, else it returns an empty string.

"The one language all programmers understand is profanity."
 
Old September 6th, 2006, 01:36 PM
Authorized User
 
Join Date: Sep 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, it's an ASP.net application. Thanks alot for the code, but I tried it and it gave me an empty string. I think I'm on the same network as the server. How can I tell?

Alexander Nelson
Programmer
 
Old September 6th, 2006, 01:53 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Well, for example, the webserver that all of my intranet applications are hosted from exists in my Active Directory and is part of the domain that all of the network users belong to.

Pretty much, is your web server in house or co-located somewhere?

"The one language all programmers understand is profanity."
 
Old September 7th, 2006, 08:16 AM
Authorized User
 
Join Date: Sep 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The webserver is co-located elsewhere. Is there any other way I can get the user login name instead of ISUR_servername from here?

Alexander Nelson
Programmer
 
Old September 7th, 2006, 08:23 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

The windows account that X user is logged onto from a remote pc outside your network? No not that I know of. The only thing you can do is force them to setup a username and password system and force them to login when they come to your application.

"The one language all programmers understand is profanity."
 
Old September 7th, 2006, 09:55 AM
Authorized User
 
Join Date: Sep 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's what I didn't want to do, but I guess that doesn't leave me a choice. Thanks a lot for all your help!!!

Alexander Nelson
Programmer
 
Old September 7th, 2006, 12:01 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Well if you think about it, a users login name for their PC is ONLY unique to their PC so it doesn't make sense to setup a user system that way. Not only that, you walk to fine line of privacy when you talk about capturing information like that from a users PC.

"The one language all programmers understand is profanity."





Similar Threads
Thread Thread Starter Forum Replies Last Post
login script: user can't hit "return" for login dmerrill Java Basics 13 July 14th, 2006 07:25 PM
Newbie Help. Login to unique login page per user Kainan Classic ASP Professional 10 May 3rd, 2005 07:47 AM
login failed for user nt authority\anonymous login rj1406 Classic ASP Databases 1 October 24th, 2004 09:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.