What is significance of IsReusable property in IHttpHandler Interface

A

Angrez Singh

Hi,

If you just want to implement your own HttpHandler using the
IHttpHandler interface you have to implement a function and a property
of the interface. The function ProcessRequest() is used to implement
your own custom request handler which returns the response according to
your code.

Now what is the significance of the property isReusable() which returns
true or false? I searched a lot but didn't found enough information on
this.

Also, i wanted to know that what should be the semantics of the request
for which we can set this property to return true? and in what scenario
it should be set to false?

Thanks in advance,

Regards,
Angrez
 
B

Brock Allen

IsReusable is for pooling of the handler objects. So if your handler is not
holding any request specific state then you can return true to ask that it
be pooled. This is typically done when your handler does very expensive initialization,
otherwise it probabaly doesn't matter if you return true or false (since
simple object allocation is fairly inexpensive in .NET). Pages are never
pooled, BTW.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top