Thread: ASP Session

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    12
    Rep Power
    0

    ASP Session


    Hello,

    I'm controlling my login page usign session.

    My problem is that i test my script in more than 5 windows servers : XP professional, Win 98 Personal web server, and advance 2000 server and is working fine.

    When i uploaded my script to my webhost account it seems sessions are not working.

    To understand better what i'm doing i copy my login script below:


    ============================================
    Login.asp
    ============================================

    <%
    Response.Buffer = True
    Response.Expires = -1000
    Const LoginButton = "Login"
    %>
    <!-- #include file=connect.inc -->
    <%
    If Request("Action") = LoginButton Then
    Set DB = Connect()
    SQL = "SELECT * FROM Login WHERE Username = '" + Request("Username") + "'"
    Set RS = DB.Execute (SQL)

    If (RS.EOF And RS.BOF) Then
    Session (SiteID + "Authentication") = False
    Response.Redirect ("default.asp?Error= Username+does+not+exist.")
    ElseIf RS("Password") <> Request ("Password") Then
    Session (SiteID + "Authentication") = False
    Response.Redirect("login.asp?Error=Invalid+Password")
    Else
    Session (SiteID + "Username") = RS("Username")
    Session (SiteID + "FName") = RS("FName")
    Session (SiteID + "LName") = RS("LName")
    Session (SiteID + "Authentication") = True
    Response.Redirect ("menu.asp")
    End If
    End If
    %>


    ==============================================


    Now you can see above if the login is correct will redirect you to menu.asp if not to the login.asp (same page) and display the error.

    When i'm trying to login now is redirecting me always to default.asp and i'm getting page not found.

    This is happens only to my external hosting account, in my servers locally is working fine. Also i uploaded it to some free asp hosts and was also working fine.

    Is anybody familiar with this problem. Its very strange to me.

    Thanks for your help / suggestions.

    Andreas
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    NJ
    Posts
    428
    Rep Power
    16
    Perhaps you best bet is to talk to whoever hosts your site. It clearsly sounds like an issue with the server and not with your code. If you tested it in five other places and it worked fine then most likely it is the way the servers are set up. Perhaps the disable session for performance increase? I also beleive that there is an issue with session and clusters of web servers. Perhaps there is a way around it, but i don't know too much about it, i just remember reading it. Who is your host? is it a reputable place?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    138
    Rep Power
    12
    Not that we don't believe you but before you blame the provider I would do a few tests. Eg are you sure you html form has an input named "Username". You may have it locally but is the live one identicle? Does the live database have any data. I would like to see the output of the next two queries.

    Code:
    SQL = "SELECT * FROM Login WHERE Username = '" + Request("Username") + "'"
    
    response.write SQL & "<br>"
    Set RS = DB.Execute (SQL)
    While NOT rs.EOF
      response.write rs("Password") & "<br>"
      rs.moveNext
    Wend
    Code:
    SQL = "SELECT * FROM Login"
    Set RS = DB.Execute (SQL)
    While NOT rs.EOF
      response.write rs("Password") & "<br>"
      rs.moveNext
    Wend
    I'm sure this will give you enough information to find out whats going on. If it doesn't check what version of IIS and ASP the live server is using.
    --

    ngibsonau
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    12
    Rep Power
    0

    Re


    Thanks for your reply,

    My html code is working fine.

    My field is named username.

    Also if their are no data in databasei'm writing the error in html:

    <%= Request("Error") %>

    so if username is not found or is empty it will show Username does not exist if the username found and match it will check for password and if not match it will write password does not exist.

    All this are working fine. I bet is something wrong with their server.

    Thanks
    Last edited by andreasg60; April 12th, 2003 at 07:00 AM.

IMN logo majestic logo threadwatch logo seochat tools logo