Why? Session variable is valid once only?

Results 1 to 3 of 3

Thread: Why? Session variable is valid once only?

  1. #1
    Terry Lai Guest

    Default Why? Session variable is valid once only?

    Hi, <BR><BR>I am now writing a login page using ASP. In my login.asp I submit form values to another page login2.asp. If the login name and password are correct, login2.asp will set a session variable "LoginOK" to true and redirect the page to service.asp. In the beginning of service.asp, it will check whether "LoginOK" is true or false. If false, it will redirect the page to login again. I have done this with no problem initially. But when I go into the service page and press the refresh button on the IE browser, I find that the page is redirect to login.asp. <BR><BR>Why? Can anyone tell me please?<BR><BR><BR>

  2. #2
    anshtine Guest

    Default RE: Why? Session variable is valid once only?

    1. you must make an "inc" file - auth.inc:<BR>&#060;%<BR>Dim Login<BR>Response.Buffer = true<BR>Login = Session("LoggedIn")<BR>If (bLogged = false) Or (IsNull(bLogged)) Or (IsEmpty(bLogged)) Then<BR> response.redirect "login.asp"<BR> Session.Abandon<BR>End If<BR>%&#062;<BR>2. If the login name and password are correct, in login2.asp :<BR>Session("LoggedIn") = True<BR><BR>3. in service.asp - line1 and line2 in code:<BR>&#060;% response.buffer = true %&#062;<BR>&#060;!--#include file="auth.inc" --&#062;<BR>bla bla bla the rest of the code<BR><BR><BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    159

    Default RE: Why? Session variable is valid once only?

    &nbsp;<BR>I&#039m sorry that you cannot solve my problem. Your method can do.<BR>But the main point is when I press the refresh button on the IE browser, the service page goes to login page. This is my question which is why the session variable "loginok" not function normally? <BR><BR>But anyway, thank you. Nice to meet u. Where are u?<BR>

Posting Permissions

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