AddHandler in multiple instances of web app

Hi all,

I have a method that retrieves data from the server. I added an event handler to the method to display the data when the event is triggered. After the data is shown, I would remove the handler. Pretty straightforward.

My question is, what happens if multiple users are using different browsers to access this web app? Will the event handler be triggered for the wrong person if the handler is not removed yet?

I’m not sure if there is enough info in your question to give a definitive answer. My guess would be if you are not initiating your data retrieval inside a session or with reference to a particular session, then yes you could end up triggering for the wrong user.

It sounds like there could be multiple problems with the code. What happens if user 1 requests some data, then users 2 and three, and then user 2s request returns first?

This sounds like something you might want to add an event for in a class so that you always have separate objects for each user handling the interaction with the remote server.

Hopefully that helps, if not maybe more specifics about what you are trying to do would help shed some light on a better solution.

I am trying to retrieve data using an ODBC connection and a SQLSelect method. If there are no errors, then i simply use RaiseEvent dataReceived to trigger a method that will display the data.

My understanding is that the RaiseEvent doesn’t get called until the SQLSelect finishes retrieving the data. This means there’s a chance that another user would have triggered the event

If so, what should I pass into the event handler to check if it’s the correct user?

Each Session should have it’s own database connection. Do not share a connection between sessions.

Thanks, I should of read the Session class better. It specifically said I need to add the database connection class to the Session.