I am writing a shared library for use by all of my web projects. One of the features is constant call forwarding, as shown below:
public static void PermanentRedirect(string url, HttpResponse response, bool endResponse)
{
url =
response.Status = "301 Moved Permanently";
response.AddHeader("Location", url);
if (endResponse) response.End();
}
How can I resolve the URL without submitting the current page to access Page.ResolveUrl? Note that I can change the method signature, but I would prefer not, because I think this will overload the API.
I have a couple of overloads for this, so my desired use is:
WebUtility.PermanentRedirect("~/somewhere/somepage.aspx")
Jeff source
share