I have a form at which I use ckeditor. This form worked fine at Asp.Net 2.0 and 3.5 but now it doesn't work in Asp.Net 4+. I have ValidateRequest="false" directive. Any suggestions?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
- How to dynamically load partial view Via jquery aj
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
- Add to htmlAttributes for custom ActionLink helper
I know this is an old question, but if you encounter this problem in MVC 3 then you can decorate your
ActionMethod
with[ValidateInput(false)]
and just switch off request validation for a singleActionMethod
, which is handy. And you don't need to make any changes to theweb.config
file, so you can still use the .NET 4 request validation everywhere else.e.g.
This works without changing the validation mode.
You have to use a
System.Web.Helpers.Validation.Unvalidated
helper fromSystem.Web.WebPages.dll
. It is going to return aUnvalidatedRequestValues
object which allows to access the form and QueryString without validation.For example,
Works for me for MVC3 and .NET 4.
Note that another approach is to keep with the 4.0 validation behaviour, but to define your own class that derives from
RequestValidator
and set:(where
YourNamespace.YourValidator
is well, you should be able to guess...)This way you keep the advantages of 4.0s behaviour (specifically, that the validation happens earlier in the processing), while also allowing the requests you need to let through, through.
Found solution at the error page. Just needed to add requestValidationMode="2.0"
MSDN information: HttpRuntimeSection.RequestValidationMode Property
There is a way to turn the validation back to 2.0 for one page. Just add the below code to your web.config: