using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; namespace M55128_rec { public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); } protected void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLastError(); if (ex is HttpException && ((HttpException)ex).GetHttpCode() == 404) { Response.Redirect("/404"); } } //protected void Application_BeginRequest(object sender, EventArgs e) //{ // string oldUrl = System.Web.HttpContext.Current.Request.RawUrl; // oldUrl= oldUrl.Replace(".html",""); // //var ary = oldUrl.Split('?'); // //if (ary.Length > 0) // //{ // // ary[0] = ary[0] + ".html"; // //} // //string str = string.Join("?", ary); // Context.RewritePath(oldUrl); // //if (HttpContext.Current.Request.UserHostAddress == "192.168.1.102") // //{ // // HttpContext.Current.Response.Write("这里就可以把自己电脑的IP地址屏蔽掉了。"); // //} // //else // //{ // // HttpContext.Current.Response.Write(""); // //} //} } }