Skip to main content

Posts

Showing posts from July, 2008

URL Rewriting

When I first ventured into this topic I thought this would be pretty straight forward but then being in software field I should have known better. Nothing is as simple as it sounds. So here we go URL re-writing in ASP.Net. What URL re-writing means is that you intercept an incoming web request in your web application and then redirect the web request to a different web resource in your web application. Now this is not done simply using Response.Redirect or Server.Redirect. There are many reasons why you would choose to do URL re-writing and the major ones could be - You want your urls to be search engine friendly. Your website has undergone restructuring or you expect the folders to be moved arround later. You want your urls to be user friendly (as in easier to remember). Any web request when it enters the ASP.Net engine an HTTPContext object is created and assigned to it and then it goes through a series of HTTPModules finally hitting a HTTPHandler. The HTTPContext object provides a m...

When to use Viewstate, Session, and Cache?

ViewState is used to manage asp.net server side controls state accross page postbacks. We can always store our own custom information into the viewstate. While storing custom information note should be made of the size of the viewstate as it impacts the page rendering time at the client end. Session is used to manage information for a particular user session. Any information that is needed with in a particular user's session can be stored here. Caching is used in asp.net to store objects in memory that require extensive server resources to create. You can establish an expiration policy with this. As a general rule of thumb - You use ViewState to store small amounts of data that is needed within the same page. You use Session to store data that is needed within the same user session. You can use data caching to store data that is needed accross user sessions through out the application.