A
A
Alexey Lebedev2015-10-21 11:38:31
ASP.NET
Alexey Lebedev, 2015-10-21 11:38:31

How does IsReusable work in IHttpHandler(ashx) in ASP.NET?

public bool IsReusable
      {
         get { return false; }
      }

I have a handler that handles post requests by URL.
Different users send different requests.
But sometimes users send the same requests, but the response and actions must be different, and in order not to use the previous data, I need to return false?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aram Aramyan, 2015-10-21
@swanrnd

IsReusable just means that the same instance can be used, not the result.
If your handler has a state (i.e. you save some data in its properties), only then you need to set false.
If (and in most cases this is the case) you have all the code in the ProcessRequest method and nothing is saved to the properties / fields of the handler itself, then leave true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question