减少 ASP.NET 菜单控件大小(无需第 3 方库)
我有一个相当简单的 ASP.NET 2.0 菜单控件,使用站点地图文件和安全修饰。 菜单选项只有 21 个,但菜单结果 HTML 却高达 14k。 该网站托管在我们公司的内部网上,必须以有限的带宽向全世界的人们提供服务,因此我想缩小菜单的大小。
做这个的最好方式是什么? 有人有好的参考吗? 我有以下限制:
- 解决方案不得引用任何第三部分 DLL 文件(获得批准将是一场噩梦)
- 必须与 IE 6 一起使用
CSS 和 JavaScript 都可以,只要它们与 IE 6 一起工作即可。
I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and security trimmings. There are only 21 menu options, but the results HTML of the menu is a whopping 14k. The site is hosted on our company's intranet and must be serverd to people worldwide on limited bandwidth, so I'd like to reduce the size of the menus.
What is the best way to do this? Does anybody have a good reference? I have the following constraints:
- The solution must not reference any 3rd part DLL files (getting approval would be a nightmare)
- Has to work with IE 6
CSS and JavaScript are fine, as long as they work with IE 6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看一眼:
http://www.asp.net/CSSAdapters/Menu.aspx
默认菜单控件渲染了太多 HTML。
Take a look at:
http://www.asp.net/CSSAdapters/Menu.aspx
The default Menu control is rendering far too much HTML.
您可以看看我的 ASP.NET 菜单优化帖子< /a>. 我所做的是将每个页面中呈现的菜单的公共部分提取到一个外部文件中,该文件仅在用户浏览器中加载和缓存一次。 这样,在某些情况下页面会缩小 60-70%。
You might have a look at my ASP.NET menu optimization post. What I do is extracting the common part of the menu rendered in every page to an external file that is loaded and cached only once at the user browser. This way the pages are 60-70% smaller in some cases.