Logout Script

R

rhynos77

Hi there

I've set up password protected .asp pages in my FP2003 web following
instructions in article 825498.

I'd like users to be able to log out. However, I want a hyperlink to appear
only when the user is logged in.

As per article 825498 a small piece of script is inserted on all password
protected .asp pages to show a message that either says 'You are not logged
in' or their username if they are logged in.

<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on.</b>"
Else
Response.Write "<b>" & Session("UID") & "</b>"
End If
%>

Is there some way of modifying this 'Else' statement to include a link to
logout? Eg. when the user is logged in it says "You are logged in as
rhynos77. Click here to log out?

I'm a novice so I hope this makes sense.

Ryan
 
S

Stefan B Rusynko

<%
If Len(Session("UID")) = 0 Then
Response.Write "<a href='yourloginpage.asp'>You are not logged on. Log In</a>"
Else
Response.Write "You are logged in as " & Session("UID") & ". <a href='yourloginoutpage.asp'> Click here to log out</a>"
End If
%>


Your yourloginoutpage.asp page only needs
<%
Session.Abandon
Response.Redirect "anyotherpage.asp"
%>


_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


| Hi there
|
| I've set up password protected .asp pages in my FP2003 web following
| instructions in article 825498.
|
| I'd like users to be able to log out. However, I want a hyperlink to appear
| only when the user is logged in.
|
| As per article 825498 a small piece of script is inserted on all password
| protected .asp pages to show a message that either says 'You are not logged
| in' or their username if they are logged in.
|
| <%
| If Len(Session("UID")) = 0 Then
| Response.Write "<b>You are not logged on.</b>"
| Else
| Response.Write "<b>" & Session("UID") & "</b>"
| End If
| %>
|
| Is there some way of modifying this 'Else' statement to include a link to
| logout? Eg. when the user is logged in it says "You are logged in as
| rhynos77. Click here to log out?
|
| I'm a novice so I hope this makes sense.
|
| Ryan
|
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top