Creating a session (newbie):


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Creating a session (newbie):

  1. #1
    Jay Guest

    Creating a session (newbie):


    Hello. I'm creating a CBT (all ASP). The first page is home.asp, and the
    final page is lasquiz.asp. Once they enter the "final chapter", the quiz
    -- the lasquiz.asp, I don't want them to be able to go back at all. No back
    buttons, etc. .... I was told I could get around this by creating a session
    and having that redirect them back to the quiz if the session isn't true.

    I already have session variable set up. For example, at the top of ever
    .asp page, I have:

    <%
    'If the session variable is False or does not exsist then redirect
    If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood")) =
    True then
    Response.Redirect"../../login.asp"
    End If
    %>

    Therefore, it redirects them to the login page if they haven't logged in.
    But does anyone know of a way (to a newbie) to make it so that once they
    enter the final page, the quiz, they can't leave until they've finished it?
    Creating another session (that won't clash with the above session) is the
    answer? Thank you for reading this and being nice 'cause I'm clueless.

    Jay

  2. #2
    JS Guest

    Re: Creating a session (newbie):


    There is no way you can keep them from going back, because the pages are cached...what
    you can do is this...

    create a cookie that stores their login info...on the page before the quiz
    set a flag in the cookie...

    on every previous page you must check the value of the cookie and compare
    it to the one you set it as...

    after completing the page before the quiz make them click a link for instructions
    on how to take the quiz...abandon the session on that page...and instruct
    them to close thier broswers...then, open them again and login...this will
    ensure that the session is closed..once they login again the cookie will
    be checked first and direct them to the quiz?

    simple? if you have questions, just post again

    "Jay" <lukumski@hotmail.com> wrote:
    >
    >Hello. I'm creating a CBT (all ASP). The first page is home.asp, and the
    >final page is lasquiz.asp. Once they enter the "final chapter", the quiz
    >-- the lasquiz.asp, I don't want them to be able to go back at all. No

    back
    >buttons, etc. .... I was told I could get around this by creating a session
    >and having that redirect them back to the quiz if the session isn't true.
    >
    >I already have session variable set up. For example, at the top of ever
    >.asp page, I have:
    >
    ><%
    >'If the session variable is False or does not exsist then redirect
    >If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood"))

    =
    >True then
    > Response.Redirect"../../login.asp"
    >End If
    >%>
    >
    >Therefore, it redirects them to the login page if they haven't logged in.
    > But does anyone know of a way (to a newbie) to make it so that once they
    >enter the final page, the quiz, they can't leave until they've finished

    it?
    > Creating another session (that won't clash with the above session) is the
    >answer? Thank you for reading this and being nice 'cause I'm clueless.


    >
    >Jay



  3. #3
    JS Guest

    Re: Creating a session (newbie):


    Changed my mind...I found a way to do it....

    ok on every page put this

    if session("quiz") <>"" then
    response.redirect "quiz.asp"
    end if
    Response.Buffer = True
    Response.ExpiresAbsolute = Now() - 1
    Response.Expires = 0
    Response.CacheControl = "no-cache"


    ' in your quiz page(quiz.asp) set session("quiz") = 'whateveryou want
    basically what this does is it doesnt cache the pages...so when you click
    back it redirects you to the quiz page....

    "Jay" <lukumski@hotmail.com> wrote:
    >
    >Hello. I'm creating a CBT (all ASP). The first page is home.asp, and the
    >final page is lasquiz.asp. Once they enter the "final chapter", the quiz
    >-- the lasquiz.asp, I don't want them to be able to go back at all. No

    back
    >buttons, etc. .... I was told I could get around this by creating a session
    >and having that redirect them back to the quiz if the session isn't true.
    >
    >I already have session variable set up. For example, at the top of ever
    >.asp page, I have:
    >
    ><%
    >'If the session variable is False or does not exsist then redirect
    >If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood"))

    =
    >True then
    > Response.Redirect"../../login.asp"
    >End If
    >%>
    >
    >Therefore, it redirects them to the login page if they haven't logged in.
    > But does anyone know of a way (to a newbie) to make it so that once they
    >enter the final page, the quiz, they can't leave until they've finished

    it?
    > Creating another session (that won't clash with the above session) is the
    >answer? Thank you for reading this and being nice 'cause I'm clueless.


    >
    >Jay



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center