I have developed a ASP.NET application,I have used sessions for parameter passing.
I dont want to let the user to enter data when the session expired.Please suggest me how to do that.
I have developed a ASP.NET application,I have used sessions for parameter passing. I dont
Share
Create a base page, inheriting from System.Web.UI.Page and in the on load event check your sesion object and if its null then redirect to the homepage and then have all your pages inheriting from that.
However as already commented on by others you database connection should not be left open anyway. Your UI shouldn’t have any knowledge of your db connection. Your business layer is where you should be using your db connection.
In your business layer assuming your are using SQL you should have a statement something like:
At the end of the using statement your sql conection will be disposed. For more information, you might want to look at this article:
MSDN SqlConnection
Thanks
Paul