我想創建一個路由約束,但不知道什麼是最好的。這裏是沒有限制的路線:ASP.NET MVC 3路由約束:正則表達式爲非空
context.MapRoute(
"Accommodation_accomm_tags",
"accomm/{controller}/{action}/{tag}",
new { action = "Tags", controller = "AccommProperty" },
new { tag = @"" } //Here I would like to put a RegEx for not null match
);
什麼是最好的解決方案呢?
這是一個很好的觀點。 – Cymen
你又釘了一遍。我試圖記住,應該有一個簡單的方法,但我不能。現在很清楚。謝謝! – tugberk
如果你的動作等待字符串參數呢?在這種情況下,如果您將標籤指定爲可選參數,它將包含空值。 – Vokinneberg