0

请问有人对此有什么建议吗?Mvc3 不会从以下返回我的路由 url。我做了一些非常相似的事情并且它有效。这两条路线都不会因任何可选参数或任何东西而变得复杂,它真的非常简单。到底是怎么回事?

这是在我的 global.asax.cs 中...

routes.Add("StateProductRoute", 
    new Route("{state}"+locationUrlLiteralPart+"/{productName}-{productType}", 
        new CustomUrlRouteHandler(CustomUrlRouteHandlerUsageType.Product))
        {
            Constraints = new RouteValueDictionary
            {
                { "constraint1", new ProductConstraint() }
            } 
        });

……这在我看来……

<a href="@Url.RouteUrl("StateProductRoute", 
    new { state="archer", productName="hello", productType="goodbye"})" 
    class="media">
4

1 回答 1

-1

是否缺少破折号?

new Route("{state}**-**"+locationUrlLiteralPart+"/{productName}-{productType}", 
于 2012-07-24T05:40:55.927 回答