Results 1 to 3 of 3

Thread: Redirect than Write?

  1. #1
    Join Date
    May 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Redirect than Write?

    Code:
    <%
    username = Session("username")
    if ("" = username) Then
    Response.redirect "login.asp"
    response.Write("Sorry, you are not logged in.")
    response.End
    End if
    %>
    How do i write that Sorry, you are not logged in ... to the login.asp?

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by TheShadow
    Code:
    <%
    username = Session("username")
    if ("" = username) Then
    Response.redirect "login.asp"
    response.Write("Sorry, you are not logged in.")
    response.End
    End if
    %>
    How do i write that Sorry, you are not logged in ... to the login.asp?
    I don't 'do' ASP so I can't provide specifics.

    I assume that login.asp is used to receive input from the user. If so, the login.asp should be checking the input itself. That is, it should submit the form to itself.

    If the data is invalid, you can serve up a slightly different document with an error message inserted. If valid, login.asp can redirect to a member page, or wherever is most appropriate.

    Time delayed redirection, like that used in this forum when logging in, should be avoided in my opinion, mainly because that type of redirection is non-standard, generally frowned upon, and can be disabled (in other words, it's not reliable).

    Mike

  3. #3
    Join Date
    May 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Shadow,

    You're best bet is to querystring the response.redirect, for example:
    Code:
    <%
    username = Session("username")
    if ("" = username) Then
    Response.redirect "login.asp?status=notloggedin"
    response.End
    End if
    %>
    Then, in the code of you're login.asp page, where you want the message to appear, put an If statement:

    Code:
    <%
    if request.querystring("status") = "notloggedin" then response.write("Sorry, you are not logged in.")
    %>
    I hope this works

    Carl.

Bookmarks

Posting Permissions

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