find a location for property in a new city

Wednesday, 14 April 2010

Potentially dangerous request .NET4 upgrade

I encountered an error after upgrading to ASP.NET 4 from 3.5 whereby my page was throwing an HttpRequestValidationException error. With error message "A potentially dangerous Request.Form value was detected from the client". This problem DID NOT occur before on this page that uses a TinyMCE rich text editor.

This page is sending dangerous requests since it is using a rich text editor that post HTML. This was worked around before by putting ValidateRequest="false" in the page declaration.

This seems to be ignored now in .NET4! Really I should be changing TinyMCE to be posting BBCode and replacing it with proper HTML on the server... but... I'm not since this is only for trusted internal users... and I can't be bothered ;)

Workaround

requestValidationMode="2.0" needs to be added to the httpRuntime element of the <system.web> section of the web.config.

Follow britishdev on Twitter

5 comments:

  1. That what I was looking for.
    Thx dude !

    ReplyDelete
  2. Cheers mate. Makes it all worth while.

    ReplyDelete
  3. This is my first visit to this site and I am very happy to read your blog post. Awesome blog entry. This is outright enchantment from you! I have never observed a more magnificent post than this one. You've truly filled my heart with joy today with this. I trust you keep this up. I have bookmarked this site. Such Beautiful astonishing site continue posting. I will be related with this blog. Much obliged to you. If you are in search of writing related tips visit site Write my Essay, you can get better writing help from here.

    ReplyDelete
  4. The article explains a common issue encountered when upgrading from ASP.NET 3.5 to .NET 4, where enhanced request validation triggers an HttpRequestValidationException for pages that accept HTML input from controls such as TinyMCE. By describing the underlying cause and providing a practical workaround using the requestValidationMode="2.0" setting in the web.config file, it offers valuable guidance for developers maintaining legacy ASP.NET applications while balancing compatibility and security.

    Protecting web applications begins with implementing secure input validation and properly handling user-supplied data to prevent security vulnerabilities. Understanding request validation, configuration management, and secure coding practices enables developers to build resilient applications that defend against malicious input and common web attacks. Students and professionals interested in strengthening these application security concepts can explore Information Security Projects for Final Year, which provide practical experience in securing modern software systems.

    ReplyDelete
  5. Application security forms a critical part of the broader cybersecurity landscape, where secure configuration, vulnerability mitigation, and defensive programming help protect enterprise applications and sensitive information. Building expertise in cybersecurity enables developers to design systems that remain secure while adapting to evolving technology platforms and threat landscapes. Those looking to expand their practical security knowledge can further explore Cyber Security Projects for Final Year Students, featuring implementation-focused projects across diverse information security domains.

    Readers interested in exploring additional cybersecurity concepts and practical implementation ideas can also refer to Cybersecurity Projects for Final Year Students, which showcases modern security project ideas covering secure application development, vulnerability assessment, and cyber defense techniques.

    ReplyDelete