我必须在某处配置错误。
我从这个页面开始:
http://localhost:58982/Game/Score
...然后点击此链接:
<a href="/Game/Score/1">Round 1</a>
...解析为此网址
http://localhost:58982/Game/Score#/Game/Score/1
浏览器不刷新,它将我的链接添加到结尾。 我做错了什么?
VB.NET RAZR - 两个链接产生相同的结果
@Html.RouteLink("Round 1", New With {.id = 1})
@Html.ActionLink("Round 1", "Score", New With {.id = 1})
这是我的GameController中的代码
<NoCache()> _
Function Score(Optional ByVal id As Integer = Nothing) As ActionResult
If id = 0 Then id = 1
Dim games = (From q In db.Games Where q.RoundId = id)
Dim rounds = (From q In db.Games Where q.OccasionId = _OccasionId Select q.RoundId).Distinct
ViewBag.Round = id
ViewBag.Rounds = rounds
ViewBag.SessionTeam = SessionTeam
Return View(games)
End Function
以下是我的路线配置方式:
Public Class RouteConfig
Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute( _
name:="Default", _
url:="{controller}/{action}/{id}", _
defaults:=New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional} _
)
End Sub
End Class
Public Class WebApiConfig
Public Shared Sub Register(ByVal config As HttpConfiguration)
config.Routes.MapHttpRoute( _
name:="DefaultApi", _
routeTemplate:="api/{controller}/{id}", _
defaults:=New With {.id = RouteParameter.Optional} _
)
End Sub
End Class
感谢您的帮助