Results 1 to 13 of 13
  1. #1
    Join Date
    Oct 2004
    Posts
    26

    Exclamation Unanswered: Log In Page Redirection

    Hi, I am developing a user login page after registering user. I wonder if any one can provide me information about how to link the page to different asp files according to situation. I have attached my ASP code along with the database.

    If there is errorneous info in the RegUsr.asp file, user will return to RegUsr.asp. Else, user will be directed to login.asp after user successfully register themselves.

    A helping hand will be very much appreciated
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2005
    Posts
    36
    If I understand your question correctly - you want the user to go to different login pages after logging in - dependant upon what type of visitor they are?

    To do that - you'd need another field in your db - something like CustType. Then bring that back when you do your login script & if the user & PW match - take CustType and direct to the relevant page tied to CustType.

    Also - store CustType in a session variable - then at the top of each page in the login area - check for the session variable = the relevant CustType - if it doesn't match redirect to the login screen.

  3. #3
    Join Date
    Dec 2003
    Posts
    454
    Which page are you talking about? registration or login?

    For the registration page, you need to verify the information that the user submits. If registration is successful, the login should be automatically done. If the information is incomplete, the system should return the user to registration page and tell him/her what is wrong.

    For the login page, the user should be redirected to the right page if the login is okay, otherwise, the user should go back to the login page.
    Last edited by gyuan; 01-13-05 at 17:53.

  4. #4
    Join Date
    Oct 2004
    Posts
    26
    may be I should redefine my question. I only need to direct user to the login page after sucessfully login, not directly different type users to different pages too complex application for me any way.

    Ok, I have this register.asp page now. When the registration is successful, I want to direct user to the login page. If not, user will return to the registration page. I am not an advance user of ASP, with a lil handy knowledge of C++. So, I am developing my ASP documents using VB script instead of Java. I hope this will give you a clearer view about my question?
    I have the concept, but stucked on how to do it. May be any one of you can provide me some hint or links to this problem?
    Last edited by Dniz; 01-14-05 at 10:35.

  5. #5
    Join Date
    Dec 2003
    Posts
    454
    I don't think that you need to redirect the user to the Login page after her/his registration is successful. It should be automatically logged in. To do that, in your registration process file, you need to add a piece of code which should log the user in. In this case, after registration, the user will not need to go to login page. Otherwise, the user will feel not convenient. Does that help?

  6. #6
    Join Date
    Jan 2005
    Posts
    36
    In your code you have a section that tells the user - registration failed or registration was ok. Directly after this line of code

    Response.Write("A user account has been created for "&unm&" <BR>"&_
    "You can Log In to start using the web-based database.")

    do another response.write that puts a link "click here to jump to the login page"

    Or, if you wanted them to just go directly to the login page - replace the response.write line with response.redirect "loginpage.htm"

  7. #7
    Join Date
    Oct 2004
    Posts
    26

    Thumbs up

    Quote Originally Posted by DrewM
    In your code you have a section that tells the user - registration failed or registration was ok. Directly after this line of code

    Response.Write("A user account has been created for "&unm&" <BR>"&_
    "You can Log In to start using the web-based database.")

    do another response.write that puts a link "click here to jump to the login page"

    Or, if you wanted them to just go directly to the login page - replace the response.write line with response.redirect "loginpage.htm"
    Thanks for the advice. I have just discovered the response.redirect method but don't know how to use it. Luckily you have given me the guide. I am now able to redirect my page after registration to the login page now. Thanks!
    Last edited by Dniz; 01-15-05 at 11:15.

  8. #8
    Join Date
    Jan 2005
    Posts
    36
    You use it like this

    - say you want to go to newpage.asp

    response.redirect "newpage.asp"

  9. #9
    Join Date
    Dec 2003
    Posts
    454
    Why do you ask the user to go to Login page if the registration is successful??? The user should be logged in automatically after her/his successful registration. If it is failed, the user should be redirected to the registration page again and the system should tell her/him what the field is wrong.

  10. #10
    Join Date
    Oct 2004
    Posts
    26
    Quote Originally Posted by gyuan
    Why do you ask the user to go to Login page if the registration is successful??? The user should be logged in automatically after her/his successful registration. If it is failed, the user should be redirected to the registration page again and the system should tell her/him what the field is wrong.
    May be you misunderstood what I meant. In my application, user will be directed to the log in page if the registration is successful. Else, he/she will be going back to the registration form with error message dispalyed. But... I am using the POSt method. The only flaw is although the error message is displayed, all fields are reset and user needs to refill the whole form again.

  11. #11
    Join Date
    Dec 2003
    Posts
    454
    I don't think that I misunderstood what you were talking about. There are two things.

    1) If the user registration is successful, he should not need to go to the Login page. Instead, his login sessions should be created.

    2) If it is failed, the error message will be displayed. Below the error message, you can add an "GO BACK" button. So all data will be kept when the user clicks the button

  12. #12
    Join Date
    Oct 2004
    Posts
    26
    Quote Originally Posted by gyuan
    I don't think that I misunderstood what you were talking about. There are two things.

    1) If the user registration is successful, he should not need to go to the Login page. Instead, his login sessions should be created.

    2) If it is failed, the error message will be displayed. Below the error message, you can add an "GO BACK" button. So all data will be kept when the user clicks the button
    Well, I think I am not really advance in ASP, so I do it in the way that I can understand. So, it may sound ridiculous to you that I am doing my ASP page this way. May be you can give me an advice on how to create the session? =)
    Last edited by Dniz; 01-18-05 at 21:57.

  13. #13
    Join Date
    Dec 2003
    Posts
    454
    You can create a script to log the user in. In the script, when the login is okay, you can create some session variables which are used to store the user's account information to be used in the pages, like username, email address and so on. Creating session is easy, you just assign the value to it, i.e., <% Session("username") = "username" %>.

    If you want to understand what I was talking about in the registration, you can go to http://careers.construction.com/regi...r.asp?Seeker=1 and try to register on the site.

Posting Permissions

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