HTTP_REFERER used with Response.redirect

Results 1 to 2 of 2

Thread: HTTP_REFERER used with Response.redirect

  1. #1
    Terence Guest

    Default HTTP_REFERER used with Response.redirect

    Is it possible to use Request.ServerVariables("HTTP_REFERER") with Response.Redirect? I&#039m trying to send a user who has just logged in to my site back to the page which refered them.. but Response.Redirect will only accept a "URL" (unless I&#039m doing it wrong....) Any ideas welcome!!<BR><BR>Thanks for any help<BR><BR>Terence

  2. #2
    Paully Guest

    Default RE: HTTP_REFERER used with Response.redirect

    Sure it&#039ll work but you need to know some stuff first.<BR><BR>Let&#039s say you are protecting a directory by using an include file on each page to check for a cookie or session variable. If the user doesn&#039t have the cookie or session var. it redirects them to the login page, but because the way that redirect works there will be no HTTP_REFERER info. <BR><BR>What I would do is, in the inital redirect carry the referring page as a variable in the querystring.<BR><BR>Something like<BR><BR>&#060;% Response.Buffer = True<BR><BR>%&#062;<BR>Write something here to get the http headers to post to the browser.<BR>&#060;% If Not Request.Cookies("Yourcookie") &#060;&#062; "" then<BR><BR>Response.Redirect "" <BR>& Server.URLEncode(Request.servervariables("URL")<BR ><BR>%&#062; <BR><BR>Now I know that&#039s not an entirely accurate representation of exactly how to do it, but it&#039s a start for you to build upon.

Posting Permissions

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