My one value is reflecting on another application in MVC?
When I open two applications in different browsers or in the same browser, the value which I added in one application is visible to the other application.
I have made a session helper but i am still in problem.
public class SessionHelper
{
#region Strongly typed variable
public static CreateAccountModel tmpmodel = null;
public static string errMsg = string.Empty;
public static List<PointOfSalesModel> CurrPosModelArr = null;
public static List<PointOfSaleUsersModel> currAddedClerks = null;
public static List<AuthorizedIPsModel> currAddedIPs = null;
public static bool isPosDataLodedFirstTime = false;
public static string isEditGridClickedVal = "No";
public static int AccountId = -1;
#endregion
public SessionHelper Current
{
get
{
SessionHelper currentSession = HttpContext.Current.Session["_session"] as SessionHelper;
if (currentSession == null)
{
currentSession = new SessionHelper();
HttpContext.Current.Session["_session"] = currentSe开发者_如何学Cssion;
}
return currentSession;
}
}
}
Static fields/properties are shared across all your requests made from browsers. So even though you save it to the session, but each SessionHelper
will have same static fields referenced. Use instance fields instead.
精彩评论