我正在为我的讨论寻求一些帮助。 我们正在讨论定制问题的两种解决方案。 一种使用(嵌套)母版页。 每个自定义页面一个母版页。 另外,所有页面都有一个标准母版页。 第二个使用标准页面,该页面会重定向到自定义页面(如果存在)。
我的问题是,哪个更可取? 每次必须加载 2 个母版页,或者只需要加载 1 个母版页,有时会重定向(Response.Redirect 或 Server.Transfer)到自定义页面。
我真的找不到任何有关母版页性能的信息。 我应该将它们视为另一个(有些倒置的)用户控件还是应该轻轻地使用它们?
编辑:
您可以假设使用 Response.Redirect 进行传输。
您可以假设重定向发生在生命周期的 PreInit 阶段。
I'm looking for some help on my discussion. We're discussing two solutions to a customization problem. One uses (nested) master-pages. One master page per customized page. Plus there is a standard master page for all pages. The second uses a standard page, which redirects to the custom page if it exists.
My question is, which is more desirable? Having to Load 2 master pages every time OR only having to load 1 master page and sometimes redirecting (Response.Redirect or Server.Transfer) to the customized page.
I can't really find any information on master page performance. Should I just think of them as another (somewhat inverted) user-control or should they be used lightly?
Edit:
You can assume Response.Redirect for the transfer.
You can assume the Redirect occurs in the PreInit stage of the lifecycle.
发布评论
评论(2)
母版页在某种意义上是倒置的用户控件(它们“包围”内容,而不是推入页面的用户控件内容)。 没有一条经验法则表明可以轻松使用母版页 - 母版页的性能成本与其导致被推入 HTTP 数据流的代码量(HTML 和其他代码)成正比。
为了我的钱,我会选择最易读和最可维护的代码。
Master pages are in a sense inverted user controls (they "surround" content as opposed to user control content that is pushed into the page). There isn't a rule of thumb that says use master pages lightly--a master page's performance cost is directly proportionate to how much code (HTML and otherwise) it causes to be pushed into the HTTP data stream.
For my money, I'd land on the side what makes for the most readable and maintainable code.
所以,无论如何,它都是一个 Web 表单应用程序,对吗? 您是否考虑过模型视图控制器的观点?
关于 nasted MasterPages,我在客户端 CRM 应用程序上做到了这一点,我可以向您保证,您不会遇到任何加载问题,除非有关互联网和服务器速度的常见问题,为此,如果您认为这是完成任务的最佳方式或者有目标,就去努力吧。
每个母版页都会触发它们的事件,通常我们会想到哦,2 个母版页加上一个内容或多个内容页可能会成为加载时间的问题,但这需要几毫秒的时间来执行所有这些操作,所以......要安全。
你唯一需要注意的是,不要迷恋你能找到的所有 javascript 插件,选择一个好的库并只使用它,JQuery(现在版本 1.3.0 将是最好的选择)。
至少这是我的意见:)
so, it's a webform application no matter what, right? Did you ponder Model View Controller perspective?
Regarding the nasted MasterPages, I did that on a client CRM application and I can assure you, you do not fell any problems loading unless the usual ones about the internet and server speed, for that, and if you think it's the best way to accomplish or objectives, go for it.
Each Master Page will fire their events and normally we think about ohh well, 2 master pages plus a content or several content pages could be a problem pointing the loading time, but this takes miliseconds performing all this, so... be safe.
the only thing that you need to take care is, don't fell up with all the javascript addons that you can find, choose a nice library and use only that, JQuery (now on version 1.3.0 would be the best choice).
at least that is my opinion :)