简体   繁体   English

是否将ASP.NET Razor网站(例如MiniBlog)集成为ASP.NET MVC Web应用程序的模块?

[英]Integrate an ASP.NET Razor Web Site (e.g. MiniBlog) as a module of an ASP.NET MVC Web Application?

MiniBlog is awesome. MiniBlog很棒。 I want to incorporate it into my existing Web Application. 我想将其合并到我现有的Web应用程序中。

The existing ASP.NET MVC Web Application 现有的ASP.NET MVC Web应用程序

My fork of MiniBlog is an ASP.NET Razor Web Site and 我的MiniBlog分支ASP.NET Razor网站

I would like to integrate the Web Site into the Web Application so that: 我想将网站集成到Web应用程序中,以便:

  1. the url for the blog is bigfont.ca/blog, 博客的网址是bigfont.ca/blog,
  2. blog content sits in the existing web app content area (see image below), 博客内容位于现有的Web应用程序内容区域(请参见下图),
  3. the web application and MiniBlog web site have clear separation, Web应用程序和MiniBlog网站之间有明显的区别,
  4. it basically looks like this: 它基本上看起来像这样:

博客集成到Web应用程序中

My implementation ideas include: 我的实现思路包括:

  1. use an iFrame to include the MiniBlog in the existing web app 使用iFrame在现有的Web应用程序中包含MiniBlog
  2. create an MVC.NET view that represents the blog 创建一个表示博客的MVC.NET视图
  3. put the MiniBlog into its own MVC Area 将MiniBlog放入自己的MVC区域

Basically, I would like to keep the MiniBlog as an independent and interchangeable component of the Web Application. 基本上,我希望将MiniBlog保留为Web应用程序的独立且可互换的组件。

For instance, the Orchard CMS does this by making ASP.NET Projects into separate modules. 例如, Orchard CMS通过将ASP.NET项目制作为单独的模块来实现此目的。

What strategy, if any, exists for making an ASP.NET Web Site a module within an ASP.NET Web Application? 有什么策略可以使ASP.NET网站成为ASP.NET Web应用程序中的模块?

I ended up using an ASP.NET MVC Area. 我最终使用了ASP.NET MVC区域。 I used this general approach. 我使用了这种通用方法。

  1. Create a new MVC.NET area called MiniBlog. 创建一个新的MVC.NET区域,称为MiniBlog。
  2. Copy-and-paste the necessary MiniBlog components one at a time into the new Area. 一次将一个必需的MiniBlog组件复制并粘贴到新区域中。
  3. Edit the Web.config as necessary. 根据需要编辑Web.config。
  4. Repeat step 2 and 3 until complete. 重复步骤2和3,直到完成。

It was quite tricky. 这很棘手。 The final solution lacked a clear separation between MiniBlog and the rest of the MVC.NET website. 最终的解决方案在MiniBlog和MVC.NET网站的其余部分之间缺乏清晰的区分。 I wasn't satisfied with the solution. 我对解决方案不满意。 It might be that ASP.NET Web Pages and ASP.NET MVC aren't meant to work together in this way. 可能不是ASP.NET网页和ASP.NET MVC以此方式协同工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM