我的 Global.asax 文件中有这段代码:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
RegisterRoute(RouteTable.Routes)
End Sub
'about.aspx
Sub RegisterRoute(ByVal _routes As RouteCollection)
With _routes
.MapPageRoute("homepage", "Home", "~/default.aspx")
.MapPageRoute("aboutpage", "About", "~/about.aspx")
.MapPageRoute("producs", "Products", "~/products/Default.aspx")
.MapPageRoute("adFin", "Products/{name}", "~/products/Default.aspx")
.MapPageRoute("news", "News", "~/news.aspx")
.MapPageRoute("contact", "Contact", "~/contact.aspx")
End With
End Sub
每当我导航到 Product/Myproductname 时,它都可以正常工作,但是如果我导航回主页,则 url 仍然显示为 Product/Home 而不是 Home