I am using the IIS Url Rewrite module to rewrite URLs for my ASP.Net web application. Primary strings are overwritten from:
http://domain/version/page.aspx
to
http://domain/company/page.aspx
And it works great when browsing directly using absolute paths. The problem occurs when navigating in an application using relative paths. any relative way.
All relative paths are redirected to the corresponding one http://domain/version/page.aspx, and not to the http://domain/company/page.aspxone to which it should go.
I solved a lot of problems by adding this line to the BeginRequest event in Global.asax:
Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
HttpContext.Current.RewritePath(HttpContext.Current.Request.Url.AbsolutePath, True)
End Sub
Essentially, this is simply restoring the virtual path to the requested URL.
Response.Redirect STILL , .
, : Response.Redirect("~/test.aspx") domain/Version/test.aspx domain/Company/test.aspx
Response.Redirect (domain/Company/test.aspx) (domain/Version/test.aspx)
.