c# access session in class
public class MySession
{
// private constructor
private MySession()
{
Property1 = "default value";
}
// Gets the current session.
public static MySession Current
{
get
{
MySession session =
(MySession)HttpContext.Current.Session["__MySession__"];
if (session == null)
{
session = new MySession();
HttpContext.Current.Session["__MySession__"] = session;
}
return session;
}
}
// **** add your session properties here, e.g like this:
public string Property1 { get; set; }
public DateTime MyDate { get; set; }
public int LoginId { get; set; }
}
Also in C#:
- c# list to string comma separated
- or symbol in unity
- c# multiple catch exceptions
- c# list remove item based on property duplicate
- inheritance in c#
- serilog loglevel order
- get list length c#
- button commandfield commandargument pass textbox
- c# enum.getvalues
- unity rotate around point
- how to flip selection in aseprite
- unity random float
- dont destroy on load unity
- open zip file in c#
- csharp first element of array
- add row count devepxress report
- Instantiate c#
- c# bool list count true
- how to change scenes in unity
- make a list c#
- add text to combobox c#
- c# delegate return value invoke
- how to make game unity c#