When I have either a httpModule or httpHander, I notice that if I have a integer that increments that it does not reset itself per page view. Are both the httpModule and httpHander instantiated only once and therefore can be used to store a incrementing number
of some sort?
Modules are instantiated once for each application instance. That means that they are not instantiated for each request, but you also can never be sure there is only one instance since ASP.NET creates multiple application instances also. You could use static
(or shared in vb) fields for true global, but that's true in any class, not just modules or handlers. I'm not sure about handlers -- it may depend on whether or not you indicate they are reusable with that property.
Thanks, Paul Wilson, ASPInsider, MC**
For the best .NET code, examples, and tools, visit:
WilsonDotNet.com, WilsonWebPortal.com, ORMapper.net
Kramerica
Member
100 Points
20 Posts
1 instantation?
Sep 18, 2003 03:26 AM|LINK
PaulWilson
Contributor
3715 Points
745 Posts
ASPInsiders
Re: 1 instantation?
Sep 19, 2003 03:38 AM|LINK
For the best .NET code, examples, and tools, visit:
WilsonDotNet.com, WilsonWebPortal.com, ORMapper.net