473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Cookie Processing in Class Library

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
Nov 19 '05 #1
2 3740
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ua**************@TK2MSFTNGP14.phx.gbl...
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

Nov 21 '05 #2
Nicholas:

Thank you very much for your help! It's working perfectly now!

Fred
Nicholas Paldino [.NET/C# MVP] wrote:
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.


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil Powell | last post by:
URL: http://valsignalandet.com/cookiegrab.php?name=valIdentifier This page produces a cookie value and sends it back as HTML using PHP and Javascript to obtain it. This URL will be used as the...
0
by: Ben Finney | last post by:
Howdy all, I'm using a library that uses SmartCookie. In Python 2.3, that gives this warning: /usr/lib/python2.3/Cookie.py:712: DeprecationWarning: Cookie/SmartCookie class is insecure; do...
13
by: Manlio Perillo | last post by:
Hi. I'm using the Cookie module (on the client side). I have found a problem trying to parse the cookie: "Set-Cookie: value=thevalue; path=/; expires=Fri, 21-May-2004 10:40:51 GMT" The date...
1
by: Glenn Venzke | last post by:
I have a pdf form that is submitting to an asp 3.0 page. I am setting a cookie value at login time that I need to access in this processing page. For some reason, the cookie is not being detected...
5
by: | last post by:
Hi, I'm trying to use the cookie munging session handling behaviour of asp.net instead of cookies themselves as I'm finding quite a few people are barring cookies (especially AOL users). If I...
0
by: vMike | last post by:
I don't know if I can explain this here, but I will try. I am using WebRequest/WebResponse to get product information from another website then put the selections in a shopping cart of the remote...
0
by: Peter Row | last post by:
Hi, I have a legacy VB6 webclass app that has been directly ported to VB.NET. My .NET webclass infrastructure works in more or less the same way but is now specific to my app and not the...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
6
by: Larry Rebich | last post by:
How do I read and write a cookie in an ASP.Net module? I can get this code to work in an aspx.vb class but not in a regular VB module: Response.Cookies.Add(c) Response is not a recognized...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.