Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I access unvalidated items in the Request.Form collection in MVC 3
    primarykey
    data
    text
    <p>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 <code>AllowHtml</code> attribute on my model property which allows HTML on that property. That works by itself. </p> <p>I am also using the <a href="http://www.uploadify.com/" rel="nofollow">Uploadify</a> flash uploader on other parts of my website. Due to <a href="http://www.uploadify.com/documentation/uploadify/using-sessions-with-uploadify/" rel="nofollow">problems</a> with flash and sessions, I'm using some code similar to the code in a <a href="http://code.google.com/p/swfupload/source/browse/swfupload/trunk/samples/samples/asp.net/Global.cs.asax" rel="nofollow">swfupload example</a> to allow my file upload access to session data. Basically I'm accessing the <code>Request.Form</code> collection directly in the <code>Application_BeginRequest</code> handler.</p> <p>The problem I'm running into is that when the form that allows HTML is posed I get a <code>HttpRequestValidationException</code> when the code in the <code>Application_BeginRequest</code> handler access the <code>Request.Forms[key]</code> collection.</p> <p>Like I said in the beginning, I've tried the <code>AllowHtml</code> attribute. I've also tried disabling validation at the action and controller level using the <code>ValidateInput(false)</code> attribute, but I believe I'm too early in the request life cycle for those to apply. Is there anyway to access the <code>Request.Form</code> collection containing "potentially dangerous" data without disabling request validation for the entire site?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload