首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在使用mono和mvc3的amazon-ec2上运行时无法发布html

在使用mono和mvc3的amazon-ec2上运行时无法发布html
EN

Stack Overflow用户
提问于 2011-05-12 06:51:36
回答 2查看 322关注 0票数 0

我有一个网站托管在亚马逊Linux AMI盒运行mono通过lighttpd。在我的网站的管理部分,我有一个表单,让我可以创建博客条目。由于我希望能够存储html,因此我将我的保存控制器操作设置如下:

代码语言:javascript
复制
[Authorize(Roles = "Admin")]
[HttpPost, ValidateInput(false)]
public ActionResult CreateBlog(Blog model) {
    if (ModelState.IsValid) {
        ContextFactory.BlogManager.Save(model);
        return RedirectToAction("Blogs");
    }
    return View(model);
}

一切都在本地正常运行,但当我将代码部署到我们的amazon实例时,我得到了以下异常:

代码语言:javascript
复制
A potentially dangerous Request.Form value was detected from the client (Body=\"asd<br>asdas\").
System.Web.HttpRequestValidationException: A potentially dangerousr> Request.Form value was detected from the client (Body=\"asd<br>asdas\").<br>
 at System.Web.HttpRequest.ThrowValidationException (System.String name, System.String key, System.String value) [0x00000] in <filename unknown>:0 <br>
  at System.Web.HttpRequest.ValidateString (System.String key, System.String value, RequestValidationSource source) [0x00000] in <filename unknown>:0 <br>
  at Microsoft.Web.Infrastructure.DynamicValidationHelper.LazyWebROCollection.Validate (System.String key, System.String value) [0x00000] in <filename unknown>:0 <br>
  at Microsoft.Web.Infrastructure.DynamicValidationHelper.LazyWebROCollection.Get (System.String name) [0x00000] in <filename unknown>:0 <br>
  at System.Collections.Specialized.NameValueCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0 <br>
  at ...

有什么想法吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-05-12 21:04:03

实际上,我可以通过在我的web.config中添加<httpRuntime requestValidationMode="2.0"/>来修复它

票数 2
EN

Stack Overflow用户

发布于 2011-05-12 08:50:42

听起来像是要回发的数据包含<。这是不允许的,以防止可能的脚本注入攻击。Here's a previous question上的这个话题应该能对你有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5971480

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档