Tuesday, March 31, 2009

SessionID changes with every request in the asp.net 2.0 application

For any web programmer, its obvious to think and believe that SessionId remains same through out the user session and it was right till asp.net1.1. But in asp.net2.0, this behavior has changed. In the asp.net application new sessionid is returned with the response to every request until session objects are not used.

According to MSDN the reason/solution is:
"When using cookie-based session state, ASP.NET does not allocate storage for session data until the Session object is used. As a result, a new session ID is generated for each page request until the session object is accessed. If your application requires a static session ID for the entire session, you can either implement the Session_Start method in the application's Global.asax file and store data in the Session object to fix the session ID, or you can use code in another part of your application to explicitly store data in the Session object."

Click here to view the article.


Exploring session in ASP.NET

This article describe about session in ASP.Net 2.0. It also explains about different types of session, their configuaration.


Monday, March 23, 2009

showModalDialog and postbacks in ASP.NET

I learned something new today that window.showModalDialog to open a modal window on the client from parent page using javascript, but whenever that page does a postback, it would open up a new window. A normal window.open works fine, this is the problem only with modal window.

Finally I found a solution which is very simple by just including the below tag in the section of the modal Window.

<base target="”_self”/">

And also we need to set the output cache property to “1″ otherwise next time when you try to open the modal window, it will take it from cache.

<%@ OutputCache Duration=”1″ VaryByParam=”none”%>


Friday, March 06, 2009

Visual studio keyboard shortcuts

Download the cool PDF versions of all the keyboard shortcut available in Visual Studio 2005 and 2008.


Make habit of using shortcut keys and save your time. :)

back to top