减少ASP.NET菜单控件大小(没有第三方库)

时间:2021-01-07 04:51:12

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.

我有一个相当简单的ASP.NET 2.0菜单控件使用站点地图文件和安全修整。只有21个菜单选项,但菜单的结果HTML高达14k。该网站托管在我们公司的内部网上,必须以有限的带宽服务于全球的人们,所以我想减小菜单的大小。

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)
  • 解决方案不得引用任何第三方DLL文件(获得批准将是一场噩梦)

  • Has to work with IE 6
  • 必须使用IE 6

CSS and JavaScript are fine, as long as they work with IE 6.

CSS和JavaScript都很好,只要它们与IE 6一起使用即可。

2 个解决方案

#1


2  

Take a look at: http://www.asp.net/CSSAdapters/Menu.aspx

请查看:http://www.asp.net/CSSAdapters/Menu.aspx

The default Menu control is rendering far too much HTML.

默认的Menu控件渲染过多的HTML。

#2


1  

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.

您可以查看我的ASP.NET菜单优化帖子。我所做的是将每个页面中呈现的菜单的公共部分提取到在用户浏览器上仅加载和缓存一次的外部文件。这种方式在某些情况下页面小60-70%。

#1


2  

Take a look at: http://www.asp.net/CSSAdapters/Menu.aspx

请查看:http://www.asp.net/CSSAdapters/Menu.aspx

The default Menu control is rendering far too much HTML.

默认的Menu控件渲染过多的HTML。

#2


1  

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.

您可以查看我的ASP.NET菜单优化帖子。我所做的是将每个页面中呈现的菜单的公共部分提取到在用户浏览器上仅加载和缓存一次的外部文件。这种方式在某些情况下页面小60-70%。