Incorrect redirect due to corrupt session variable. I think!!

Results 1 to 2 of 2

Thread: Incorrect redirect due to corrupt session variable. I think!!

  1. #1
    Jenny Guest

    Default Incorrect redirect due to corrupt session variable. I think!!

    The following is an example of an asp page that is used to save of the page calling it then include an asp that will do some authentication and then redirect back to this page after it has dropped a cookie onto the users system. This works 99.9% of the time. But sometime after replacing the asp with a newer version and not rebooting the webserver the redirect will not work because an ",%20" or ", " has been inserted into the url path. Since this is stored in a session variable I am assuming that some how it is getting corrupted. Has anyone ever had this happen to them? Is there a know bug that I don&#039t know about? Or am I doing something wrong?<BR><BR>&#060;%@ Language=VBScript &#037;&#062;<BR>&#060;%<BR>Response.Buffer=TRUE<BR >Response.Expires=0<BR>&#037;&#062;<BR>&#060;%&#03 9********************************************<BR> &#039 Example.asp<BR> &#039********************************************< BR>&#037;&#062;<BR><BR>&#060;%<BR>Function SetSession()<BR> If Request.QueryString("returnURL") &#060;> "" Then<BR> Session.Contents("ReturnURL") = Request.QueryString("returnURL")<BR> If Request.ServerVariables("QUERY_STRING") &#060;> "" Then<BR> Session.Contents("ReturnQueryString") = "?" & Request.ServerVariables("QUERY_STRING")<BR> Else<BR> Session.Contents("ReturnQueryString") = ""<BR> End If<BR> End If<BR>End Function<BR><BR>Function HaveCookie()<BR> Dim strUserPageSelection<BR> strUserPageSelection = Session.Contents("ReturnURL") & Session.Contents("ReturnQueryString")<BR> response.clear<BR> response.redirect strUserPageSelection<BR> response.end<BR>End Function<BR><BR>SetSession()<BR>If Request.Cookies("Example") &#060;> "" Then<BR> HaveCookie()<BR>End if<BR>&#037;&#062;<BR>&#060;!-- #INCLUDE VIRTUAL="/Something/Authenticate.asp" --><BR><BR>

  2. #2
    Chris Willey Guest

    Default RE: Incorrect redirect due to corrupt session variable. I think!!

    I don&#039t buy the corruption theory. I&#039m not sure entirely what&#039s happening, but you might try using the Server.URLEncode statement to format your session variable before redirecting. Example:<BR><BR>qString = Server.URLEncode(Request.QueryString("returnURL") &_ "?" & Request.ServerVariables("QUERY_STRING"))<BR>respon se.redirect qString<BR><BR>You probably don&#039t need session variables if all you&#039re doing is redirecting...but then again maybe you do. Up to you.<BR><BR>Hope this helps.

Posting Permissions

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