2

我需要帮助将其转换为 vb.net...

routes.IgnoreRoute("{*allaspx}", new {allaspx=@".*\.aspx(/.*)?"});
routes.IgnoreRoute("{*robotstxt}", new {robotstxt=@"(.*/)?robots.txt(/.*)?"});

任何想法?

4

2 回答 2

0

这个怎么样?

routes.IgnoreRoute("{*allaspx}", New With {.allaspx = ".*\.aspx(/.*)?"})
routes.IgnoreRoute("{*robotstxt}", New With {.robotstxt = "(.*/)?robots.txt(/.*)?"})
于 2013-02-12T10:43:50.160 回答
0

你需要导入System.Web.Mvc

这是我在 VB.NET ASP.net Web-Forms 应用程序中使用的(使用 mvc5)

Imports System.Web.Mvc

Public Module RouteConfig
    Public Sub RegisterRoutes(ByVal routes As RouteCollection)
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}")

        ' keep default.aspx for empty url
        routes.IgnoreRoute("")

        routes.MapRoute(
            name:="Default",
            url:="{controller}/{action}/{id}",
            defaults:=New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional}
        )
    End Sub
End Module
于 2019-02-26T12:12:22.533 回答