Session Add, Remove, Clear, RemoveAll and Abandon in ASP.NET
1. Session Add
To add in the Session
For ex
Session.Add("UserID",1);
or
Session["UserID"]=1;
UserID is Session ID
1 is Session value
2. Session Remove
Session.Remove(“UserID”);
It removes the specific session’s specific key value i.e) It removes the SessionID UserID
3. Session Clear
Session.Clear()
It clears all session value i.e) It clears all the key value pairs stored in the session state collection.
4. Session RemoveAll
Session.RemoveAll();
This Method calls above clear method in its implementation,
public sealed class HttpSessionState : ICollection, IEnumerable
{
.....
public void RemoveAll()
{
this.Clear();
}
.....
}
5. Session Abandon
Session.Abandon() destroy everything in the session. While logout you have to clear everything in session.
Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
Showing posts with label RemoveAll and Abandon in ASP.NET. Show all posts
Showing posts with label RemoveAll and Abandon in ASP.NET. Show all posts
19 January 2014
Subscribe to:
Posts (Atom)
Consistency level in Azure cosmos db
Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
· Azure Service Fabric is Microsoft’s Platform-as-a-Service (PaaS) and is used to build and deploy microservices-based cloud applicat...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...