都说在Global注册,public static void RegisterGlobalFilters(GlobalFilterCollection filters){} 但是,GlobalFilterCollection根本找不到这个类呀,是MVC3以后才有这个类吗?mvc全局过滤器
解决方案 »
- ZedGraph 中清除或添加折线图中某条折线
- asp.net中在ashx文件里获得客户端上传的完整路径问题
- 散分,求解...asp.net网站响应速度很长时间
- 在itemtemplate里面加上有样式的分行大字体内容全挤一块去了!
- updatepanel乱码问题真的没法解决吗??
- 求救:办公信息平台系统?
- 页面传值问题
- 怎么使点“编辑”按钮时textbox及button排成如http://www.tedit.net/TEditNorthwind/Toolbar.aspx的版式??
- ++奇怪,我安装的简体中文版VS Studio .NET 2003,为什么MSDN library的内容却是英文的?(有两张MSDN是从网上下的)都是这样吗?
- ASP中如何调出用户的调试环境
- 初学。NET问:怎么在.net中加入flash
- Google的搜索技术是P2P(云计算)做的吗?
protected override void OnException(ExceptionContext filterContext)
{
// 执行基类中的OnException
base.OnException(filterContext);
}//崩溃型错误
public ActionResult Index()
{
return View();
} //找不到页面
public ActionResult NotFound()
{
return View();
} //错误信息提示
public ActionResult Message(string msg)
{
ViewData["ErrorMessage"] = msg;
return View();
}然后在web.config里设置相应的错误指向的action就可以了吧。
<customErrors mode="On" defaultRedirect="/Error/Index">
<error redirect="/Error/NotFound" statusCode="404"/>
</customErrors>