473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

When is IHttpModule.Dispose method called?

Hello, I am trying to understand when IHttpModule.Dispose method is called.
Is it called when the Application is disposed, or when the request ends?

If I want to make an object Application-wide and close it when the
application ends can I use that method or write something like this in the
class that implements the IHttpModule?

public void Init(HttpApplication application)
{
application.Disposed +=new EventHandler(application_Disposed);
}

private void application_Disposed(object sender, EventArgs e)
{
// close my object here
}

Thanks in advance.

--
Simone Busoli
Jan 3 '06 #1
6 4143
I hope this doesn't sound rude, but the documentation, for 2.0 atleast,
makes this pretty clear:
"The Dispose method performs any final cleanup work prior to removal of the
module from the execution pipeline."

which would mean it's application-wide.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
Hello, I am trying to understand when IHttpModule.Dispose method is
called.
Is it called when the Application is disposed, or when the request ends?

If I want to make an object Application-wide and close it when the
application ends can I use that method or write something like this in the
class that implements the IHttpModule?

public void Init(HttpApplication application)
{
application.Disposed +=new EventHandler(application_Disposed);
}

private void application_Disposed(object sender, EventArgs e)
{
// close my object here
}

Thanks in advance.

--
Simone Busoli

Jan 3 '06 #2
It's what the documentation says for 1.1 too, but it didn't sound to me very
clear. I'd be glad if you could explain the reason why it is so clear.

--
Simone Busoli
"Karl Seguin" wrote:
I hope this doesn't sound rude, but the documentation, for 2.0 atleast,
makes this pretty clear:
"The Dispose method performs any final cleanup work prior to removal of the
module from the execution pipeline."

which would mean it's application-wide.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
Hello, I am trying to understand when IHttpModule.Dispose method is
called.
Is it called when the Application is disposed, or when the request ends?

If I want to make an object Application-wide and close it when the
application ends can I use that method or write something like this in the
class that implements the IHttpModule?

public void Init(HttpApplication application)
{
application.Disposed +=new EventHandler(application_Disposed);
}

private void application_Disposed(object sender, EventArgs e)
{
// close my object here
}

Thanks in advance.

--
Simone Busoli


Jan 3 '06 #3
I guess it isn't if you don't know what the ASP.NET pipeline is...which a
lot of people wouldn't.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
It's what the documentation says for 1.1 too, but it didn't sound to me
very
clear. I'd be glad if you could explain the reason why it is so clear.

--
Simone Busoli
"Karl Seguin" wrote:
I hope this doesn't sound rude, but the documentation, for 2.0 atleast,
makes this pretty clear:
"The Dispose method performs any final cleanup work prior to removal of
the
module from the execution pipeline."

which would mean it's application-wide.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
> Hello, I am trying to understand when IHttpModule.Dispose method is
> called.
> Is it called when the Application is disposed, or when the request
> ends?
>
> If I want to make an object Application-wide and close it when the
> application ends can I use that method or write something like this in
> the
> class that implements the IHttpModule?
>
> public void Init(HttpApplication application)
> {
> application.Disposed +=new EventHandler(application_Disposed);
> }
>
> private void application_Disposed(object sender, EventArgs e)
> {
> // close my object here
> }
>
> Thanks in advance.
>
> --
> Simone Busoli


Jan 3 '06 #4
I am sorry if I made stupid questions, but I think this is not the way to
reply to a question. But thank you anyway.

--
Simone Busoli
"Karl Seguin" wrote:
I guess it isn't if you don't know what the ASP.NET pipeline is...which a
lot of people wouldn't.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
It's what the documentation says for 1.1 too, but it didn't sound to me
very
clear. I'd be glad if you could explain the reason why it is so clear.

--
Simone Busoli
"Karl Seguin" wrote:
I hope this doesn't sound rude, but the documentation, for 2.0 atleast,
makes this pretty clear:
"The Dispose method performs any final cleanup work prior to removal of
the
module from the execution pipeline."

which would mean it's application-wide.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
> Hello, I am trying to understand when IHttpModule.Dispose method is
> called.
> Is it called when the Application is disposed, or when the request
> ends?
>
> If I want to make an object Application-wide and close it when the
> application ends can I use that method or write something like this in
> the
> class that implements the IHttpModule?
>
> public void Init(HttpApplication application)
> {
> application.Disposed +=new EventHandler(application_Disposed);
> }
>
> private void application_Disposed(object sender, EventArgs e)
> {
> // close my object here
> }
>
> Thanks in advance.
>
> --
> Simone Busoli


Jan 3 '06 #5
No, I'm the one who's sorry. The question wasn't stupid and I was rude. We
typically aren't like this in here..

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
I am sorry if I made stupid questions, but I think this is not the way to
reply to a question. But thank you anyway.

--
Simone Busoli
"Karl Seguin" wrote:
I guess it isn't if you don't know what the ASP.NET pipeline is...which a
lot of people wouldn't.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
> It's what the documentation says for 1.1 too, but it didn't sound to me
> very
> clear. I'd be glad if you could explain the reason why it is so clear.
>
> --
> Simone Busoli
>
>
> "Karl Seguin" wrote:
>
>> I hope this doesn't sound rude, but the documentation, for 2.0
>> atleast,
>> makes this pretty clear:
>> "The Dispose method performs any final cleanup work prior to removal
>> of
>> the
>> module from the execution pipeline."
>>
>> which would mean it's application-wide.
>>
>> Karl
>>
>> --
>> MY ASP.Net tutorials
>> http://www.openmymind.net/
>> http://openmymind.net/redirector.aspx?documentId=51 - Learn about
>> AJAX!
>>
>>
>>
>> "Simone Busoli" <Si**********@discussions.microsoft.com> wrote in
>> message
>> news:62**********************************@microsof t.com...
>> > Hello, I am trying to understand when IHttpModule.Dispose method is
>> > called.
>> > Is it called when the Application is disposed, or when the request
>> > ends?
>> >
>> > If I want to make an object Application-wide and close it when the
>> > application ends can I use that method or write something like this
>> > in
>> > the
>> > class that implements the IHttpModule?
>> >
>> > public void Init(HttpApplication application)
>> > {
>> > application.Disposed +=new EventHandler(application_Disposed);
>> > }
>> >
>> > private void application_Disposed(object sender, EventArgs e)
>> > {
>> > // close my object here
>> > }
>> >
>> > Thanks in advance.
>> >
>> > --
>> > Simone Busoli
>>
>>
>>


Jan 3 '06 #6
It's ok. Anyway trying by myself I found out that using the IHttpModule
Dispose method and an event handler for the Application.Disposed event should
be barely the same. The first occurs right after the second one.

--
Simone Busoli
"Karl Seguin" wrote:
No, I'm the one who's sorry. The question wasn't stupid and I was rude. We
typically aren't like this in here..

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
I am sorry if I made stupid questions, but I think this is not the way to
reply to a question. But thank you anyway.

--
Simone Busoli
"Karl Seguin" wrote:
I guess it isn't if you don't know what the ASP.NET pipeline is...which a
lot of people wouldn't.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Simone Busoli" <Si**********@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
> It's what the documentation says for 1.1 too, but it didn't sound to me
> very
> clear. I'd be glad if you could explain the reason why it is so clear.
>
> --
> Simone Busoli
>
>
> "Karl Seguin" wrote:
>
>> I hope this doesn't sound rude, but the documentation, for 2.0
>> atleast,
>> makes this pretty clear:
>> "The Dispose method performs any final cleanup work prior to removal
>> of
>> the
>> module from the execution pipeline."
>>
>> which would mean it's application-wide.
>>
>> Karl
>>
>> --
>> MY ASP.Net tutorials
>> http://www.openmymind.net/
>> http://openmymind.net/redirector.aspx?documentId=51 - Learn about
>> AJAX!
>>
>>
>>
>> "Simone Busoli" <Si**********@discussions.microsoft.com> wrote in
>> message
>> news:62**********************************@microsof t.com...
>> > Hello, I am trying to understand when IHttpModule.Dispose method is
>> > called.
>> > Is it called when the Application is disposed, or when the request
>> > ends?
>> >
>> > If I want to make an object Application-wide and close it when the
>> > application ends can I use that method or write something like this
>> > in
>> > the
>> > class that implements the IHttpModule?
>> >
>> > public void Init(HttpApplication application)
>> > {
>> > application.Disposed +=new EventHandler(application_Disposed);
>> > }
>> >
>> > private void application_Disposed(object sender, EventArgs e)
>> > {
>> > // close my object here
>> > }
>> >
>> > Thanks in advance.
>> >
>> > --
>> > Simone Busoli
>>
>>
>>


Jan 4 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Cybertof | last post by:
Hi ! I'm wondering about the use of the 'using' statement. In a procedure, should i declare all instance variables in a using clause ? In the below code, what would happen if MyFont & MyFont2...
4
by: Terry | last post by:
There are a number of things about using unmanaged resources in Windows Forms programming that is unclear to me. In C++, if you loaded an icon resource using "ExtractIcon()", the resource was...
3
by: Maxim | last post by:
Hi! According to documenation, if we need to release some umanaged resources manually, we need to implement IDisposable interface with single Dispose method. I am just wondering, what will...
0
by: moid | last post by:
Sir we are implementing front controller in asp.net. we implement three event-handler 1. PreRequestHandlerExecute 2. PostRequestHandlerExecute 3. BeginRequest we just want to initialize...
20
by: Charles Law | last post by:
I have an application that creates a class. The class has unmanaged resources, so must end gracefully. How can I guarantee that the unmanaged resources are freed? I have looked at IDisposable,...
156
by: Dennis | last post by:
Ok, I'm trying to dispose of every object that I create that has a dispose method based on advice from this newsgroup. However, I'm not sure how to dispose of the following object that was created...
46
by: clintonG | last post by:
Documentation tells me how but not when, why or where... <%= Clinton Gallagher http://msdn2.microsoft.com/en-us/library/saxz13w4(VS.80).aspx
44
by: Smokey Grindle | last post by:
I have a list box on my form, but I need to databind it to a data table that is a private member of the form's class... so I basically have Public Class MyForm priate m_MyTable as new datatable...
0
by: Jonathan Wood | last post by:
Greetings, So, I now have a custom IHttpModule class that I use to establish the Theme for each page, based on the user's settings. Seems to work just fine. Thanks to everyone who made helpful...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.