Using Response.Redirect() to a relative path.
- by Bryan
I'm working with ASP.net. My website is hosted within a subfolder test under the IIS root directory. So the url of default.aspx is http://localhost/test/Default.aspx. From default.aspx, I want to use Reponse.Redirect() with a relative path to redirect to another url within the same web site, http://localhost/test/whatever.
I tried
Response.Redirect("/hello");
and
Response.Redirect("~/hello");
Both of them redirect to http://localhost/whatever. Note that the Redirect method use http://localhost instead of http://localhost/test/ as the base url.
Any ideas?
Thanks.