Logging off from a website

Discussion in 'ASP General' started by Geoff Wickens, Aug 27, 2003.

  1. I am amazed at how much help I have had in creating my first asp based
    website from this forum. There are obviously a significant number of real
    experts who are happy to take the time to help us novices. My site which now
    does what it aims to would not be working without this assistance and I am
    extremely grateful. Long may it continue!!!!!

    My next problem is as below:

    I have created a website where various categories of users can log on to get
    at secure pages. I do this by checking usernames and passwords against a
    list in a database and set session("loginadmin")=true or
    session("loginctte")=true depending on what category is stored in my
    database. On the secure pages I now want to put a log off button and am
    interested to know what code I need.

    Currently I have created a form and this calls a page (logouthandler.asp).
    The code on this page is

    <%
    session("loginadmin")=false
    session("loginctte")=false
    response.redirect ("../index.asp")

    %>

    Does this do anything worthwile and is anything else recommended?

    Geoff Wickens
    Geoff Wickens, Aug 27, 2003
    #1
    1. Advertising

  2. Geoff Wickens

    Ken Schaefer Guest

    You can do that. However, if you end up having a large number of session
    variables, then your code will become cumbersome to write. You could do:

    <%
    Session.Abandon
    Response.Redirect(...)
    %>

    Cheers
    Ken


    "Geoff Wickens" <> wrote in message
    news:szY2b.46$...
    ....
    : I have created a website where various categories of users can log on to
    get
    : at secure pages. I do this by checking usernames and passwords against a
    : list in a database and set session("loginadmin")=true or
    : session("loginctte")=true depending on what category is stored in my
    : database. On the secure pages I now want to put a log off button and am
    : interested to know what code I need.
    :
    : Currently I have created a form and this calls a page (logouthandler.asp).
    : The code on this page is
    :
    : <%
    : session("loginadmin")=false
    : session("loginctte")=false
    : response.redirect ("../index.asp")
    :
    : %>
    :
    : Does this do anything worthwile and is anything else recommended?
    Ken Schaefer, Aug 27, 2003
    #2
    1. Advertising

  3. Geoff Wickens

    Dan Brussee Guest

    On Wed, 27 Aug 2003 07:52:12 +0100, "Geoff Wickens"
    <> wrote:
    >I have created a website where various categories of users can log on to get
    >at secure pages. I do this by checking usernames and passwords against a
    >list in a database and set session("loginadmin")=true or
    >session("loginctte")=true depending on what category is stored in my
    >database. On the secure pages I now want to put a log off button and am
    >interested to know what code I need.
    >
    >Currently I have created a form and this calls a page (logouthandler.asp).
    >The code on this page is
    >
    ><%
    >session("loginadmin")=false
    >session("loginctte")=false
    >response.redirect ("../index.asp")
    >
    >%>


    Just to make things simpler (in my opinion without seeing your other
    code), I have typically used something like:

    session("usertype") = "admin"

    when logging on and then check the usertype session variable later
    when trying to determine if a feature is available, etc

    select case session("usertype")
    case "admin":
    case "ctte": ' huh?
    case else: response.redirect "/index.asp"
    end select

    As already stated, all you need to do is abandon the session to "log
    out" then.
    Dan Brussee, Aug 27, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. - Steve -

    Logging Off Forms Based Authentication

    - Steve -, Jun 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    344
    S. Justin Gengo
    Jun 18, 2004
  2. =?Utf-8?B?VGVycnk=?=
    Replies:
    2
    Views:
    462
    =?Utf-8?B?QmlsbCBMb25n?=
    Oct 27, 2005
  3. Steve
    Replies:
    0
    Views:
    452
    Steve
    Jan 31, 2006
  4. Wayne...
    Replies:
    15
    Views:
    766
    Toby Inkster
    Jul 23, 2004
  5. robert112
    Replies:
    1
    Views:
    437
    Juan T. Llibre
    Apr 26, 2007
Loading...

Share This Page