Session sharing between webservice and asp.net application

I have an asp.net application and webservices (asmx) which are in the same application but not in the same aspx file folder. I also have a winform application that uses web services. I tagged the webservice methods with [WebMethod (EnableSession = true)], but I cannot use the same session values ​​that are in the application in web services. The winform application has access to the sessionID from the application, and I use the following code

Uri uri = new Uri(ServerServiceUrl);
_cookieContainer = new CookieContainer();
_cookieContainer.Add(new Cookie("ASP.NET_SessionId", SessionID, "/", uri.Host));

My question is: is there something I am missing or something is wrong that I cannot access the sessioin application from web services?

+5
source share
2 answers

I cannot shed light on why you cannot force the winforms application to “capture” a session — what you are doing, it looks like it should do exactly what you want.

I just wanted to assume that you are using the application cache (to cache the response from the java service) instead of the user session repository. This has the following advantages: -

  • a) If the cached information is applicable to more than a single user (for example, access control), then the same cached information can be used for several users and not be retrieved for each session.
  • b) , / , ( , )
  • c) , .
+1

webservice System.Web.SessionState.IRequiresSessionState?

http, -, , .

0

All Articles