qinking126
qinking126

Reputation: 11895

asp.net mvc3, need help to get this route constraint working

it works as long as the topic is all lowercase, is there a way to ignore case?

        routes.MapRouteLowercase(
            "TopicList", // Route name
            "{topic}s/{page}", // URL with parameters
            new { controller = "Review", action = "Index", id = UrlParameter.Optional, Topic = "AllTopic" },
            new { topic = @"(app|book|toy|website|article||alltopic)" }
        );

Upvotes: 1

Views: 106

Answers (1)

dillenmeister
dillenmeister

Reputation: 1647

Try this:

new { topic = @"(?i)(app|book|toy|website|article||alltopic)" }

Upvotes: 3

Related Questions