1

I have a working MVC3 application with different modules. I want to use one of those modules as a separate application under IIS, this separate application will be under an already running WebForms application.

e.g.

My MVC application is running at http://mymvcappdomain.com/

There is a feature under this called "MyFeature" which runs at http://mymvcappdomain.com/MyFeature

I want another site (WebForms application) http://mywebformssitedomain/ to display exactly as http://mymvcappdomain.com/MyFeature when I browse to http://mywebformssitedomain/MyFeature

Is it possible? If so, how?

What I have already tried is dynamically registering selected number of routes based on the URL. I thought it'd work but as per the stackoverflow topic (http://stackoverflow.com/questions/2518057/request-is-not-available-in-this-context), I am not allowed to access the request object in the global.asax for registering routes.

Many thanks in advance!

4

1 回答 1

0

Actually I was able to achieve what I wanted by changing the home controller. But it was purely because my requirements were not too complicated. The part of the MVC app I wanted to run was kind of standalone without any interference from other modules. But I guess the approach should work in resolving the issue.

public ActionResult Index()
    {
        if (URL is different to your normal MVC App URL)
        {
            return RedirectToRoute("YourCustomRouteForModule");
        }
        return View();
    }
于 2012-06-12T02:15:43.950 回答