Groups > Asp .Net > HttpHandlers and HttpModules > Re: Custom web.config attribute for handler




Custom web.config attribute for handler

Custom web.config attribute for handler
Fri, 28 Mar 2008 11:59:46 +000
Hello!

I have created a custom handler that serves files from database. Handler also
contains UseCaching property. (Simple boolean true or false)

I want to expose this property to attribute, so it can be configured in
web.config in the same tag as I add the handler.

Example: 

<addverb="*"path="*.asfx"type="ASP.FilesModule.HtmlR
esponseWriter, ASP.FilesModule"UseCaching="false" />

Is this possible? 

How to implement it? 

Thank you!
Post Reply
Re: Custom web.config attribute for handler
Wed, 2 Apr 2008 11:17:14 +0000
Hi boryto,

The attribute will cause parsing error of the web.config file. By default,
ASP.NET doesn't aware of this attribute. You can have a separate configuration
file for HtmlResponseWriter which can be read by the HtmlResponseWriter.

Another way you can have custom section in web.config file:

http://aspnet.4guysfromrolla.com/articles/032807-1.aspx
Post Reply
Re: Custom web.config attribute for handler
Wed, 2 Apr 2008 15:14:01 +0000
Thank you Zhao,

looks like my whish will  not come true
Post Reply
Re: Custom web.config attribute for handler
Thu, 3 Apr 2008 10:54:24 +0000
Hi boryto, 

That is possible too. You can have custom section handler to parse the section
but you need to implement one and replace the default section. I think it is too
much work for just a custom setting.
Post Reply
about | contact