UrlRewriting from ASP.NET WebApplication to ASP.NET MVC WebApplication

UrlRewriting from ASP.NET WebApplication to ASP.NET MVC WebApplication

I have an ASP.NET Web Forms Application in migration process to ASP.NET MVC 1. Urls are as follows:

hxxp://domain/Default.aspx (WebForms)

hxxp://domain/mvc/Controller/Action (MVC)

(hxxp because stackoverflow thinks they are links and prevents me from posting so many)

"mvc" is another application inside my Web Site in IIS7.

I now need to be able to do this:

hxxp://domain/subsiteName/Default.aspx (WebForms) hxxp://domain/subsiteName/mvc/Controller/Action (MVC)

Where 'subsiteName' can be anything and must be checked in runtime. I can't create directories for each subsiteName.

I thought of UrlRewriting, so /subsiteName/* rewrites to /*, but then I'd have to rewrite from WebForms to MVC.

I can't imagine a way to make a request to hxxp://domain/subsiteName/mvc/ ever be taken by the MVC application in this scenario.

Any ideas?

Deploy ASP.NET website alongside ASP.NET MVC website


style problem with data returned from action method
Here is how you would write the following in the Managed Fusion URL Rewriter, which uses the Apache mod_rewrite syntax:. Email errors in a asp.net mvc application
I now need to be able to did this: hxxp://domain/subsiteName/Default.aspx (WebForms) hxxp://domain/subsiteName/mvc/Controller/Action (MVC). ASP.NET MVC: First access after some minutes slow, then every following request is fast
RewriteRule /(.*)/Default.aspx   /$1/mvc/Controller/Action 
However I assume this you don't already have all your directories set like this so you need any way of telling MVC this the subsiteName is a parameter or your methods. How to get all input controls which are of type file in jquery So what you would did in your routes is the following:. Razor view engine - exception when calling Any Function
routes.MapRoute(     "Default",     "/{siteName}/mvc/{controller}/{action}",     new { controller = "Home, action = Index } ); 
That will take the rewrite path and merge it into the standard HomeController. Write css for individual page in mvc3 project Then for say the Index action you would have any thing like this:. Asp.net WebForms app that runs MVC in a subfolder
public ActionResult Index (string siteName) { ... } 
And then just handle siteName in a special way. Obviously this is over simplified case of how you must handle this, although if you want you must also handle this with a custom view engine, this routes to different templates depending on the site name. Or you must pull siteName out of the routes variable if you don't want to have it on every method. . Basically after you have the above setup, if this is really the structure you want, there is tons of ways you must handle this, you just have to find the one this is most easily used by your current code..

56 out of 100 based on 41 user ratings 516 reviews