我需要帮助将其转换为vb.net ...
routes.IgnoreRoute("{*allaspx}", new {allaspx=@".*\.aspx(/.*)?"});
routes.IgnoreRoute("{*robotstxt}", new {robotstxt=@"(.*/)?robots.txt(/.*)?"});
有什么想法吗?
答案 0 :(得分:0)
这个怎么样?
routes.IgnoreRoute("{*allaspx}", New With {.allaspx = ".*\.aspx(/.*)?"})
routes.IgnoreRoute("{*robotstxt}", New With {.robotstxt = "(.*/)?robots.txt(/.*)?"})
答案 1 :(得分:0)
您需要导入System.Web.Mvc
这是我在VB.NET ASP.net Web窗体应用程序(带有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