[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

ASP.Net Web Service sessions

I have an asp.net web service app that handles sessions which works fine in most cases, i.e the client can call up to 4 web service methods and data is remebered across the methods.

I am using .NET's built in session management.

The problem occurs when the web service is called by an ASP.Net web app with multple browsers making requests.

The web service app thinks the requests from the web app are all part of the same session even though they are from different browsers.

Is there any way to handle this?

Thanks

0
webprouk
Asked:
webprouk
  • 2
  • 2
1 Solution
 
SCDMETACommented:
This is not a solution but some questions to clarify the problem, are all browsers running on the same desktop? If so, how are you starting the browser instances?

a) If you launch two instances in Internet Explorer from a shortcut, and navigate to your app, each will get it's own sessionid.

b) If you open one instance of Internet Explorer, and the click File | New | Window, both instances of IE will get the same sessionid.

My bet is you are testing using method b).  Many people would argue that sharing the sessionID between multple browser instances spawned from a parent browser is a good thing.   Does the problem occur when you start each browser using method a, or start them on different machines?



0
 
webproukAuthor Commented:
thanks for your reply, but I have been testing using browsers on different machines.

these browsers connect to the web server which calls the web service. the web service thinks it is the same session because all the requests are coming from the web server.
 
0
 
SCDMETACommented:
Take a look at this link:
http://msdn2.microsoft.com/en-us/library/system.web.services.protocols.httpwebclientprotocol.cookiecontainer.aspx

You can store the web serivce cookie used to access the web service, in the web application's session.

Browser 1 connects to the web application, you extract the stored web service cookie from the session, and call the web service.  You store the resulting cookie back in the session.

Browser 2 connect and the web application pull its web service cookie from the session, calls the web service, and store the results cookie back to the web app session.

This way each browser has it's own web service cookie.

I've never done this, but it looks possible.
0
 
webproukAuthor Commented:
Thanks a lot, that's just what i needed
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now