Home > DeveloperSection > Forums > how to use session in asp.net
Ashish Pandey

Total Post:128

Points:898
Posted on    January-05-2013 4:11 AM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 1166  View(s)
Rate this:
Hi,

I want to use Session in C# class Library. For that I need to import Using System.Web.UI. My partial code is
using System.IO;
using System.Globalization;
using System.Web
namespace sundss_framework
    {
        public class package
        {
           Session["ID"]="12121";
        }
    }

Thank in advance


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    January-05-2013 6:57 AM

Hi Ashish Paney

You don't need System.Web.UI, just System.Web.

Then access the session like:

 HttpContext.Current.Session["IDl"]="12121";

Modified On Jan-05-2013 07:02:02 AM

Don't want to miss updates? Please click the below button!

Follow MindStick