Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
url路由asp.net 4.0中的可选参数(不在MVC中)?_Asp.net_C# 4.0_Url Routing_Asp.net 4.0 - Fatal编程技术网

url路由asp.net 4.0中的可选参数(不在MVC中)?

url路由asp.net 4.0中的可选参数(不在MVC中)?,asp.net,c#-4.0,url-routing,asp.net-4.0,Asp.net,C# 4.0,Url Routing,Asp.net 4.0,在使用asp.net 4.0时,是否可以在Url路由中使用可选参数 我的意思是我只传递一个参数的值,跳过另一个参数的值 谢谢。我不能给你一个答案(我还在搜索),但可能是一个解决办法。 据我所知,您希望能够做到以下几点: string furType = Page.RouteData.Values["furType"] == null ? "-" : Page.RouteData.Values["furType"].ToStrin

在使用asp.net 4.0时,是否可以在Url路由中使用可选参数

我的意思是我只传递一个参数的值,跳过另一个参数的值


谢谢。

我不能给你一个答案(我还在搜索),但可能是一个解决办法。 据我所知,您希望能够做到以下几点:

string furType = Page.RouteData.Values["furType"] == null ? "-" :     Page.RouteData.Values["furType"].ToString();
a) my-pets.com/dog/brown/long/good-template

b) my-pets.com/dog///mean-barker

c) my-pets.com/dog/black/

用户可以省略一个参数(在示例b中)、狗的颜色和毛发的种类(短或长)

我的变通方法执行以下操作:

string furType = Page.RouteData.Values["furType"] == null ? "-" :     Page.RouteData.Values["furType"].ToString();
这允许以下路线

在我的代码中,我使用它来过滤数据库中的值

var pet = new Pet();
pet.getPets(pet.filter(petType="dog", petTemper="mean-barker");

我不能给你一个答案(我还在寻找),但可能是一个解决办法。 据我所知,您希望能够做到以下几点:

string furType = Page.RouteData.Values["furType"] == null ? "-" :     Page.RouteData.Values["furType"].ToString();
a) my-pets.com/dog/brown/long/good-template

b) my-pets.com/dog///mean-barker

c) my-pets.com/dog/black/

用户可以省略一个参数(在示例b中)、狗的颜色和毛发的种类(短或长)

我的变通方法执行以下操作:

string furType = Page.RouteData.Values["furType"] == null ? "-" :     Page.RouteData.Values["furType"].ToString();
这允许以下路线

在我的代码中,我使用它来过滤数据库中的值

var pet = new Pet();
pet.getPets(pet.filter(petType="dog", petTemper="mean-barker");


你能给我们提供更多细节吗?!你能告诉我们更多细节吗?!我认为以网络形式是不可能的。将BrowseBy参数保留为emtpy如何?那么它会像“浏览//分类”一样吗?我认为这在网络形式下是不可能的。将BrowseBy参数保留为emtpy如何?那么它会像“浏览//分类”一样吗?