Hello Nadav,
As for the SessionID problem you meet in ASP.NET webservice call, it is
likely due to the sessionID lazy initializing feature in ASP.NET. For
ASP.NET sessionstate module, it will always assign a random sessionID for
each page request(event of the same client) if you haven't stored any data
in the SessionState. This can avoid allocating unused server-side
sessionstate storage. This has also be mentioned in the ASP.NET session FAQ:
#Understanding session state modes + FAQ
http://forums.asp.net/7504/ShowPost.aspx
Here is the original description picked from the FAQ:
Q: Why does the SessionID changes in every request?
A: This may happen if your application has never stored anything in the
session state. In this case, a new session state (with a new ID) is
created in every request, but is never saved because it contains nothing.
However, there are two exceptions to this same session ID behavior:
- If the user has used the same browser instance to request another page
that uses the session state, you will get the same session ID every time.
For details, see "Why does the SessionID remain the same after the Session
times out?"
- If the Session_OnStart event is used, ASP.NET will save the session state
even when it is empty.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
therefore, for your scenario, your webservice may first store a small
placeholder data into session so as to make the sessionID fixed. You can
try testing it to see whether it works.
Hope this helps some.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Nadav Popplewell - 18 Feb 2007 07:29 GMT
Hi Steven,
I've tried it, and if I save something in the session then the session ID
remains the same.
So EnableSession=true DOES work with ASP.NET 2.0.
The thing I don't understand is that 'Understanding session state modes +
FAQ' page
last updated date is Sept 21, 2004.
So I would think that the page describes the behaiviour of asp.net 1.1.
However, in the VS2003 web service I got the session ID even if I didn't
save anything in the session.
Oh, Never mind. As long as it works with ASP.NET 2.0..
Thanks for your help.
Nadav
Steven Cheng[MSFT] - 19 Feb 2007 03:58 GMT
Thanks for your followup Nadav,
Yes, that FAQ article has been generaetd early at ASP.NET 1.x time. Most of
its implemenation feature and behavior applies for both ASP.NET 1.X and
2.0. For the session ID behvior, it does be consistent between ASP.NET 1.1
and 2.0 application(at least for webform application scenario). For the
webservice proxy of your VS 2003 webservice, I think there may already
exists some data in the server session or the ASP.NET 1.x webservice will
put some placeholder data whenever we enablesession for webservice. So far
I haven't got indepth on this.
Anyway, glad that you've got it working and if there is anything else we
can help, please feel free to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Ivo Decae - 02 Mar 2007 22:50 GMT
Hi Steven,
I've come up to this article when searching information on keeping a
webservice 'alive'.
Let's say that we would use a webservice (ASP.NET 2.0 / IIS 5) for
authentication (using soapheaders) and then make further use of other methods
within the same webservice to expose data from our back-end system (where our
ERP/... is running) to our customers.
Would this be a good approach ? And do you know if we could use the session
for keeping the state of the currently authenticated user ?
Thanks for a reply.
Sincerely
Ivo
> Thanks for your followup Nadav,
>
[quoted text clipped - 18 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights