Thursday, July 19, 2012

Speeding Up Your Web Site

To speed up website we need to take care about certain things.
i am providing several points which you should take care while developing and deploying your website.

1. Minimize HTTP request
2. Use a CDN for static file.
3. Add an Expire Header.
4. Gzip or compress site text. here is the link for  Gzip Compression
5. Put CSS at top and script at the bottom.
6.minimize javascript.
7. Avoid duplicate Scripts.
8.Configure Etag.
9.Avoid Redirects.
10. Flush Buffer early

Definately i will elaborate on these tips or you can Google around to find some useful info!!!

:))

Favicon

What is Favicon ?

when you open up a browser and visit a site you will see an icon on the tab

this is called favicon.Every time when we request a page it search for favicon.
It is a best practice to use favicon in asp.net application.it also optimize performance of website a bit.
to use favicon just add this under <Head> tag

<link rel="shortcut icon" href="URL or path of your icon file"/>
Remember to replace
URL or path of your icon file file with your icon file's url.

Enjoy programming...:))

Wednesday, July 18, 2012

Visual Studio Build error

If you are facing problem to build your visual studio Application even if there was no syntax error then don't worry you just need to delete some temporary files.

Delete cache file of your project if problem in building.

%LocalAppData%\Microsoft\WebsiteCache

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

:)

Unlimited Connection TimeOut in Asp.net and SQL

Sometimes when we are executing a Stored procedure from Asp.net which takes a lot of time,which leads to connection TimeOut problem.
There are two ways to increase connection TimeOut.
1) From Asp.net Web.config
2) From Sql Server database setting.

For Asp.net got to web.config connection string and set Connection timeout Property to 0(Zero).

For Sql Server right click on Server => Properties . then a server properties page will open , from left hand side menu select Connections and set Remote query timeout to 0.

I hope somebody will find this useful.

How to set gzip/deflate compression in .net.

To enable Gzip and deflate compression in Asp.net website, you just need to place this code in global.asax.
however you can also apply this setting to IIS level.

void Application_PreRequestHandlerExecute(object sender, EventArgs e)
    {
      
        try
        {
            HttpResponse Response = HttpContext.Current.Response;
            String AcceptEncoding = HttpContext.Current.Request.Headers["Accept-Encoding"];