Session String value confuses Response.Redirect

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top