Tuesday 15 November 2016

how to access session in class c#

how to access session in class c#
Here I will explain how to access session in class c#, we already use session in any code behind like page code. But some time required to access session value in class file or set session value in class file then we need to use like following syntax.

Example


string Value =Convert.ToString(HttpContext.Current.Session["Id"]);

this code working fine in any code behind file like default.aspx.cs



Convert.ToString(Session["Id"])


How to access session variables from any class in ASP.NET C#
the name session does not exist in the current context
how to access session in class c#

No comments:

Post a Comment



Asp.net tutorials