Cookie Processing in Class Library

F

Fred Nelson

Hi:

I'm developing a C# web application. I would like to create a class
library that can access cookies directly.

Every time that I put a "Response.Cookies" or a "Request.Cookies" in my
class library I get an error: "A get or set expressor expected".

If anyone knows of a way to read cookies in a c# class library I would
greatly appreciate your help!

Thanks very much,

Fred
 
N

Nicholas Paldino [.NET/C# MVP]

Fred,

Request is a property exposed by the Page class, which you don't have
access to in your library classes.

What you want to do is get the current HttpContext instance through the
static Current property on the HttpContext class. This will expose the
properties you are used to (Request, Response, etc, etc).

Hope this helps.
 

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

Top