在混合的ASP.NET Web页/ MVC网站困难 [英] Difficulties on hybrid ASP.NET Web Page/MVC website

查看:238
本文介绍了在混合的ASP.NET Web页/ MVC网站困难的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始到现有的ASP.NET Web窗体的网站转换为ASP.NET MVC。然而,MVC似乎过高了一些网页。 ASP.NET网页似乎是一个更适合简单的网页,MVC的好处还不清楚。

I'm just starting to convert an existing ASP.NET Web Forms website to ASP.NET MVC. However, MVC seems excessive for some pages. ASP.NET Web Pages seems like a better fit for simple pages where the benefit of MVC is unclear.

如果我使用ASP.NET网页的一些页面和MVC的休息,我会用什么样的困难,不会如MVC发生可能遇到的每一页?

If I use ASP.NET Web Pages for some pages and MVC for the rest, what difficulties will I likely encounter that would not occur if MVC was used for every page?

这里有一个困难,我已经意识到:<一href=\"http://forums.asp.net/p/1954413/5573592.aspx?Sharing+_layout+cshtml+between+MVC+and+Web+Pages+\"相对=nofollow>网页和MVC不能共享_Layout.cshtml 。

Here is one difficulty I am already aware of: Web Pages and MVC cannot share _Layout.cshtml.

修改

内容上面大量编辑,以澄清问题的意图。

The content above was heavily edited to clarify the intent of the question.

推荐答案

我做了一些研究,这和现在完全明白你的问题的范围。对不起,这是我想对你说Web Forms和错误不是相对较新的网页的。

I did a little research into this and now fully understand the scope of your question. Sorry, it was my mistake for thinking you mean Web Forms and not the relatively new Web Pages.

任何答案的人给这里将是pretty主观的,但我拿到这个是继续前进,坚持了MVC方法,而不是混合模式。看来的网页的是没有与它相关的控制器/动作基于剃刀HTML文件。如果这是真正的唯一的主要区别/原因你的问题的话,好像额外的三行$ C $的c将其将采取使其MVC ...

Any answer anyone gives here will be pretty subjective, but my take on this is to go ahead and stick to the MVC method instead of mixed modes. It appears that Web Pages is a razor based HTML file without a controller/action associated with it. If that is truly the only major difference / reason for your question, then it seems the extra three lines of code it would take to make it MVC...

public ActionResult StaticFile(){
     return View();
}

实际上将使A)更容易在未来的动态数据添加到,B)更是直接关系到路由(静态如无特殊线路)和c)更容易,如果你必须与服务器端进行交互做任何形式的认证,会话跟踪,等等,等等不管怎么说,我的2美分。走那的工作方式,但要记住日后修改的麻烦/挫折,你与你的网站出来的。我发表这个意见与从未录取有使用的网页的,短短几个小时的阅读它们。

actually will make it a) easier to add dynamic data to in the future, b) more directly ties into routing (no special routes for static for example) and c) easier to interact with the server-side if you have to do any kind of authentication, session tracking, etc, etc. Anyways, my 2 cents. Go the way that works, but keep in mind the trouble/frustration of future modifications as you go forth with your site. I post this opinion with the admission of never having used Web Pages, just a few hours of reading about them.

这篇关于在混合的ASP.NET Web页/ MVC网站困难的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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