asp + c #webpages

时间:2017-05-26 18:48:30

标签: c# asp.net

我正在尝试为我的邮政编码项目路由网址,我需要路由我的网址,例如 - www.example.com/pincode/{country}/{state}/{district}/{area}/.

下面这行对我来说很好

//to show all countries eg. example.com/india/
routes.MapPageRoute("showcountries", "pincode/{country}/", "~/pincode/country.aspx"); 

但是当我增加代码或网址时,我发现错误。我的global.ashx文件的代码如下所示

// To show all states list of mentioned country in url eg. example.com/india/maharashtra/
routes.MapPageRoute("showstates", "pincode/{country}/{state}/", "~/pincode/state.aspx"); 

// show all districts from url eg. example.com/india/maharashtra/pune/
routes.MapPageRoute("showdistricts", "pincode/{country}/{state}/{district}/", "~/pincode/district.aspx"); 

routes.MapPageRoute("showdivisionpin", "{country}/{state}/{district}/{division}/", "~/pincode/division.aspx");

任何人都可以帮我解决这个问题。对不起,我的英语不好。提前谢谢。

1 个答案:

答案 0 :(得分:0)

我不确定这条线的工作情况

routes.MapPageRoute(" showdivisionpin"," {country} / {state} / {district} / {division} /","〜/ pincode / division的.aspx&#34);

你可以像这样给予支票吗

routes.MapPageRoute(" showdivisionpin"," division {country} / {state} / {district} / {division} /","〜/ pincode / division.aspx&#34);