c# and cookies

  • Thread starter Thread starter Luca
  • Start date Start date
L

Luca

I have to write a win application that call a web service that create two
cookies. I've already written the web service, when i call it from a web
browser it's all ok and the cookies are create, but when i call it from my
application the two cookies are not created. Why?
 
Hi,

cookies contain small amount of data that are stored in client computers and
are intended to be used with Web forms (and Web Services). They are part of
Request & Response objects.

Regards
Joyjit
 
Hi,

Sorry for the incomplete post.
Also, you have to use the System.Net class to get a cookie object to use in
winforms app.

Regards

Joyjit
 
Luca said:
I have to write a win application that call a web service that create two
cookies. I've already written the web service, when i call it from a web
browser it's all ok and the cookies are create, but when i call it from my
application the two cookies are not created. Why?

You need to provide a place to store the cookies. See "System.Net.CookieContainer".
I have never used it (yet) but it is something like:
* create a cookiecontainer
* tell the webservice class to use it

You should keep a reference to the container, as you need to use it for multiple
requests.

Search for CookieContainer in MSDN: there is a "HOW TO"


Hans Kesting
 
Back
Top