473,387 Members | 1,942 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,387 software developers and data experts.

Cookies: Are they handled by HttpWebRequest and HttpWebResponse classes?

Hi all,

I am beginnig to try out the exciting Web stuff in .NET, so please forgive
my perhaps silly question.
I am trying to communicate with a Web server using HttpWebRequest
and -Response classes from a WinForms application. The server may set and
read back cookies.

Do I have to support the server in a special way (like a browser), and if
so, where do I have to look for some documentation? Or are cookies handled
transparently?

Thanks in advance,
ulrich
Nov 18 '05 #1
3 1079
You'll need to create an instance of the CookieContainer class and
attach the container to the Cookie property before sending each
request. The CookieContainer will manage the cookies for you then.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 21:52:43 +0200, "Ulrich Sprick"
<ul***********@gmx.de> wrote:
Hi all,

I am beginnig to try out the exciting Web stuff in .NET, so please forgive
my perhaps silly question.
I am trying to communicate with a Web server using HttpWebRequest
and -Response classes from a WinForms application. The server may set and
read back cookies.

Do I have to support the server in a special way (like a browser), and if
so, where do I have to look for some documentation? Or are cookies handled
transparently?

Thanks in advance,
ulrich


Nov 18 '05 #2
Umm.... I must have had my dark sunglasses on while browsing though MSDN
last night, I simply overlooked the CookieContainer property. Sorry for
that. I am looking in the right direction, am I?

Ulrich
Nov 18 '05 #3
YES! I'm on the way! Thanks for the response!
ulrich

"Scott Allen" <bitmask@[nospam].fred.net> schrieb im Newsbeitrag
news:ui********************************@4ax.com...
You'll need to create an instance of the CookieContainer class and
attach the container to the Cookie property before sending each
request. The CookieContainer will manage the cookies for you then.

--
Scott
http://www.OdeToCode.com/

Nov 18 '05 #4

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

Similar topics

0
by: Michael Evanchik | last post by:
Hello all, since i wanted to use ssl and its seems easy to do so with this object. Im trying to login to a webserver (aol) for this example. But for some reason, im packet sniffing with ethreal...
0
by: Pat Allan | last post by:
I've spent half a day on this with no success, so I'm hoping someone can point out what I'm doing wrong. I have an ASP.NET Server-side component that I've created, and as part of its Render...
1
by: Bhupesh Saini | last post by:
I am trying to call a ASPX page using HttpWebRequest class and pass cookie information to it. My ASPX pages gets called just fine, however none of the request cookies are available to the ASPX page....
1
by: Ravi | last post by:
Hi , i am trying to pass the same session Id to all the webrequest, but sometimes the response.cookies returns zero and sometimes one. is this to do something with cookies expire. In this sample...
1
by: Prasanna Padmanabhan | last post by:
I am writing a simple HTTP Client in .NET. I make an HTTP Request and examine the response. I get an empty CookieCollection when I do HttpWebResponse.Cookies. However HttpWebResponse.Headers...
4
by: Andy Fish | last post by:
Hi, I have a web app that I want to make calls back into itself (preserving the session cookies etc). I am using a System.Net.HttpWebRequest object to make the request, but I am having...
16
by: Cheung, Jeffrey Jing-Yen | last post by:
I have a windows form application that generates a request, downloads an image, and waits the user to enter in login info. Unfortunately, this image is dynamic and based on session data. I have...
6
by: James MA | last post by:
I'm now writing a small program to communicate a web server to simulate a web client. I use te httpwebrequest to talk with the server, and it works find for "POST" method, however, when i test...
7
by: mcfly1204 | last post by:
I have a request to a login page, and I am trying to save the response cookies in a CookieContainer. I am then attempting to make another request reusing the previous CookieContainer. I then am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.