Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > session state ???

Reply
Thread Tools

session state ???

 
 
cmrchs@yahoo.com
Guest
Posts: n/a
 
      09-29-2004
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...
 
Reply With Quote
 
 
 
 
BrunoX
Guest
Posts: n/a
 
      11-08-2004
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);

"Chris C" wrote:

> 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...
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 2.0 Session State and ASP.NET 1.1 Session State jnickfl1 ASP .Net 0 09-18-2006 03:23 PM
Unable to make the session state request to the session state server Maciek ASP .Net 0 09-15-2005 08:49 PM
Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'. Mike Larkin ASP .Net 1 05-23-2005 12:33 PM
Unable to make the session state request to the session state server Not Liking Dot Net Today ASP .Net 0 04-21-2004 11:54 AM
unable to make the session state request to the session state server shamanthakamani ASP .Net 1 11-20-2003 04:51 AM



Advertisments