Scope of a Public Module in a Web Environment

A

Ashish Shridharan

Hi All

I have been tryign to figure out the scope of a module as
shown declared below in a web environment.

My Questions are

Is this module shared across multiple instances of the
application ??
What about variables declared in global scope of this
module ? How does asp.net treat something like that ?

Public Module modModuleName

Dim m_objDatabaseConnection as new sqlconnection
(connectionstring)
End Module


Any help would be appreciated

Thanks & Regards

Ashish Shridharan
 
J

John Soulis [MSFT]

A module is marked as shared in Visual Basic. The global information will
be shared across applications in a web application.

Thank you, John Soulis
Microsoft, ASP.NET

This posting is provided "AS IS", with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
A

Alvin Bruney

I'm not sure what you mean by module because these concept no longer exists
in .NET. It's a vb term. It could be vb.NET so in that case excuse my
ignorance cause I don't know much vb.net. It all depends on where you
declare your 'module'. If you place it in the application global.asax then
it has global scope and lasts till the application stops, which means it
will be around even if users log in and log off. Typically the application
stops after iis is reset or some other event causes the application to
recycle.
Is this module shared across multiple instances of the
application ??
I'm not sure what you mean by this either. A web application has one
application object per application domain.

Scope determines how long the object lasts. If you declare this inside a
class, it lasts for as long as the class is around, for the most part.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,787
Messages
2,569,627
Members
45,328
Latest member
66Teonna9

Latest Threads

Top