Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp : ASP.NET MVC Unicode Route segments are wrongly ordered
    primarykey
    data
    text
    <p>i have a very weird problem, let us suppose i have the following route</p> <pre><code> context.MapRoute("ImageGallery_Default", "Image-Galleries/{category}", new { controller = "Site", action = "Images", category = UrlParameter.Optional }); </code></pre> <p>now if category route value is in English and for example has the value nature, the route will look fine like this</p> <pre><code>http://www.mysite.com/Image-Galleries/Nature </code></pre> <p>but if category route value has a Unicode Characters Arabic or Hebrew, the route gets messed up and category route value become before Image-Galleries like this </p> <pre><code>http://www.mysite.com/طبيعة/Image-Galleries </code></pre> <p><strong>Update 1</strong></p> <p>seems that if the route has only one dynamic route value then it is not and issue, but more than that, the problem starts to be obvious, try this </p> <pre><code>public class FrontEndAreaRegistration : AreaRegistration { public override string AreaName { get { return "FrontEnd"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute("ImageGallery_Item", "Image-Galleries/{category}/{item}", new { controller = "Site", action = "ImagesItem" }); } } </code></pre> <p>and here is my HTML</p> <pre><code>&lt;a href="@Url.RouteUrl("ImageGallery_Item", new { category = "طبيعة", item = "اوروبا", id = @item.Id })"&gt;اوروبا&lt;/a&gt; </code></pre> <p>and here is how the link looks like in browser</p> <pre><code>http://www.mysite.com/Image-Galleries/طبيعة/اوروبا?id=16 </code></pre> <p>notice how item routevalue is coming before hte category which should be hte ohter way around.</p> <p>also there are no routes defined in Global.asax except</p> <pre><code> public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("{resource}.ashx/{*pathInfo}"); } </code></pre> <p>i am all lost on this, i totally appreciate all help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload