tags:

views:

21

answers:

1

I maintain a web application that is painful to upgrade. It's not painful because the code is bad, but because there are a lot of devices connected to this application via the web and getting them to update their clients is a lot like moving concrete.

So I had an idea that I could simply present a different version of the application to different customers. The session stores the client information. So what I'd ultimately like to do is peak at that session and then use that to present the "correct" version of my app to them.

Physically the apps are stored in a manner like such:

C:\Program Files\Company\Program\Version\Web\WebApp

So you can see that I could have multiple versions installed at once. Basically if customer A goes to the site they get presented with C:\Program Files\Company\Program\1.0.0.0\Web\WebApp\foo.aspx And if customer B visits the site, they get to see C:\Program Files\Company\Program\2.0.0.0\Web\WebApp\foo.aspx.

I initially thought of using the IIS rewrite module, but I really don't want to redirect them. I want this to be seamless. Any ideas on how this can be implemented?

update:

After further research, I thought it would be clever to use the Global.asax.cs to accomplish my goal. So in the Application_BeginRequest event handler, I wrote the following:

        string url = Request.Url.ToString();

        if (url.Contains("MyTest"))
        {
            Context.RewritePath("/art/test.html");
        }

By the way, /art/ is a virtual directory that I grafted into this directory via IIS. This would be similar to how I would set it up in production. Anyway, I get the following error when I try this.

The virtual path '/art/test.html' maps to another application, which is not allowed.

So how do I do this then? Is there an "allowed" strategy for accomplishing this? Doing it through the Global.asax.cs would be ideal since I could use the HTTP Context to "know" which customer is connecting to the app.

A: 

Okay, I have it mostly figured out. Here's how I did it. I basically created a parent app that would route to the various versions. In that app, I use the Context.RewritePath as I did above except I added a ~ in front of the url. Now I'm having issues with the viewstate, but I think I can get it figured out from here. (I hope). I'll update this answer later when I ultimately get a perfectly working solution.

Jason Thompson
Okay. This doesn't work. The base app will not be able to find the binaries for the child app.
Jason Thompson