tags:

views:

9

answers:

1

i'd like to use a class to manage a certain cookie, but not directly on the page where i have access to all the httpcookie stuff like so HttpContext.Current.Request.Cookies["CookieName"].Value;.

however i'd like to be able to do this from a class in another project. i have a reference to that project and can access the class, but there i do not have access to the httpcontext.

so how do i get access to that, and how can i generally access all the stuff in an outside class that i can on the page directly?

the reason for this is that this code is common and will be used on a lot of pages, so don't want to have it in multiple places.

thnx
i hope i explained it correctly, ask if you need more info.

+2  A: 

Add the System.Web assembly reference to your class library project and use:

System.Web.HttpContext.Current to get access to the HttpContext, from within any of your classes in your library.

Wim Hollebrandse
thank you, it worked :)
b0x0rz