Add HttpHandler in code

  • Thread starter Thread starter Daniel Danilin
  • Start date Start date
set the target to null or unchain it using the -= syntax. setting to null
removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
 
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't want
to use web.config


Alvin Bruney said:
set the target to null or unchain it using the -= syntax. setting to null
removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
How can I add/remove an HttpHandler in code (not in web.config)?
 
I may be wrong but I don't think this is possible. Handlers are responsible
for servicing the request, i'm not sure how you can adjust this on the fly
and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't
want to use web.config


Alvin Bruney said:
set the target to null or unchain it using the -= syntax. setting to null
removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
How can I add/remove an HttpHandler in code (not in web.config)?
 
why not? If I change httpHandlers in web.config they will be change on the
fly. Or am I wrong?

Alvin Bruney said:
I may be wrong but I don't think this is possible. Handlers are responsible
for servicing the request, i'm not sure how you can adjust this on the fly
and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't
want to use web.config


Alvin Bruney said:
set the target to null or unchain it using the -= syntax. setting to
null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


How can I add/remove an HttpHandler in code (not in web.config)?
 
Yes, any modifications to web.config are picked up on the next request. Beware
that to make this happen, ASP.NET restartes your application (AppDomain)
and thus any in memory state will be lost (think InProc SessionState, Application
state and static/shared vairables).

-Brock
DevelopMentor
http://staff.develop.com/ballen


why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can
adjust this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>
but in code. I'm hosting ASP.NET in my program, not in IIS, and I
don't want to use web.config

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im
Newsbeitrag
set the target to null or unchain it using the -= syntax. setting
to null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________

How can I add/remove an HttpHandler in code (not in web.config)?
 
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered httphandler.
I suppose you can always use an xml parser object to write to the web config
file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
why not? If I change httpHandlers in web.config they will be change on the
fly. Or am I wrong?

Alvin Bruney said:
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can adjust
this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't
want to use web.config


"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
set the target to null or unchain it using the -= syntax. setting to
null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


How can I add/remove an HttpHandler in code (not in web.config)?
 
The problem is, that Cassini server not uses web.config (or not always). So
I need to add httpHandlers in code.
I don't want that client can change config file

Alvin Bruney said:
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered
httphandler. I suppose you can always use an xml parser object to write to
the web config file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

Alvin Bruney said:
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can adjust
this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't
want to use web.config


"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
set the target to null or unchain it using the -= syntax. setting to
null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


How can I add/remove an HttpHandler in code (not in web.config)?
 
No, the client won't change the config file. The server side code would
change it. I'll note that this is a hack and probably will result in
unmaintenable code.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
The problem is, that Cassini server not uses web.config (or not always).
So I need to add httpHandlers in code.
I don't want that client can change config file

Alvin Bruney said:
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered
httphandler. I suppose you can always use an xml parser object to write
to the web config file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can adjust
this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I
don't want to use web.config


"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
set the target to null or unchain it using the -= syntax. setting to
null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


How can I add/remove an HttpHandler in code (not in web.config)?
 
I'm writing P2P using Web Services. So I can't use IIS and any config files.

Alvin Bruney said:
No, the client won't change the config file. The server side code would
change it. I'll note that this is a hack and probably will result in
unmaintenable code.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
The problem is, that Cassini server not uses web.config (or not always).
So I need to add httpHandlers in code.
I don't want that client can change config file

Alvin Bruney said:
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered
httphandler. I suppose you can always use an xml parser object to write
to the web config file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can adjust
this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I
don't want to use web.config


"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im
Newsbeitrag set the target to null or unchain it using the -= syntax. setting to
null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


How can I add/remove an HttpHandler in code (not in web.config)?
 
I have found a method to add HttpHandler within a code

Daniel Danilin said:
I'm writing P2P using Web Services. So I can't use IIS and any config
files.

Alvin Bruney said:
No, the client won't change the config file. The server side code would
change it. I'll note that this is a hack and probably will result in
unmaintenable code.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Daniel Danilin said:
The problem is, that Cassini server not uses web.config (or not always).
So I need to add httpHandlers in code.
I don't want that client can change config file

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered
httphandler. I suppose you can always use an xml parser object to write
to the web config file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can adjust
this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I
don't want to use web.config


"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im
Newsbeitrag set the target to null or unchain it using the -= syntax. setting
to null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


How can I add/remove an HttpHandler in code (not in web.config)?
 
Back
Top