Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Logout and windows Authentication 1

Status
Not open for further replies.

JHDavis

Programmer
Aug 17, 2002
19
US
Can I force a login everytime the page is loaded/refreshed?

How about forcing a logoff?

I'm using windows authentication, and need the abilty for many users to login to the form, check in/out for duty, submit and then refresh with login prompt for the next guy in line.

Thanks!
 
Do you mean like a line of people waiting their turn to submit a simple HTML form?
 
Yes, it's to automate checking off/checking on base. We have already implemented it for users who are at their workstation, but also need to address persons who haven't done so and must check out/in at post.
 
So I guess my question basically is, can I get a log-in prompt at refesh?
 
OK, I've knocked up a quick example - this allows 1 time succesful view of a page before requiring the user to authenticate again.
Code:
<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1

	
	If Request.ServerVariables("LOGON_USER") = "" or Session("AUTH_STEP") = "" Then 
		Response.Status = "401 Unauthorized"
		Response.AddHeader "[URL unfurl="true"]WWW-Authenticate","NTLM"[/URL]
		Session("AUTH_STEP") = 1
		Response.End
	end if
	
	if Session("AUTH_STEP") = 1 then
		Session("CURRENT_USER") = Request.ServerVariables("LOGON_USER")
		Session("AUTH_STEP") = 2
	end if
	
	if Session("AUTH_STEP") = 2 then
		Session("CURRENT_USER") = ""
		Response.Status = "401 Unauthorized"
		Response.AddHeader "[URL unfurl="true"]WWW-Authenticate","NTLM"[/URL]
		Session("AUTH_STEP") = 0
		Response.End
	end if
	
%>
<html>
<head>
<title>Success!</title>
</head>
<body>
Successfully logged in for one time viewing @ <%=now()%>
<br />
Your authentication has now expired.
</body>
</html>

Although it is what you ask for, I'm not too sure if this is the best way of achieving what you have in mind - will people only ever view 1 page whilst logged on ? - and not need to refresh it ?

Anyway, hope that helps,

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Damber,

This is exactly my requirements.

Thank you very much for your assistance, it is greatly appreciated.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top