<p>I have an Ajax.Net enabled ASP.Net 2.0 web site. Hosting for both the site and the database are out of my control as is the database's schema. In testing on hardware I do control the site performs well however on the client's hardware, there are noticeable delays when reloading or changing pages. </p>

<p>What I would like to do is make my application as compact and speedy as possible when I deliver it. One idea is to set expiration dates for all of the site's static resources so they aren't recalled on page loads. By resources I mean images, linked style sheets and JavaScript source files. Is there an easy way to do this?</p>

<p>What other ways are there to optimize a .Net web site?</p>

<p>UPDATE: 
I've run YSlow on the site and the areas where I am getting hit the hardest are in the number of JavaScript and Style Sheets being loaded (23 JS files and 5 style sheets). All but one (the main style sheet) has been inserted by Ajax.net and Asp. Why so many? </p>

[{'answer_id': 11506, 'author': 'Campbell', 'author_id': 942, 'author_profile': 'https://Stackoverflow.com/users/942', 'pm_score': 0, 'selected': False, 'text': '<p>You could turn on compression based on your client supporting it. See this article: <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d52ff289-94d3-4085-bc4e-24eb4f312e0e.mspx?mfr=true" rel="nofollow noreferrer">link text</a></p>\n'}, {'answer_id': 11507, 'author': 'GateKiller', 'author_id': 383, 'author_profile': 'https://Stackoverflow.com/users/383', 'pm_score': 0, 'selected': False, 'text': "<p>Static resources shouldn't be resent unless changed. IIS will send a response code which tells the browser to use the cached version.</p>\n"}, {'answer_id': 11521, 'author': 'Darren Kopp', 'author_id': 77, 'author_profile': 'https://Stackoverflow.com/users/77', 'pm_score': 6, 'selected': True, 'text': '<ol>\n<li><a href="http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx" rel="noreferrer">Script Combining in .net 3.5 SP1</a></li>\n<li><a href="http://developer.yahoo.com/performance/rules.html" rel="noreferrer">Best Practices for fast websites</a></li>\n<li>HTTP Compression (gzip)</li>\n<li>Compress JS / CSS (different than http compression, minify javascript)\n\n<ol>\n<li><a href="http://developer.yahoo.com/yui/compressor/" rel="noreferrer">YUI Compressor</a></li>\n<li><a href="http://www.codeplex.com/YUICompressor" rel="noreferrer">.NET YUI Compressor</a></li>\n</ol></li>\n</ol>\n\n<p>My best advice is to check out the <a href="http://developer.yahoo.com/YUI" rel="noreferrer">YUI content</a>. They have some great articles that talk about things like <a href="http://www.alistapart.com/articles/sprites/" rel="noreferrer">CSS sprites</a> and have some <a href="http://developer.yahoo.com/yui/imageloader/" rel="noreferrer">nice javascript libraries to help reduce the number of requests</a> the browser is making.</p>\n'}, {'answer_id': 11528, 'author': 'DevelopingChris', 'author_id': 1220, 'author_profile': 'https://Stackoverflow.com/users/1220', 'pm_score': 2, 'selected': False, 'text': '<p>Turn viewstate off by default, it will be a night and day difference on even the most simple pages.</p>\n'}, {'answer_id': 11534, 'author': 'Kev', 'author_id': 419, 'author_profile': 'https://Stackoverflow.com/users/419', 'pm_score': 1, 'selected': False, 'text': '<p>I think you really need to be able to get some actual PerfMon data/telemetry from the app whilst running in production to be able to make an enlightened decision about what to optimise. </p>\n\n<p>As a throw away tip I\'d make sure your app is deployed as a <em>Release</em> build and set debug="false" in the \'<em>compilation</em>\' section of your web.config.</p>\n'}, {'answer_id': 11537, 'author': 'Pascal', 'author_id': 1311, 'author_profile': 'https://Stackoverflow.com/users/1311', 'pm_score': 2, 'selected': False, 'text': '<p>If you are using Firefox to test your website, you might want to try a nifty Firefox extension from Yahoo! called <a href="http://web.archive.org/web/20101208124338/https://addons.mozilla.org/en-US/firefox/addon/5369/" rel="nofollow noreferrer">YSlow</a>.</p>\n<p>It analyzes your web pages and provides grades from A-F (A being the Best and F being the worst) for each of the best practices, for high performance websites. It will help you to track down the elements of your website which you could optimize to gain speedups.</p>\n<p><strong>UPDATE</strong></p>\n<p>Now <a href="http://yslow.org/" rel="nofollow noreferrer">YSlow</a> extension is compatible with all modern browsers such as Firefox, Chrome, Opera, Safari and others, read more <a href="http://yslow.org/" rel="nofollow noreferrer">here</a>.</p>\n'}, {'answer_id': 11570, 'author': 'John Christensen', 'author_id': 1194, 'author_profile': 'https://Stackoverflow.com/users/1194', 'pm_score': 1, 'selected': False, 'text': "<p>You seem to be starting by assuming that your problem is download size - that may not necessarily be the case. You should do some experimentation with your ASP.NET site to determine if there are areas in your code which are causing undue delays. If it turns out that download size is not your problem, you'll need to find ways to cache your results (look into output caching, which is an ASP.NET feature) or optimize your code.</p>\n\n<p>In any case - the first step when looking at a performance issue is <em>always</em> to verify your assumptions first, then decide on a course of action.</p>\n"}, {'answer_id': 11616, 'author': 'Jon Sagara', 'author_id': 731, 'author_profile': 'https://Stackoverflow.com/users/731', 'pm_score': 1, 'selected': False, 'text': '<p>Have you tried these tips?</p>\n\n<p><a href="http://weblogs.asp.net/haroonwaheed/archive/2008/06/30/ASP.NET-Performance-Tips.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/haroonwaheed/archive/2008/06/30/ASP.NET-Performance-Tips.aspx</a></p>\n'}, {'answer_id': 11912, 'author': 'Seibar', 'author_id': 357, 'author_profile': 'https://Stackoverflow.com/users/357', 'pm_score': 2, 'selected': False, 'text': '<p>I wrote a <a href="http://terrapinstation.wordpress.com/2008/06/12/aspnet-http-comression-and-reducing-response-size/" rel="nofollow noreferrer">blog post</a> about improving ASP.NET page performance this a couple months back. Here are some quick &amp; easy ways -</p>\n\n<ul>\n<li>Turn off view state</li>\n<li>Turn off event validation</li>\n<li>Implement HTTP gzip/deflate compression to reduce the response size (number of bytes the server has to send back to the client)</li>\n<li>Try to optimize/minimize your database calls for each request</li>\n</ul>\n'}, {'answer_id': 32043, 'author': 'Dan Maharry', 'author_id': 2756, 'author_profile': 'https://Stackoverflow.com/users/2756', 'pm_score': 1, 'selected': False, 'text': '<p>You could start looking at caching strategies. Static files like CSS (even compressed ones) and images (even optimized ones) should only need to be downloaded once by the browser for a period of time. </p>\n\n<p>Scirpt combining for AJAX has already been mentioned, but I didn\'t notice reference to the ScriptReferenceProfiler MS has released on codeplex to help figure out what to combine. Mike Ormond <a href="http://blogs.msdn.com/mikeormond/archive/2008/06/26/asp-net-ajax-scriptreferenceprofiler.aspx" rel="nofollow noreferrer">has a good start point on this</a>.</p>\n\n<p>Another tip if you\'re doing a lot of INSERTs to your database is to double check your server\'s disk caching is switched on. Case in point, I had an data importer doing 1.2 million inserts during a run. Took 4 hours and change without caching on. Took 16 minutes with it on. </p>\n'}, {'answer_id': 88521, 'author': 'Tim Booker', 'author_id': 10046, 'author_profile': 'https://Stackoverflow.com/users/10046', 'pm_score': 0, 'selected': False, 'text': '<p>You could also look at ASP.NET output caching, which can be applied fairly granularly to different portions of your page:</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/xsbfdd8c(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/xsbfdd8c(VS.71).aspx</a></p>\n'}, {'answer_id': 304718, 'author': 'Thomas Hansen', 'author_id': 29746, 'author_profile': 'https://Stackoverflow.com/users/29746', 'pm_score': 1, 'selected': False, 'text': '<p>A general thing when using ASP.NET and Ajax (any Ajax library) together is to avoid elephanting your Page_Load and Page_Init (and their method counterparts) things since these will be executing on every Ajax Request.</p>\n\n<p>When that is said I would seriously ditch ASP.NET AJAX and use <em>anything</em> else...</p>\n\n<p>Anthem.NET, AjaxPRO.NET, jQuery or whatever else than ASP.NET AJAX...</p>\n\n<p>Of course I would use <a href="http://ra-ajax.org" rel="nofollow noreferrer">Ra-Ajax</a> myself since that\'s my project. But then again I am biased...</p>\n'}]
['https://Stackoverflow.com/questions/11500', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/149/']