Why do my ASP.NET pages render slowly when placed on the server?

前端 未结 7 437
忘了有多久
忘了有多久 2021-01-27 07:43

I have a simple aspx page with a GridView control. I\'m loading the GridView with search results after the click of a button. Everything works, but the HTML rendering on the bro

7条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-27 08:02

    Since the network is the bottleneck in this case, try to minify the resulting HTML. Apparently, the weight of each grid row is about 640 bytes on average (2500 records generate 1.6M payload). See if you can reduce it by removing unnecessary spaces and shortening any HTML elements IDs. Move styling, if any, from the grid to CSS, as was suggested before. If grid renders any URLs (e.g. “href” in anchors or “src” in images) try to shorten them. Also, if HTML rendered by GridView is not optimal see if you can render yourself. In order to estimate the anticipated page response time in production, factor-in your average user network speed (that may be different from the network speed of your machine).

    If none of the above produce satisfactory result you may check the solution that we have – ASP.NET accelerator called Web Stimulus. It partially executes ASP.NET page code on the client to render the HTML on the client computer. Typical traffic reduction is 10-20 times with minimal code change.

提交回复
热议问题