ASP.Net - What is Session Variable? | How to kill a session?

Session Variable - C#

A session object stores information or change setting for a user session. Session variables are stored in a SessionStateItemCollection that is exposed through the System.Web.HttpContext.Session property.The collection of session variable is indexed by the session variable by name or by and index.

Related Articles
sessions, session variable, session id, web session, asp.net session,
web session
Find the below example to  create session variable for first and last name of a user and sets them to value retrieved from TextBox controls. Session variable can be any valid .Net type like ArrayList, Datatable

How to create a session variable in ASP.NET?
Session["FirstName"]= txtFirstName.Text;
Session["LastName"]= txtLastName.Text;

Retrieve/Get value from a Session
string Fname = Session["FirstName"].ToString();
string Lname = Session["LastName"].ToString();

How to kill a asp.net session by session id?

I hope you will enjoy the development tips while programming with asp.net using C#. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome. Also If you like this article, don't forget to share this article with your friends and colleagues.
ASP.Net - What is Session Variable? | How to kill a session? Reviewed by Ravi Kumar on 11:22:00 PM Rating: 5

No comments:

All Rights Reserved by Etechpulse © 2012 - 2017
Powered By Blogger

Contact Form


Email *

Message *

Powered by Blogger.