heavyd heavyd - 1 year ago 130
C# Question

How can I access unvalidated items in the Request.Form collection in MVC 3

I am using ASP.NET MVC 3 with .NET 4.0. I have a model on which one of the properties requires that HTML content be allowed. I have placed the

attribute on my model property which allows HTML on that property. That works by itself.

I am also using the Uploadify flash uploader on other parts of my website. Due to problems with flash and sessions, I'm using some code similar to the code in a swfupload example to allow my file upload access to session data. Basically I'm accessing the
collection directly in the

The problem I'm running into is that when the form that allows HTML is posed I get a
when the code in the
handler access the

Like I said in the beginning, I've tried the
attribute. I've also tried disabling validation at the action and controller level using the
attribute, but I believe I'm too early in the request life cycle for those to apply. Is there anyway to access the
collection containing "potentially dangerous" data without disabling request validation for the entire site?

Answer Source

You asking about something like this: Validate request with Request.Unvalidated() in ASP MVC 3 RC and .NET 4 ?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download