Wednesday 8 June 2016

How to remove specific session in asp.net using c#?



Asp.net session state allows us to store and retrieve value for user specific so that user navigates web pages in asp.net. http is a stateless protocol. Session makes asp.net stateful that allow user to store , read, update and remove data.

We can remove item from session by using HttpSessionState.Remove() method as Session.Remove(). This method will require to pass parameter. Parameter name is “name” and its data type is string.

Example:-

Session["EmpId"] = "Emp001";// session created with name Empid

// Remove specific session with session name

Session.Remove("EmpId");

No comments:

Post a Comment

Note: only a member of this blog may post a comment.