Help with redirection

Results 1 to 3 of 3

Thread: Help with redirection

  1. #1
    Join Date
    Dec 1969

    Default Help with redirection

    A lot of site such as has email newsletter with bunch of links in them. If you click on the link you will be taken to a particular page (story, info, etc). However, if you have not log in yet you will first be taken to a login page, after succesfuly log in you will then be taken to the intended page (the one that appear on the email).<BR><BR>Can anyone help me as how to do this?

  2. #2
    Join Date
    Dec 1969

    Default RE: Help with redirection

    It&#039;s fairly easy, actually.<BR><BR>To check that the user is logged in, you have code something like:<BR>If Session("isLoggedIn") &#060;&#062; "yes" Then<BR> Response.Redirect "/login/login.asp"<BR>End If<BR><BR>All you need to do is pass, as a querystring parameter, the page that the user is currently on, to the login page. The login page stores that as a hidden field. When the user has successfully logged on, the page checks to see if there is a value in this hidden field. If so, it redirects to that. If not, it redirects to the standard page that logged in users go to.

  3. #3
    Join Date
    Dec 1969

    Default Not too hard...

    *** storyPage.asp ***<BR><BR>&#060;%<BR>If session("userName") = "" Then<BR> Session("backto") = "storyPage.asp"<BR> Response.Redirect "login.html"<BR>End If<BR>%&#062;<BR><BR>****** Login.html ******<BR>&#060;FORM Action="login.asp"&#062;<BR>&#060;INPUT Name="UserName"&#062;<BR>&#060;INPUT Name="Password"&#062;<BR>...<BR>&#060;/FORM&#062;<BR><BR>***** Login.asp *****<BR><BR>&#060;%<BR>SQL = "SELECT * FROM usertable WHERE [user]=&#039;" & Request("username") & "&#039;" _<BR> & " AND [pw]=&#039;" & Request("password") & "&#039;"<BR>Set RS = yourconnection.Execute( SQL )<BR>If RS.EOF Then<BR> RS.Close<BR> Response.Redirect "login.html" &#039; make them try again<BR>End If<BR>Session("userName") = RS("user")<BR>RS.Close<BR>Response.Redirect Session("backto")<BR>%&#062;<BR>****************** ***********<BR><BR>Make sense?<BR><BR><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