tags:

views:

97

answers:

2

We have a sizable collection of applications (>50) all running under a single domain but with different virtual directories. Pretty standard stuff. We store cookies using paths to segregate cookies by application. Paths are set the the Application Path.

This seems to work fine as long as the casing of the URL is the same as the application path. If it is different, the browser fails to retrieve the collection of cookies.

Is there any very basic 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

A: 

Use relative URLs in conjunction with a BASE tag might work?

Spencer Ruport
A: 

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

In 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));
    }
}
Andrew Robinson
Definately the solution to our issue.
Andrew Robinson