Thursday, April 28, 2011

ASP.NET: Change the default session timeout for an application.

According to MSDN, the default timeout for server session is 20 minutes. You might need t ochange it for tha sake of your application. Just make the following change in the applications root level web.config file.

<system.web>
<sessionstate timeout="30">
</system.web>

ASP.NET: Automatic redirect to login page after session expires

If you want to automatically redirect to a page as the session expires, this is how you can do it:

Just check the session's existance. If it is no more in the server , then redirect to the desired page. The code snippet is as follows:

if (Session["session_name"] == null)
{
Response.Redirect("the_page_you_want_to_redirect_to.aspx");
}

ASP.NET: Sending an email from application.

Hi!

If you are looking to send an email from your application, ASP.NET has a very easy way to do that. The details can be found under this link:

http://msdn.microsoft.com/en-us/library/5k0ddab0.aspx

** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**