We have a long-standing ASP.NET web form application that was born in .NET 1.1 / IIS6. Now we are working on .NET4.5 / IIS7, but we have not done anything with MVC.
We provide a catalog to customers and provide them with a URL that they can use:
www.ourhost.com/customername
Using the custom IHttpModule that we developed, we pull the "username" from the URL to find the client in the database. This client identifier is then stored in the context of the page * and is used by almost all pages of the site to configure content for this client. After this process, the above URL will be rewritten and processed as
www.ourhost.com/index.aspx
with the index index.aspx accessing the client identifier through its context, and he can do his job.
This works great and we support several thousand customers. the rewrite logic is rather complicated because it checks the customer accounts, redirects to the "uh oh" page if the client is invalid, and to the other "find seller" page if the client has not paid, etc. etc.
Now I would like to create some Web API controllers and MVC-style rewriting bothers me. I see many examples when rewriting happens so that the URL is similar to this job:
www.ourhost.com/api/{controller}
but I still need these web avi calls to be made in the context of the client. Our pages are becoming more complex with asynchronous JSON / AJAX calls, but to respond to these calls, I still need the client context. I would like the url to be
www.ourhost.com/customername/api/{controller}
, , , IHttpModule.
?
* UPDATE: " ", HttpContext, -, , , /.