C# ASPX - 404 error when HTML is passed to a dynamic page.
Posted on 2010-11-13
IIS 7: I'm trying not to touch the Machine config file if I don't have to for this, but if that is the only way...
In my site (.NET 4.0, C#, ASP.NET, IIS7) I only have a single page called dynamic.aspx. I presently have the 404 error redirected to it:
<customErrors mode="On" redirectMode="ResponseRewrite" >
<error statusCode="404" redirect="dynamic.aspx" />
My site successfully reads the attempted page, and looks up the content in a DB to display.
Forms work normally, I can login, I can edit content through form editor, BUT when I include HTML content, like a BR or HR tag, or any HTML code, I get a 404 error.
I don't want to change the IIS configuration, because I would like to run this on a shared hosting server, instead of having to pay for something more dedicated. (if needed, it can be done, but I really want a cheaper solution)
I believe that IIS has a protection in place for blocking HTML code submitted through forms. And when that protection is fired, it is no longer using the Web.Config's 404 information.