[英]How to remove parameters from URL when using T4MVC
Action method looks like 动作方法看起来像
public virtual ActionResult Show(int productId, bool isValid, bool getByStoreId = false)
When I call this action I get url like 当我调用此操作时,我会收到类似
.../Product/Show/221?isValid=True&getByStoreId=True
But I want to display just 但我只想展示
.../Product/Show/221
Does T4MVC has some shortcut for this? T4MVC对此有一些捷径吗?
routes.MapRoute(
"ProductsShow_Default",
"Product/{action}/{articleId}",
MVC.Product.Show()
);
By default, any parameters that you put in the RouteValueDictionary
for a link that are not contained in any route will by default be added to the query string. 默认情况下,默认情况下,您放置在
RouteValueDictionary
用于任何路由的参数都不会添加到查询字符串中。 Your only way around not putting them in the query string is mapping a route for them, but they're still going to be displayed in the URL. 避免将它们放入查询字符串中的唯一方法是为它们映射一条路由,但它们仍将显示在URL中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.