How can I pass two querysting parameters in URL routing using ASP.NET 4.0?
I have gone through many articles, but everywhere it shows only one parameter.
I'd like the display URL to be:
http://www.mywebsite.com/reports/1-this-is-my-first-report
The first parameter is ID: 1
This is my first report
I am trying following route, but it 开发者_运维知识库is not working
routes.MapPageRoute(
"MarketReports", // Route name
"Reports/{*i}-{*n}", // Route URL
"~/pageControl2.aspx" // Web page to handle route
);
How can I make this work as described?
Try formatting the URL this way:
http://www.mywebsite.com/reports/1/this-is-my-first-report
routes.MapPageRoute(
"MarketReports", // Route name
"Reports/{*i}/{*n}", // Route URL
"~/pageControl2.aspx" // Web page to handle route
);
Try this
Response.RedirectToRoute("UrlRouting for Querystring",
new { name = txtsearchurlrouting.Text, text = txtsearchid.Text });
In Global.asax
routes.MapPageRoute("UrlRouting for Querystring",
"Querystring/Selected/{name}/{text}/", "~/Address.aspx");
like this we can pass multiple querystring parameters
精彩评论