Monthly Archives: July 2011

How to use Compression method in asp.net to speed up website

Common questions related to performance issues of websites

  1. How to improve website performance ?
  2. How to speed up website ?
  3. How to compress webpages
  4. What are the methods to improve page loading speed
  5. How to optimize webpages

I googled alot to find some good and easy method to speed up my websites, already i have optimised all my css and scripts and ofcourse images. So now i need to compress the webpages. And i come up with this solution. It is very simple. This method uses gzip/deflate encoding to compress the webpages. First, create a global.asax file. Now add the following code into that file.

Now upload the file to root of your website.And you are done. But before doing this ensure that you have optimized your css, js and images also. Only then you can feel the change

Cheers

How to convert normal date time to relative

How to make a normal date like “12/05/2011” to “Some days some hours and some seconds ago”
Here is the answer. We have seen dates in vairous formats, some of you may noticed in facebook or orkut, how they show times. They show relative date and time.
Here is the code for doing it. It is an extension to DateTime Object.

And you are done!. Now you can use the code like this

Cheers

How to create an image handler to resize external images on the fly

This post is about creating an image handler to resize external images on the fly. I got code to resize images with in our server, but i was in need to resize external images in the fly. So I modified the code. Lets create a generic handler file first, named ImageHandler.ashx.

Usage:

We can do this with our internal images also by changing the GetImage() function a little bit.
Hope you like this, enjoy coding

Cheers