更新时间:2023-02-15 23:16:31
简单的路由,例如您只想访问现有文件名而无需扩展名的简单路由,默认情况下在 Web Pages 站点中有效.2 可在 UrlData 集合中访问.
Simple routes like the one where you just want to reach an existing file name without the extension work by default in a Web Pages site. The 2 is accessible in the UrlData collection.
这是一篇解释基本路由系统在网页中的工作原理的文章:http://www.mikesdotnetting.com/Article/165/WebMatrix-URLs-UrlData-and-Routing-for-SEO
Here's an article that explains how the rudimentary routing system works in Web Pages: http://www.mikesdotnetting.com/Article/165/WebMatrix-URLs-UrlData-and-Routing-for-SEO
如果要映射与磁盘上文件不匹配的 url,可以使用 Nuget 包 (http://www.nuget.org/packages/WebPageRouteHandler/).它有点复杂,但我也写了一篇关于如何使用它的文章:http://www.mikesdotnetting.com/Article/187/More-Flexible-Routing-For-ASP.NET-Web-Pages
If you want to map a url that doesn't match a file on disk, you can use a Nuget package (http://www.nuget.org/packages/WebPageRouteHandler/). It's a bit more complicated, but I have written an article about how to use that too: http://www.mikesdotnetting.com/Article/187/More-Flexible-Routing-For-ASP.NET-Web-Pages