我把[AttributeRouting.Web.Mvc.Route("faq.html")]放在我的动作常见问题中。
但是,当我转到
localhost/faq.html 我得到一个404 http not find错误,并且我无法在localhost/routes.axd中找到我的自定义路由。
我该如何解决这个问题呢?
谢谢!
更新:以下是我的常见问题解答操作
[OutputCache(Duration = 120)]
[AttributeRouting.Web.Mvc.Route("faq.html")]
public virtual ActionResult FAQ(int id = 0){
//some code here
}发布于 2012-07-04 22:08:56
尝试下面的代码:
[OutputCache(Duration = 120)]
[AttributeRouting.Web.Mvc.Route("faq.html/{id?}")]
public virtual ActionResult FAQ(int id = 0){
//some code here
}或者从FAQ方法中移除id参数。
https://stackoverflow.com/questions/10646580
复制相似问题