随笔分类 -  asp.net mvc

asp.net mvc重写RequestValidator
摘要:/// /// /// public class CustomRequestValidator : RequestValidator { public readonly static object CustomRequestValidatorKey =... 阅读全文

posted @ 2016-01-20 17:21 木龙哥 阅读(510) 评论(0) 推荐(0)

asp.net mvc 客户端(&)中检测到有潜在危险的 Request.Path 值。
摘要:出现这个错误后,试过[ValidateInput(false)]都不ok,经测试只用以下配置就ok了MSDN解释:在请求路径中无效的字符的列表以逗号分隔)。以下列表包含默认的无效字符集:,*,%,&,:,\ 阅读全文

posted @ 2014-07-08 19:49 木龙哥 阅读(1595) 评论(0) 推荐(1)

Web Api Route 注册要放在 Mvc Route 注册前
摘要:今天想研究一下Web Api,写了一个测试Api,打开网站后浏览一下,可是却提示找不到方法,刚开始以为哪里配置错了,可找了半天也没见。因为我是在一个现有Mvc站点做的Demo,所以打算新建一个Mvc网站,再试一下,新站点是正常的,对比一下Global文件,发现WebApiConfig和RouteCo... 阅读全文

posted @ 2014-05-05 23:35 木龙哥 阅读(2345) 评论(1) 推荐(1)

asp.net mvc 不找其他view模板,只找cshtml
摘要:asp.net mvc 默认找view文件时,依次找后辍名为aspx、ascx、cshtml、vbhtml的view文件。但是项目住住用C#+Razor开发,这样找,岂不有性能损失。添加以下代码: ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine() { AreaViewLocationFormats = new string[] { "~/Areas/{2}/Views/{1}/{0}.cshtml", "~/Areas/{2}/Views/Shared... 阅读全文

posted @ 2014-04-10 09:56 木龙哥 阅读(2516) 评论(9) 推荐(1)

导航