ftdeveloper
ftdeveloper

Reputation: 1093

Comma in url shown as %2c%

I have question:

My route is as follows:

_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() });

Can you see problem in this route? When I type "," in URL, my route is not working. And my comma shown as "%2c%

Upvotes: 1

Views: 745

Answers (1)

Satpal
Satpal

Reputation: 133433

, is a reserved as per my understanding so I would suggest you not to use it.

URI RFC

2.2. Reserved Characters

Many URI include components consisting of or delimited by, certain special characters. These characters are called "reserved", since their usage within the URI component is limited to their reserved purpose. If the data for a URI component would conflict with the reserved purpose, then the conflicting data must be escaped before forming the URI.

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

The "reserved" syntax class above refers to those characters that are allowed within a URI, but which may not be allowed within a particular component of the generic URI syntax; they are used as delimiters of the components described in Section 3.

Also Uniform Resource Identifier (URI): Generic Syntax

Upvotes: 2

Related Questions