devxlogo

Logging off a Web site

Logging off a Web site

Question:
I have a Web site that forces a login with NT security. (Thus the person has to have an NT account to login.) I want to include a logoff button that logs users out of the account when they are finished. Do you know a way of doing this? As of yet the only way I have found is to close the browser.

Answer:

You could use the Status property of the Response object to send out a 401 status code.That will throw up an authentication dialog box. You could also abandon any sessionvariables at the same time. Here’s how the code might look at the top of your ASP page:

if Request.Form("logout")="yes" then
Response.Status = "401 Unauthorized"
Response.end
end if

Here’s what you might put in the logoff form:



devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist