Redirecting in a usercontrol

E

Eirik Eldorsen

If I try to redirect in usercontrol using only a relative url like
Response.Redirect("somepage.aspx") it will fail several places since it
tries to find the page in the folder whcih the user control is used in. One
solution is to use an url like
Response.Redirect("/somefolder/somepage.aspx"). My problem with this
solution is that it dosen't work when running on localhost. Are there any
other solutions?

Eirik Eldorsen
 
K

Karl Seguin

You can use ~ to specify the application's root:

Response.Redirect("~/somepage.aspx", true);

Karl
 
E

Eirik Eldorsen

Wow! Thanks! I did'nt think there were any other solutions. Testing on
localhost will be so much easier now :-D
 

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