简体   繁体   中英

ASP.NET - Read MapPageRoute parameters

So I'm trying to learn how MapPageRoute works, and I was wondering: "How do you read the parameters given in an url?".

So far I've tried this:

 routes.MapPageRoute(
           "exportparts",
           "exportparts/{company}/{ditono}",
           "~/Source/1UI/ExportParts.aspx");

But when I try to read the parameters like this:

string company = (string)Page.RouteData.DataTokens["company"];

the dictionary is empty. How do I read parameters?

I Suppose you want to access the values ? It's done like below Page.RouteData.Values["company"].ToString();

Read more about it here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM