Donate

HTTP Error 500.23 - Internal Server Error. An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. (ASP.NET MVC HttpHandler)

Good day!
I was trying to apply integrate an Image HttpHandler that discourages leeching from one of my Web Forms project to ASP.NET MVC. This hack is found on ASP.NET 2.0 MVP Hacks site. Upon running the ASP.NET MVC project, an issue was thrown to the browser specifically "HTTP Error 500.23 - Internal Server Error. An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode." Upon investigating, I found out that handlers in WebForms are declared in <httpHandlers> under <system.web>.
<system.web>
 <httpHandlers>
  <add verb="*" path="*.jpg" type="Events.Web.Extensions.NoLeechImageHandler"/>
  <add verb="*" path="*.jpeg" type="Events.Web.Extensions.NoLeechImageHandler"/>
  <add verb="*" path="*.gif" type="Events.Web.Extensions.NoLeechImageHandler"/>
  <add verb="*" path="*.png" type="Events.Web.Extensions.NoLeechImageHandler"/>
 </httpHandlers>
</system.web> 
And handlers in MVC are set inside the <handlers> node belonging to <system.webServer>.
<system.webServer>
 <handlers>
   <add name="jpgHandler" verb="*" path="*.jpg" type="Events.Web.Extensions.NoLeechImageHandler"/>
   <add name="jpegHandler" verb="*" path="*.jpeg" type="Events.Web.Extensions.NoLeechImageHandler"/>
   <add name="gifHandler" verb="*" path="*.gif" type="Events.Web.Extensions.NoLeechImageHandler"/>
   <add name="pngHandler" verb="*" path="*.png" type="Events.Web.Extensions.NoLeechImageHandler"/>
 </handlers>
</system.webServer>
That fixed the issue for ASP.NET MVC.

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.