url中的逗号显示为%2c%

时间:2013-07-09 12:00:58

标签: asp.net-mvc asp.net-mvc-routing

我有疑问:

我的路线如下:

_routes.MapRoute(
    "VideoWithQualitySystem",
    "videolar/{category},{subject},{sicknes},{tags},{gender},{hospital},{medicalCenter},{doctors}",
    new { controller = "Video", action = "VideoList" },
    new {
        category = new CategoryConstraint(),
        subject = new SubjectConstraint(),
        sicknes = new SicknessesConstraint(),
        tags = new TagsConstraint(),
        gender = new GenderConstraint(),
        hospital = new CompanyContraint(),
        medicalCenter = new MedicalCenterConstraint(),
        doctors = new DoctorConstraint() });

你能看到这条路线的问题吗?当我在URL中键入“,”时,我的路由无效。我的逗号显示为“%2c%

1 个答案:

答案 0 :(得分:2)

,是根据我的理解保留的,所以我建议你不要使用它。

URI RFC

2.2。保留字符

许多URI包含由某些组成或由其分隔的组件    特殊字符。这些字符称为“保留”,因为    它们在URI组件中的使用仅限于它们的保留    目的。如果URI组件的数据与    保留的目的,然后必须转义冲突的数据    形成URI。

  reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                "$" | ","

上面的“保留”语法类指的是那些字符    在URI中允许,但在一个URI中可能不允许    通用URI语法的特定组件;它们被用作    第3节中描述的组件的分隔符。

另外Uniform Resource Identifier (URI): Generic Syntax

相关问题