Re: Access Session State from a Class

  • Thread starter Marcelo Dabanovich Lavio
  • Start date
M

Marcelo Dabanovich Lavio

Hi Carlo,

If your BLL is always loaded into the process space (same AppDomain as) the
ASP.NET front-end (which is the case if your BLL is a simple class library
project being referenced by your ASP.NET projetc), then you can access the
ASP.NET session state using the class System.Web.HttpContext. On your BLL
dll project, add a reference to System.Web, and on your code, access the
session data this way

System.Web.HttpContext.Current.Session["abc"]

Marcelo
 
G

Guest

Thanks a lot for your help Marcelo, it works perfectly

Marcelo Dabanovich Lavio said:
Hi Carlo,

If your BLL is always loaded into the process space (same AppDomain as) the
ASP.NET front-end (which is the case if your BLL is a simple class library
project being referenced by your ASP.NET projetc), then you can access the
ASP.NET session state using the class System.Web.HttpContext. On your BLL
dll project, add a reference to System.Web, and on your code, access the
session data this way

System.Web.HttpContext.Current.Session["abc"]

Marcelo


Carlo Marchesoni said:
I have an ASP.NET/c# solution with
- FE (an ASP.NET Project)
- BLL(a C# Project with Classes)

In the FE I set some Session State variable (Session["abc"] = "whatever"),
but I found no way to retrieve this session state value in the classes of the
BLL Project (obviousely I can pass the values in the signatures, that's what
I'm doing right now).
I'm sure there is a way to do it directly (string s = Session["abc"]) but
I'm unable to find out how.
Thanks for any suggestion
 
Joined
Jan 14, 2009
Messages
1
Reaction score
0
Marcelo Dabanovich Lavio said:
Hi Carlo,

If your BLL is always loaded into the process space (same AppDomain as) the
ASP.NET front-end (which is the case if your BLL is a simple class library
project being referenced by your ASP.NET projetc), then you can access the
ASP.NET session state using the class System.Web.HttpContext. On your BLL
dll project, add a reference to System.Web, and on your code, access the
session data this way

System.Web.HttpContext.Current.Session["abc"]

Marcelo


"Carlo Marchesoni" <[email protected]> wrote in
message news:[email protected]...
> I have an ASP.NET/c# solution with
> - FE (an ASP.NET Project)
> - BLL(a C# Project with Classes)
>
> In the FE I set some Session State variable (Session["abc"] = "whatever"),
> but I found no way to retrieve this session state value in the classes of

the
> BLL Project (obviousely I can pass the values in the signatures, that's

what
> I'm doing right now).
> I'm sure there is a way to do it directly (string s = Session["abc"]) but
> I'm unable to find out how.
> Thanks for any suggestion
Hi Marcelo,

just wanted to ask you...

what if my BLL class liabrary is loaded into different Process Space..
I have a callback delegate which is having a function reference of my WebApp.
When that delegate gets called..I get the System.Web.HttpException for Page.Session as both the projects are running in differnt space

thanks,
Padmanabh Ganorkar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top