The information in this article applies to:
SUMMARYThis article describes how to store an authenticated user name in a session variable for later use in Web pages. MORE INFORMATION
Typically, when permissions are applied to a Web page and a client browses
the page, a status code of 401 is returned to the browser and it displays
a logon dialog. When the user enters a name and password, the client is
either allowed to enter the site or denied access. If the user is allowed
access, the server environment variable named LOGON_USER will contain the
user name as entered by the client.
Then include the following code at the very top of (at least) the first ASP page that needs the variable:
You can include the code on every page if you want to be sure that a client has bypassed the starting page for a Web site or Web application. When the variable has been populated, you can then reference it when you need it, as follows:
You can also force the authentication process at any time by abandoning the session:
The following page illustrates the above examples in a page that will set the timeout to one minute, authenticate the user, and then authenticate the user if the page is refreshed after being left idle for the one minute timeout. NOTE: Even after abandoning the session, the browser is still holding the logon credentials.
Keywords : |
Last Reviewed: April 30, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |