在Web表单应用程序中单独运行的MVC应用程序的一部分 [英] Running a part of MVC application separately under webforms application

查看:175
本文介绍了在Web表单应用程序中单独运行的MVC应用程序的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有不同的模块工作MVC3应用。我想利用这些模块中的一个作为IIS下一个单独的应用程序,这个独立的应用程序将是下一个已经运行的WebForms应用程序。

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?

我已经尝试动态注册根据URL路由选择的号码。我认为这会工作,但按计算器的题目(http://stackoverflow.com/questions/2518057/request-is-not-available-in-this-context),我不会允许访问请求对象在Global.asax登记的路线。

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.

提前感谢!

推荐答案

其实我能够实现我想要的东西通过更改主控制器。但它是纯粹是因为我的要求是不是太复杂。在MVC应用程序,我想运行的部分是一种独立的,不受其他模块的任何干扰。但我想的办法应该在解决问题的工作。

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();
    }

这篇关于在Web表单应用程序中单独运行的MVC应用程序的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆