Results 1 to 9 of 9

Thread: ASP - Session Tracking [Resolved]

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60

    Resolved ASP - Session Tracking [Resolved]

    Hi,
    I am using session tracking in ASP. It works fine until I try to go backwards in my flow. For example, after my login page, I log in with a valid userid and password. It directs me to the mainpage, and i click on the link, then from the link I have a back button. Upon pressing tat, I should go back to the previous page (MainPage.asp) but instead it redirect me back to the login page and I have to re-login again to enter MainPage. why is this so? Is it tat session tracking cannot move backwards? Can someone solve this problem? Thanks.

    <html>
    <title>Configuration</title>
    <body>
    <%
    If (Session("UserName") = "") And (Session("Password") = "") Then
    Response.Redirect "LoginPage.asp"
    End If
    %>
    <form method="post" action="Config.asp">
    Group:
    <input type="text" name="group" value="01" size="3">
    <p>
    <input type="submit" value="List IP Address">
    <p>
    <a href="MainPage.asp">Previous Page</a> <a href="Exit.asp">Logout
    </form>
    </body>
    </html>
    Last edited by iori85z; Sep 23rd, 2004 at 10:53 PM.

  2. #2
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    Are the separate pages checking to see if you're logged in? (Ie, if you type in the URL of a page you should only access when logged in, can you get there without being logged in?). If you're checking that, make sure all the pages have the exact same session variable being checked.

    cjqp
    When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.

  3. #3
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    IE reloads pages when you use the back button.

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    So do u mean tat there is no way tat I can go back to the previous page if I use session tracking? Then if it is like tat it will be veri troublesome cause everytime i press the back button it will auto log-out the user then the user have to log-in again to go into the mainpage to select their actions.

    And cjqp, I have check it already, all the pages have the same session variable so i doubt tat is the problem wif it. Haiz...

  5. #5
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    Originally posted by iori85z
    So do u mean tat there is no way tat I can go back to the previous page if I use session tracking?
    No, I mean it is generally accepted that internet applications are "stateless," and do not quailfy as an appropriate medium for stateful applications. ASP.NET makes claims to take care of this problem, but not remove it entirely.

    You must take into account that users will use the Back button, bookmark pages in the middle of your state diagram, and even quit unexpectedly.

  6. #6
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    I'm currently working on a site that requires login. I have two headers, one that check for an autologin and another that checks to see if the person's logged in. Some pages only have the autologin (such as the front page), others (such as account management) have the login check. On my pages I use Response.Expires = -1 , this tells the browser not to cache the page.

    cjqp
    When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    Ok, I get what both of u mean. So any suggestions about what I do? Do the page expire like wat cjqp did?

  8. #8
    New Member
    Join Date
    Jul 2004
    Posts
    4
    page1.asp
    ________

    here u will enter username & password
    Username<input type=text name=T1>
    Password<input type=text name=T2>

    page2.asp
    ________
    <%
    If (Session("UserName") = "") And (Session("Password") = "") Then%>
    <% Session("Username")=Request.Form("T1")%>
    <% Session("Password")=Request.Form("T2")%>
    <%end if%>
    <html>
    <title>Configuration</title>
    <body>
    <%
    If (Session("UserName") = "") And (Session("Password") = "") Then
    Response.Redirect "LoginPage.asp"
    End If
    %>
    <form method="post" action="Config.asp">
    Group:
    <input type="text" name="group" value="01" size="3">
    <p>
    <input type="submit" value="List IP Address">
    <p>
    <a href="MainPage.asp">Previous Page</a> <a href="Exit.asp">Logout
    </form>
    </body>
    </html>

    page3.asp
    _________
    link to page2.asp

    hai friend try these lines and mail me if u have any problems
    bye
    my mailid : mail2mahesh2004@yahoo.co.in
    thanks

  9. #9

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60

    Thanks

    Heh, thanks man, ur code work out fine. It finally end my 2 weeks of pain debugging and changing the variables to no avail. Haha, i realli appreciate it alot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width