session
-
how we can set and unset or destory sesstion?
-
how we can set and unset or destory sesstion?
Buy a book on ASP.NET and read it. This is such an entry level question that even tho I will answer it, it's clear you have a lot to learn. Session["MyKey"] = "value"; // can be any type string s = (string)Session["MyKey"]; Session["MyKey"] = null; I would put the keys into a class, so that you're not always typing them, the compiler will not find typos in there. Also, I'd add methods to a base page class that safely check if a session object is null and return a bool if it is, just like the tryparse methods on classes like string.
Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
-
Buy a book on ASP.NET and read it. This is such an entry level question that even tho I will answer it, it's clear you have a lot to learn. Session["MyKey"] = "value"; // can be any type string s = (string)Session["MyKey"]; Session["MyKey"] = null; I would put the keys into a class, so that you're not always typing them, the compiler will not find typos in there. Also, I'd add methods to a base page class that safely check if a session object is null and return a bool if it is, just like the tryparse methods on classes like string.
Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
how about
Session.Abondon();
-
how about
Session.Abondon();
Well, I presume that clears it all, I was showing how to clear one value only.
Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.