session state ???

C

cmrchs

Hi,

I have following function in a WebService-class :

[WebMethod(EnableSession=true)]
public int Count()
{
if ( null == Session["mycounter"] )
Session["mycounter"] = 0;
else
m_counter = (int)Session["mycounter"];
Session["mycounter"] = ++m_counter;
return m_counter;
}
'm_counter' is a datamember of the class.

When calling the WS-function from IExplorer several times do I get an incremented count as return value : OK

.... but invoking the same WS-function from a ConsoleApp always returns me the same value of 1 ???

result = calc.Count();
result = calc.Count();
Console.WriteLine("Count : {0}", result);

how come ?
thnx
Chris

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
B

BrunoX

Use a CookieContainer:

System.Net.CookieContainer cookieContainer1 = new
System.Net.CookieContainer();
MyWebService.Calc calc = new MyWebService.Calc();
calc.CookieContainer = cookieContainer1;
result = calc.Count();
result = calc.Count();
Console.WriteLine("Count : {0}", result);
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top