How to store a temporary item in an ObjectContext without saving to the database?
Saving context in HttpContext, providing by class:
public static class HttpContextExtension { public static MyEntityDataModelContainer GetMyContext(this HttpContext httpContext) { if (httpContext.Items["MyEntityDataModelContainer"] == null) { httpContext.Items.Add("MyEntityDataModelContainer", new MyEntityDataModelContainer()); } return (MyEntityDataModelContainer)httpContext.Items["MyEntityDataModelContainer"]; } }
There are two blank pages: 1) FirstPage.aspx.cs:
public class FirstPage : Page { protected void Page_Load(object sender, EventArgs e) {
So, CountInFirstPage = 1.
2) SecondPage.aspx.cs:
public class FirstPage : Page { protected void Page_Load(object sender, EventArgs e) {
Here CountInSecondPage = 0.
Where am I mistaken?
source share