コード例 #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            string channelsarray = LocalData.ChannelsArray();
            string channels      = LocalData.ChannelsName();

            string[] channelsArray = channelsarray.Split('/');
            MPChannels.Init(channelsArray);
        }
コード例 #2
0
        protected void Application_Error(object sender, EventArgs e)
        {
            HttpContext ctx = HttpContext.Current;
            Exception   ex  = ctx.Server.GetLastError();

            ctx.Response.Clear();

            RequestContext rc = ((MvcHandler)ctx.CurrentHandler).RequestContext;


            var httpException = ex as HttpException;

            if (httpException != null)
            {
                int ec = httpException.GetHttpCode();
                switch (ec)
                {
                case 404:
                    string     smsg  = string.Format("Invalid url ({0})", ec, Request.Url);
                    CUdpSender clUDp = new CUdpSender(LocalData.Host(), LocalData.Port(), LocalData.LogPath());
                    clUDp.Send(LocalData.Facility(), LocalData.TagId(), "UWA103", smsg);
                    break;


                default:

                    break;
                }
            }
            //  else
            //  {
            //      string smsg = string.Format("{0}", httpException.Message);
            //      CUdpSender clUDp = new CUdpSender(LocalData.UPDEndPoint(), LocalData.LogPath());
            //      clUDp.Send(LocalData.UDPFacility(), LocalData.UDPSeverity(), LocalData.UDPHost(), LocalData.UDPTag(),
            //          LocalData.UDPIdMsg(), smsg);
            //  }
        }