Web service + web app... DB connection ?

This may have been asked before, if that’s the case, sorry for the repetition.

I am trying a web app that displays web pages but also works as a service. Is this possible ?

Tha problem I am facing here is that the DB connection (At least what I’ve read) should be at the session level, while for handlespecilurl (the web service) there is no session available. Should I make another property for the db connection at the app level ?
How is this solved ?
Thanks for the enlightenment.

Yes this is possible.

What I do is create a local variable to hold the db connection in the handlespecialurl event handler and pass this as a parameter to any methods called.

Each invocation of HandleSpecialURL should have it’s own connection. Do not share database connections in a web app.

Just to be clear, are Wayne and Tim saying the same thing or contradicting each other?

I think we’re saying the same thing. Create a fresh connection every time in HandleSpecialURL. Wayne further elaborated by saying you can pass that connection to whatever methods you need to call, but it remains a locally created, non-shared connection, as opposed to having a global property.

@Tim Hare and I are indeed saying the same thing. Perhaps I should have posted “What I do is create a local variable to hold a new unique db connection in the handlespecialurl event handler”

It’s clear now
Thank you guys