c# and cookies

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?
 
J

Joyjit Mukherjee

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
 
J

Joyjit Mukherjee

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
 
H

Hans Kesting

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
 

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