Redirect a user to homepage...

Results 1 to 3 of 3

Thread: Redirect a user to homepage...

  1. #1
    Join Date
    Dec 1969

    Default Redirect a user to homepage...

    Hi, I need to be able to redirect any user who manually keys in a valid url to my site, other than the homepage, back to my sites homepage. Any help/sample code would be appreciated...<BR><BR>Jim<BR>

  2. #2
    E. Davis Guest

    Default RE: Redirect a user to homepage...

    Hi. I have had some success using this snippet of code in a couple of my asp pages. I put this sub in an include file and then just call the sub at the top of a page I don&#039;t want a person to go directly to. <BR><BR>I used this somewhat to keep people from going directly to an asp page that queries a database based on items keyed into a form contained in a separate page. That way, the the page would not try to query a database with just empty strings.<BR><BR>"referring" here is a string with the full URL that the person should be coming from (in your case the home page). <BR>"referto" would be the page to which you want to take a person.<BR><BR>sub pagechk(referring,referto)<BR><BR> ref = referring<BR> refto = referto<BR><BR> if NOT (Request.ServerVariables( "HTTP_REFERER" )= ref) THEN<BR><BR> Response.Redirect(refto)<BR> end if<BR><BR> end sub

  3. #3
    Join Date
    Dec 1969

    Default RE: Thank you Mr. Davis!

    Thank you very much!

Posting Permissions

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