Biscuit. Random ways. How to Rewrite URLs

We have a significant collection of applications (> 50) that work under the same domain, but with different virtual directories. Pretty standard stuff. We store cookies using paths to separate cookies from the application. Paths are set for the application path.

This seems to work fine as long as the cover art of the url matches the outline of the application. If it is different, the browser cannot retrieve the collection of cookies.

Is there any easy way (ISAPI? Global ASAX?) To rewrite all URLs so that they match the application path? Ideally, this is something that can be configured at the application level.

Currently stuck on IIS6.

thanks

+3
source share
2 answers

Wondering if this is a possible (even good) solution:

At Global.asax:

void Application_BeginRequest(object sender, EventArgs e)
{
    string url = HttpContext.Current.Request.Url.PathAndQuery;
    string application = HttpContext.Current.Request.ApplicationPath;

    if (!url.StartsWith(application))
    {
        HttpContext.Current.Response.Redirect(application + url.Substring(application.Length));
    }
}
+2
source

Use relative URLs in conjunction with a BASE tag ?

0
source

Source: https://habr.com/ru/post/1712497/


All Articles