关于使用 Web Forms 或 MVC 的 Web 应用程序架构的建议
我想了解以下构建 Web 应用程序的方法的一些意见。
用户将导航到登录页面。登录后,用户将被发送到我所说的主页。这个想法是让主页在页面顶部包含一些常见的材料以及菜单。占据页面大部分的菜单下面是一个 IFrame。每个菜单项在选择时都会将适当的页面加载到 IFrame 中。这是要点。用户可以使用各种菜单选项在应用程序中导航,并执行这些选择允许的任何操作,同时主页面在整个会话期间保持加载状态,即直到用户注销或关闭浏览器。这种方法不遵循似乎更常见的范例,即当用户浏览网站时,浏览器完全用其他网页替换网页。在整个会话期间,没有页面保持加载状态。在整个会话期间保持主页加载是一个好主意吗?
如果没有,主要的担忧是什么?另外,您是否可以找到对不同方法的任何引用来完成相同的类似应用程序的行为?
如果可以,使用 MCV 相对于 Web 表单来获得此行为是否有任何优势?
I would like some opinions on the following approach to architecting a web application.
A user will navigate to a login page. After logging in, the user will be sent to what I will call a primary page. The idea is to have the primary page contain some common material at the top of the page along with a menu. Below the menu taking up the majority of the page is an IFrame. Each of the menu items, when selected, would load the appropriate page into the IFrame. Here is the main point. The user can navigate through the application using the various menu selections and carry out whatever those selections allow while the primary page remains loaded during the entire session, that is, until the user logs out or closes the browser. This approach does not follow what appears to be the more common paradigm where the browser completely replaces web pages with other web pages as the user navigates through the site. No page stays loaded during the entire session. Is leaving the primary page loaded during the entire session a good idea?
If not, what are the main concerns? Also, can you site any references to a different approach to accomplish the same application-like behavior?
If okay, is there any advantage to using MCV over Web Forms to obtain this behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Iframe 很糟糕。他们一直都是坏人,而且永远都是坏人。有一个肮脏的黑客。
不要使用 iframe。
SPA
如果您有充分的理由不使用实际页面和重定向,您可以尝试那些似乎很流行的单页面应用程序之一。
不过我要提醒你的是,如果你依赖 javascript,你基本上就无法进行 SEO。
渐进式增强
作为旁白,请阅读渐进式增强。你应该这样做。
部分视图
如果您喜欢网站的大部分内容是静态的,那么您始终可以通过 ajax 加载部分视图并将其呈现在客户端上。
当然,因为您正在进行渐进式增强,所以您也会进行整页重定向和加载。客户端上的部分视图渲染只是附加功能。
.NET
至于使用 C# 框架,我个人推荐 Nancy。
如果你想使用 ASP(天知道为什么)我想你可以使用 ASP.NET MVC,当然它远非最佳,但至少它不是 ASP.NET Webforms
Iframes are bad. They always have been bad, they always will be. There a dirty hack.
Don't use iframes.
SPA
If you have a good reason not to use actual pages and redirects you can try one of those single page applications that seem to be popular.
I will however remind you that if you rely javascript you basically can't do SEO.
Progressive enhancement
As an aside read up on Progressive Enhancement. You should be doing that.
Partial views
If you like having a large portion of your website static then you can always load partial views over ajax and render them on the client.
Of course because your doing progressive enhancement your doing full page redirects and loads aswell. The partial view rendering on the client is just bells and whistles.
.NET
As for using C# frameworks I would personally recommend Nancy.
If you want to use ASP (god knows why) I guess you can use ASP.NET MVC, sure it's far from optimum but at least it's not ASP.NET webforms
我不认为这是绝对的邪恶,但您的解决方案实际上并没有遵循 HTML 网站的“正常”行为,并且浏览可能不太直观。
网络的常见解决方案是使用布局,或两种 -步骤视图模式(参见 http://framework.zend.com/manual/en/zend.layout.introduction.html)
我不太了解 Webforms,但 MVC 被称为标准事实上,对于大多数 Web 应用程序和框架来说都是如此。这很好,因为它强制执行角色和组织的划分。
I don't think it's the absolute evil, but your solution does not actually follow the "normal" behaviour of an HTML site, and browsing may be less intuitive.
The common solution for web is to use a layout, or two-step view pattern (see http://framework.zend.com/manual/en/zend.layout.introduction.html)
I don't know well webforms, but MVC is known as the standard de facto for most web applications and frameworks. It's nice because of the splitting of the roles and the organization it enforces.