Session Object in ASP.Net

Snake2k

New Member
How Can I use the Session Object in ASP.Net ???You can create a session variable and use it just as you would any other variable.<BR><BR>Setting the variable value:<BR> Session["var1"] = "abc";<BR>or<BR> Session.Add("var1", "abc");<BR><BR>Retrieving the variable value:<BR> string s = (string) Session["var1"];<BR>or<BR> string s = Session["var1"].ToString();<BR><BR>Remember that Session variables are available for a specific<BR>Session.Thanks for your valueable info Mr.JorgeHi Jorge i tried the code which you have given but it is giving an error saying the declaration is needed, even though i declared the variablesare u working in VB.NET? Jorge's code was in C#. the VB.NET equivalent is...<BR><BR>Session("mySession") = "ABC"<BR><BR>' Retrieving value<BR>Dim sessionValue As String = Session("mySession")Yeah... Nick....... i changed the language type to C# though i was getting the same error... But i will try with your code in vb.net itself.......it may work..Anyway thanks a lot
 
Back
Top