Http Handlers

S

shapper

Hello,

I have been using Http handlers and I have two questions:

1. What does Property IsReusable really does and when should I use it?

2. And why should I add an httpHandler to my Web.Config?

<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="handler.aspx"
type="HandlerExample.MyHttpHandler, HandlerTest"/>
</httpHandlers>
</system.web>
</configuration>

I am asking this because I got all this working without using 1 or
2.

Thank You,

Miguel
 
R

rhossi

shapper said:
Hello,

I have been using Http handlers and I have two questions:
2. And why should I add an httpHandler to my Web.Config?

<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="handler.aspx"
type="HandlerExample.MyHttpHandler, HandlerTest"/>
</httpHandlers>
</system.web>
</configuration>

I am asking this because I got all this working without using 1 or
2.

Thank You,

Miguel
1. What does Property IsReusable really does and when should I use it?
The IsReusable property lets ASP.NET know if it can reuse an instance
of an HttpHandler or if it needs to re-create it from scratch each
time.
2. And why should I add an httpHandler to my Web.Config?

As far as I know and according to MSDN Documentation "After you have
created a custom HTTP handler class, you must register it in the
Web.config file. This allows ASP.NET to call the handler to service
requests made to resources with the file name extension that you want
the HTTP handler to process."
Either way, you still need to have the handlers registered.
So, there is something really strange in here. Are you sure you're
running the handler you created ? Have you debugged it ?

HTH
Felipe Garcia
 
S

shapper

If you mean running the handler putting the address
"http://www.mydomain.com/MyHandler.ashx" so yes.

I did that and it works fine. I get the result I expect which is a XML
file displayed on my browser.

If run means running the handler from my VB / C# then I did not tried
it because I don't know why but I would like to know. :)

Thanks,
Miguel
 
K

Karl Seguin [MVP]

Just to add to Felipe's reply...

You can return true from IsReusable f you aren't disposing or closing any
resources which need to be open to handle requests.

As for adding it to the web.config, I don't see how that can work WITHOUT
adding it...strange...

Karl
 

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,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top