Recently I have faced a problem of caching in ASP .NET. What happened was, I was using an ASPX page to resize the image size by passing the required image width and image path in querystring. An example image resizing tag that I was using will look like this..
< i m g src="thumbnail.aspx?filename=" width="170" />
The above tag works perfectly when it was running on .NET framework 1.1 but when I changed my server to framework 2.0 all the images displayed are the same, no matter the image path and file name was changed!! I knew it was a problem with the caching feature in .NET 2.0. So I googled for a solution for this, and figured out this cool tag to control the caching based on the parameters passed to the ASPX page. Here’s the tag that you need to place at the top of the ASPX page.
< % @ OutputCache duration="1000" varybyparam="width; filename" %>