user605334
user605334

Reputation:

How i can optimize Performance in asp.NET MVC based web application

How i can improve the performance of my asp.net mvc application [built in 3 razor]

well i want to do something to enhance the performance of my website by doing following things.

the page have much image [small images] are i can optimize them then client browser easily download them and trying to get them after page load.

because all css are not use on every time. in IE i found that most of css is unusable for page. like various jQuery or css plugin framework file not used in every page.

well are i can merge all css or js file then browser never send request to get css or js from server.

what i do then performance can be improved. are i should use

Upvotes: 1

Views: 1885

Answers (3)

Atanas Korchev
Atanas Korchev

Reputation: 30661

You may consider trying the CSS sprites technique - combining all (or most) of your images in a single one and applying them as CSS background. This will reduce the number of HTTP requests for images to just one (the sprite image itself).

Also consider minifying and combining your CSS and JavaScript files. There are lots of tools on codeplex which do that. Most important thing here is to set up expiry headers so the browser will cache the resources and never ask for them again.

You might also want to get rid of some background images and replace them with CSS background gradients.

Upvotes: 2

Nicholas Murray
Nicholas Murray

Reputation: 13533

If you are deploying to IIS 7 you can compress and client-side cache CSS and Javascript via the web.config file.

Here are a few excerpts from the excellent How to improve your YSlow score under IIS7 blog by Jonathan George

Add an Expires or Cache-Control Header via the web.config

<?xml version="1.0" encoding="UTF-8"?>
 <configuration>
  <system.webServer>
    <staticContent>
    <clientCache cacheControlMode="UseExpires"
               httpExpires="Sat, 31 Dec 2050 00:00:00 GMT" />
  </staticContent>
 </system.webServer>
</configuration>

Compress components with Gzip

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
  <dynamicTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </dynamicTypes>
  <staticTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </staticTypes>
</httpCompression>

Upvotes: 3

Related Questions