Forums

ASP

This topic is locked

Need to see the logged-in username!

Posted 18 Sep 2002 17:32:44
1
has voted
18 Sep 2002 17:32:44 Niall Porter posted:
Hi, hope someone can help...

I have built a web application for my company intranet which runs on IIS 5.0. The IIS Virtual Directory for the application uses the Basic Authentication (password is sent in clear text) method of authentication.

What this does is to check the username and password (and domain, if asked) supplied when the user logs in against the windows security system. This is fine, but I need to know if there's an object or object/method under ASP that can be used to return the username used to log in, i.e. the windows domain user that owns the current session? Is this possible?

TIA,
Niall

Replies

Replied 19 Sep 2002 00:01:12
19 Sep 2002 00:01:12 Rajiv Ladva replied:
I have done this using ASP.NET controls. Would you like the web user to view that they are identified by your application? This is what you will need to do:

1. Make sure you IIS box does not allow 'Anonymous' visits - this is NOT default

2. Using VB.net (you can also code using C#),
you can query and pull the username of the web user using:

<script language="VB" runat="server">
sub getUser(obj as object, e as eventargs)
Session("sesUser" = Context.User.Identity.Name
end sub
</script>

If you wanted this script to run when the page loads, simply change the VB routine to:

sub Page_Load(obj as object, e as eventargs)
...
end sub

Hope this helps.


<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi, hope someone can help...

I have built a web application for my company intranet which runs on IIS 5.0. The IIS Virtual Directory for the application uses the Basic Authentication (password is sent in clear text) method of authentication.

What this does is to check the username and password (and domain, if asked) supplied when the user logs in against the windows security system. This is fine, but I need to know if there's an object or object/method under ASP that can be used to return the username used to log in, i.e. the windows domain user that owns the current session? Is this possible?

TIA,
Niall
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Reply to this topic