Web.config HttpHandler pain
I've got a .net 3.5 website I've got two types of page, ones that create images and ones that display Html via a in-house framework.
I've got a handler that deals with that in-house framework. It works and does a bunch of logging, its called SMS.OutputReporting.Handler
the two images pages are normal aspx pages with .Net System.Web.UI.Page inheritance.
This currently works
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET, POST" path="NormalPage1.aspx" type="SMS.OutputReporting.Handler, SMS.OutputReporting"/>
<add verb="GET, POST" path="NormalPage2.aspx" type="SMS.OutputReporting.Handler, SMS.OutputReporting"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Cul开发者_JAVA技巧ture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
This points to the inhouse handler for NormalPage1 and NormalPage2 and continues on its way for the 2 image pages. image1.aspx and image2.aspx So the default is to do the image pages and exceptions of NormalPage1 and NormalPage2 to the handler.
I want the otherway around (as ther ewill be more NormalPages coming), I want it to default to the custom handler and the two exceptions of the image pages to go to the standard .Net handler. How do I do this? How do I declare the normal .Net handler?
I cant see the definition for normal .aspx pages to a .Net handler anywhere.
Hope that makes sense
Have you tried giving your pages that use your handler their own extension? Something like
<add verb="*" path="*.smsx" type="SMS.OutputReporting.Handler,..." />
Then just use that extension for all your pages and aspx for your standard ones. It makes sense, that if your pages have their own handler, then in a sense they aren't really aspx pages.
Just a thought, I've never tried this idea myself.
精彩评论