蓝色动力网络

 找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 1794|回复: 2

[求助] 远古VOD点播能装在win7或2008上吗

[复制链接]
发表于 2013-11-29 02:14:27 | 显示全部楼层 |阅读模式
我试了win7 老是错误 无法访问网络位置
 楼主| 发表于 2013-11-29 02:26:11 | 显示全部楼层
MVC TIP4:为捕获路由及通用异常处理
Tags: 捕获路由 异常处理 mvc
1:首先,准备控制器




123456789101112131415161718192021222324252627 public class ErrorController : Controller
{
        public ActionResult Index(string error)
        {
            ViewData["Title"] = "WebSite 网站内部错误";
            ViewData["Description"] = error;
            return View("Index");   //全部路由到Error下的Index视图
        }
        public ActionResult HttpError404(string error)
        {
            ViewData["Title"] = "HTTP 404- 无法找到文件";
            ViewData["Description"] = error;
            return View("Index");
        }
        public ActionResult HttpError500(string error)
        {
            ViewData["Title"] = "HTTP 500 - 内部服务器错误";
            ViewData["Description"] = error;
            return View("Index");
        }
        public ActionResult General(string error)
        {
            ViewData["Title"] = "HTTP 发生错误";
            ViewData["Description"] = error;
            return View("Index");
        }
}




2:Error下的Index视图



代码:






3:在Global.aspx中进行处理

添加如下方法:

1234567891011121314151617181920212223242526272829303132333435363738 protected void Application_Error(object sender, EventArgs e)
        {
            Response.Clear();
            Exception exception = Server.GetLastError();
            HttpException httpException = exception as HttpException;
            RouteData routeData = new RouteData();
            routeData.Values.Add("controller", "Error");
            if (exception == null)
            {
                routeData.Values.Add("action", "Index");
            }
            else if (httpException == null)
            {
                routeData.Values.Add("action", "Index");
            }
            else
            {
                switch (httpException.GetHttpCode())
                {
                    case 404:
                        routeData.Values.Add("action", "HttpError404");
                        break;
                    case 500:
                        routeData.Values.Add("action", "HttpError500");
                        break;
                    default:
                        routeData.Values.Add("action", "General");
                        break;
                }
            }
            // Pass exception details to the target error View.
            routeData.Values.Add("error", exception.Message);
            // Clear the error on server.
            Server.ClearError();
            // Call target Controller and pass the routeData.
            IController errorController = new ErrorController();
            errorController.Execute(new RequestContext(new HttpContextWrapper(Context), routeData));

回复 支持 反对

使用道具 举报

发表于 2013-11-29 13:06:23 | 显示全部楼层
学习当中学习当中学习当中学习当中学习当中学习当中
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

蓝色动力网络微信平台
网站管理,业务合作联系邮箱: admin#lansedongli.com    QQ:13412492 限网站业务问题.
网站帐号、密码、密保找回请使用注册邮箱,发送邮件至 password#lansedongli.com ,否则不予受理.
免责声明:本论坛所有文字和图片仅代表其个人观点.
本站某些资料或文章来自于互联网,不代表本站观点,如果侵犯了您的权益,请来信告知,我们会在三天内删除.
为了给大家一个更好的交流场所,请勿在本论坛发表与中华人民共和国法律相抵触的言论,请合作,谢谢!
Copyright © 2007-2019 Corporation Powered by网吧系统 版权所有    转载请注明!
浙ICP备11043737号 程序:Discuz! x3.4

湘公网安备 43018102000145号

手机版|Archiver|蓝色动力网络   

快速回复 返回顶部 返回列表