Session String value confuses Response.Redirect

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Overview:
I redirect a user to a page to register, then redirect back to orginating
page. The registration page is a two part form. On the second post I send the
user back to the page they came from.

On Page Load I assign a Form value called ReturnURL to a Session value
called the same thing. A sample value of ReturnURL would be:
("/whitePapers/paper.aspx?PID=5655")

The code is:
Session("ReturnURL") = Request("ReturnURL")

The user fills in data and submits the form. If the user passes validation
they fill out another form. If the user passes validation they are redirected
back to the orginal page. Here is the code:

Dim sessionReturnURL As String = CType(Session("ReturnURL"), String)
Response.Redirect(sessionReturnURL, True)

But instead redirecting back to the correct page, the Redirect command
appends the sessionReturnURL value under the current directory:
http://www.testdomain.com/userReg//whitePapers/paper.aspx?PID=5655

Instead it should be:
http://www.testdomain.com/whitePapers/paper.aspx?PID=5655

If I hardcode the value, such as:
Response.Redirect("/whitePapers/paper.aspx?PID=5655", True)

It works fine, it redirects the user to:
http://www.testdomain.com/whitePapers/paper.aspx?PID=5655

Any thoughts?
 
Back
Top