[英]Adding a variable to routeconfig ASP.net
I am generating my routeconfig
from a database. 我正在从数据库生成我的routeconfig
。
I have a file combine.aspx
which combines all data into a virtual webpage. 我有一个文件combine.aspx
,它将所有数据组合到一个虚拟网页中。
Right now the routing is working, however I have a problem. 现在路由正在工作,但是我有问题。
I want the url to look like this: 我希望网址看起来像这样:
www.domain.com/Home
This is working, however the combiner needs the pageId
. 这是pageId
,但是组合器需要pageId
。 How can I send this without showing it in the url? 如何在不显示网址的情况下发送它? This is how the route is combined now: 这是现在将路线合并的方式:
routes.MapPageRoute(
page.pageName,
url,
"~/combine.aspx");
You can use this overload of MapPageRoute: RouteCollection.MapPageRoute Method (String, String, String, Boolean, RouteValueDictionary) 您可以使用MapPageRoute的以下重载: RouteCollection.MapPageRoute方法(字符串,字符串,字符串,布尔值,RouteValueDictionary)
Like this: 像这样:
routes.MapPageRoute(
page.pageName,
url,
"~/combine.aspx"
false,
new{ pageId = page.pageId }//or whatever variable value you want to use
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.