如何将C#.netMapRoute数据导出为HTML文件?

2026-06-11 11:323阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计274个文字,预计阅读时间需要2分钟。

如何将C#.netMapRoute数据导出为HTML文件?

1. ASP.NET 路由映射器可以将请求路由到文件或控制器。路由映射器可路由至文件或控制器。示例:尝试这个例子:1 The ASP.NET route mapper can route to files or controllers. 示例:1 ASP.NET 路由映射器可路由至文件或控制器。

1TheASP.NETroutemappercanroutetofilesorcontrollers.ASP.NET路由映射器可以路由到文件或控制器。Trythisexample:

1

The ASP.NET route mapper can route to files or controllers.

ASP.NET路由映射器可以路由到文件或控制器。

Try this example: (you will need to rename your .html file to .aspx, but you dont have to make any other changes to it.)

試試這個例子:(您需要將.html文件重命名為.aspx但不必對其進行任何其他更改。)

In your route config file:

在您的路由配置文件中

public class RouteConfig

{

public static void RegisterRoutes(RouteCollection routes)

{

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

// route default URL to index.aspx

如何将C#.netMapRoute数据导出为HTML文件?

routes.MapPageRoute(

routeName: "DefaultToHTML",

routeUrl: "",

physicalFile: "~/index.aspx",

checkPhysicalUrlAccess: false,

defaults: new RouteValueDictionary(),

constraints: new RouteValueDictionary { { "placeholder", ""} }

);

// other routes go here...

routes.MapRoute(

name: "Default",

url: "{controller}/{action}/{id}",

defaults: new { controller "Home", action "Index", id UrlParameter.Optional }

);

}

}

本文共计274个文字,预计阅读时间需要2分钟。

如何将C#.netMapRoute数据导出为HTML文件?

1. ASP.NET 路由映射器可以将请求路由到文件或控制器。路由映射器可路由至文件或控制器。示例:尝试这个例子:1 The ASP.NET route mapper can route to files or controllers. 示例:1 ASP.NET 路由映射器可路由至文件或控制器。

1TheASP.NETroutemappercanroutetofilesorcontrollers.ASP.NET路由映射器可以路由到文件或控制器。Trythisexample:

1

The ASP.NET route mapper can route to files or controllers.

ASP.NET路由映射器可以路由到文件或控制器。

Try this example: (you will need to rename your .html file to .aspx, but you dont have to make any other changes to it.)

試試這個例子:(您需要將.html文件重命名為.aspx但不必對其進行任何其他更改。)

In your route config file:

在您的路由配置文件中

public class RouteConfig

{

public static void RegisterRoutes(RouteCollection routes)

{

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

// route default URL to index.aspx

如何将C#.netMapRoute数据导出为HTML文件?

routes.MapPageRoute(

routeName: "DefaultToHTML",

routeUrl: "",

physicalFile: "~/index.aspx",

checkPhysicalUrlAccess: false,

defaults: new RouteValueDictionary(),

constraints: new RouteValueDictionary { { "placeholder", ""} }

);

// other routes go here...

routes.MapRoute(

name: "Default",

url: "{controller}/{action}/{id}",

defaults: new { controller "Home", action "Index", id UrlParameter.Optional }

);

}

}