Forums

This topic is locked

Redirect to log out page if logged in!

Posted 15 Jul 2002 13:15:07
1
has voted
15 Jul 2002 13:15:07 Gretarsson Ingi Orn posted:
Hi. I´m pretty sure that this one is easy for you guy, but since I´m still learning I would like to ask. Can any1 tell my how to do thi. e.g. write a simple code on my login page that checks to see if the user is logged in if not then display the login page else redirect to the logout page? I know this is probably a stupid q but I´m trying to learn! Any help or tips would be great!

Ingi Orn Gretarsson

Replies

Replied 15 Jul 2002 14:01:35
15 Jul 2002 14:01:35 Dave Thomas replied:
A simple "Check Authorisation" can do this for you and there is one built in with Ultradev.

Under the "Server Behaviours" tab, in "User Authentication" there is a number of options, choose "Restrict access to page" and fill in the fields that it asks for...
E.G, what permissions, what page you want to redirect to etc... and thats it.
When a user clicks on your page, it will check them against a relevant database (unsure of whether you are using cookies etc..) and if they are not logged in or authorised, send them to a login page.
Get back to us if you need any more help

"Get the kettle on, time for a brew"
Replied 15 Jul 2002 15:09:49
15 Jul 2002 15:09:49 Gretarsson Ingi Orn replied:
Is it possible to restrict the page to any1 who is logged in then and only show it to thouse that aren´t logged in?

using cookies!

Ingi Orn Gretarsson
Replied 15 Jul 2002 19:36:38
15 Jul 2002 19:36:38 aegis kleais replied:
Macromedia creates a Session variable called MM_Username when a successful login has occured. So try this code as an include on each page:

<%
If Session("MM_Username" = "" Then Response.Redirect("login.asp"
%>

Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
Replied 15 Jul 2002 19:48:34
15 Jul 2002 19:48:34 Gretarsson Ingi Orn replied:
Thanks guy´s This helped me alot.... Actually what I was looking for was :
<%
If Session("MM_Username" <> "" Then Response.Redirect("log_out.asp"
%>

Works Fine now! Gracias! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Ingi Orn Gretarsson

Reply to this topic