web service session doesn't work

T

Tom

hello

question 1:

I have the following code below but the funny thing is that Session only
works when I invoke it from the server side.. When I call this session from
client (winform app) I don't get an inrementation instead only 0... I don't
know why..

question 2:

for somereason I don't see any exceptions in this web service when there's
an error ie. Session["value"] +1 where Session["value"] is null there should
be an exception thrown and give me a view like asp.net but instead I get a
blank page which it says it can not find the page. anyone know why ?

[WebMethod(EnableSession=true, MessageName="AddSession")]

public int helloworld()

{

//int foo = (int)Session["value"];

if (Session["value"] == null)

{

Session["value"] = 0;

}

else

{

Session["value"] = (int)Session["value"] + 1;

}

return (int)Session["value"];

}





Thankyou

Tom
 
H

Hans Kesting

Tom said:
hello

question 1:

I have the following code below but the funny thing is that Session
only works when I invoke it from the server side.. When I call this
session from client (winform app) I don't get an inrementation
instead only 0... I don't know why..

Sessions work with cookies. Usually when you call a webservice from
some client, cookies are ignored!
You need to add a place to store those cookies: a CookieContainer.
First create one, then add it to the webservice calls that should work
with the same session.

Hans Kesting
 
T

Tom

tanks

Hans Kesting said:
Sessions work with cookies. Usually when you call a webservice from
some client, cookies are ignored!
You need to add a place to store those cookies: a CookieContainer.
First create one, then add it to the webservice calls that should work
with the same session.

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