1
votes

I develop ios program and i use asp net session system.The problem is when i close program,session is deleting!how can i handle with this?

Code section: protected void Page_Load(object sender, EventArgs e) { Response.Headers.Add("Content-type", "text/json"); Response.Headers.Add("Content-type", "application/json"); string b = Request.QueryString["routeFunc"];

        if (b != "user/login")
        {
            Dictionary<string, string> userData = (Dictionary<string, string>)Session["userData"];
            if (userData == null)
            {
                userData = new Dictionary<string, string>();
                userData.Add("false", "0");
                echo(JsonConvert.SerializeObject(userData));
                return;
            }
            else
            {
                Session["userData"] = c_mysql.FindOne("users", "id", userData["id"]);
                userData = (Dictionary<string, string>)Session["userData"];
                c_user.userData = userData;
                c_user.notificationCenter.userData2 = userData;
            }
1
You need to use Session only temporarily. Store the data in a database and pump changes to both the database and the session variable. Then, use a function to get the data and have the function check to see if the session variable is not null. If it is, pull from the database, set the session variable and return the data. Otherwise just return the session variable.Mark Fitzpatrick

1 Answers

0
votes

i solved my problem by using cookie thanks! https://www.youtube.com/watch?v=PmziMRE9NQ8