12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Web.Routing;
- using EMIS.Utility;
- namespace EMIS.Web
- {
- public class RouteConfig
- {
- public static void RegisterRoutes(RouteCollection routes)
- {
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
- routes.IgnoreRoute("{resource}.zip/{*pathInfo}");
- routes.IgnoreRoute("{resource}.rar/{*pathInfo}");
- routes.IgnoreRoute("{resource}.7z/{*pathInfo}");
- routes.IgnoreRoute("{resource}.xls/{*pathInfo}");
- //routes.MapRoute(
- // name: "Default",
- // url: "{controller}/{action}/{id}",
- // defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
- //);
- //string[] routesArr = new string[]{
- // "CalendarManage","EvaluationManage"
- //};
- //foreach (string name in routesArr)
- //{
- // routes.MapRoute(
- // name, // 路由名称
- // name + "/{controller}/{action}/{id}", // 带有参数的 URL
- // new { controller = "Menu", action = "Index", id = UrlParameter.Optional }, // 参数默认值
- // namespaces: new string[] { "EMIS.Web.Controllers." + name }
- // );
- //}
- if (!string.IsNullOrEmpty(Const.LOCAL_SETTING_LOGIN_ACTION))
- {
- if (Const.LOCAL_SETTING_LOGIN_ACTION.ToLower() != "login")
- {
- routes.RouteExistingFiles = false;
- routes.MapRoute(
- "Login",
- "Account/Login/{id}",
- new { controller = "Account", action = Const.LOCAL_SETTING_LOGIN_ACTION, id = UrlParameter.Optional }
- );
- }
- }
- routes.MapRoute(
- "HTMLDefault", // Route name
- "{controller}/List.html", // URL with parameters
- new { controller = "Home", action = "List" } // Parameter defaults
- );
- //默认的路径解析
- routes.MapRoute(
- "Default", // 路由名称
- "{controller}/{action}/{id}", // 带有参数的 URL
- new { controller = "Home", action = "Index", id = UrlParameter.Optional } // 参数默认值
- );
- //aspx路径解析
- routes.IgnoreRoute(
- "ReportViewer/{webform}"
- );
- //WCF路径解析
- routes.IgnoreRoute(
- "Services/{service}"
- );
- }
- }
- }
|