Why do I need ASP.NET Master Pages ?

I have a web application that has five ASPX pages. All have similar look and feel with same header, menu and footer.  In order to simplify my coding I created two include files header.aspx  and footer.aspx and included them at the right place in all my five ASPX pages.  So my pages look like

Page1.aspx

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>page1 title</title>
</head>
<body>
<!-- #include VIRTUAL="/include/globalheader.aspx" -->
my content for page1 goes here
<!-- #include VIRTUAL="/include/globalfooter.aspx" -->
</body>
</html>

There is a better way to achieve this. Its called to Master Page. Master pages provide functionality that developers have traditionally created by copying existing code, text, and control elements repeatedly, using framesets, using include files for

Read More »

Posted in ASP.NET, Web Site Design and Layout | Tagged , , | Leave a comment

How to use the System.Web.Caching.Cache Object – ASP.NET Data Caching

Data caching is storing of data in web-server’s (IIS) memory for quick access by requesting browsers.  Any information that is expensive to get (in terms of performance) is saved in the data cache. For example, commonly SELECTED database values that do not change often can be stored in data cache.  This way instead of making repeated calls to SELECT data from dB, it can be accessed only one time and saved into the cache. Future requests to the same data will be retrieved from the cache as opposed to database call, thus reducing the load on database server.

Using data caching, you can cache selected data objects as opposed to the entire page. Read my post ASP.NET 4.0 Output Caching if you need cache the entire page in Read More »

Posted in ASP.NET, Caching | Tagged , , , , , | 1 Comment

ASP.NET 4.0 Output Caching – What is VaryByParam and VaryByCustom

One of the easiest ways to cache ASP.NET pages is using OutputCache page directive. ASP.NET output caching reduces the time needed to execute ASP code by simply saving the output of the ASP in the HTML format inside IIS memory and returning the saved or cached HTML in the future request to the same page. So the future requests to the same ASP page do not require re-execution of the ASP script. In fact the entire ASP engine is totally bypassed and IIS simply returns the snapshot HTML from the memory.

<%@ OutputCache Duration=”300″ VaryByParam=”*” %>

Using this directive, you can take a snapshot of the output of the ASP.NET engine, which is in pure HTML text format, just before it is streamed to the browser from IIS using HTTP protocol. This snapshot is saved in the memory of IIS and served to the browser. Any future calls to this ASP page will result in

Read More »

Posted in ASP.NET, Caching | Tagged , , , , , , , | 2 Comments