Search code examples
asp.net-mvcasp.net-mvc-routing

why my link url to bad url on my site?


link urls is bad in server but correct in my local!

i use :

Url.Action("myaction", "mycontroller", new { id = a.Id, title = a.Title,Name="test", area = "" })

and :

 routes.MapRoute(
            name: "ViewRout",
            url: "{lang}/{Name}/{id}/{title}",
            defaults: new { controller = "mycontroller", action = "myaction", lang = "en", id = UrlParameter.Optional, title = UrlParameter.Optional },
            constraints: new { id = @"\d+",                
            namespaces: new[] { string.Format("{0}.Controllers", typeof(RouteConfig).Namespace) }
        );

url in local :

/en/test/6546/title1

but, url in server (not always, often, sometimes just bad!) :

/x1(a)xsyidfjazxdfdsxd/en/test/6546/title1

please help me!


Solution

  • It seems that your application is configured to enable cookieless sessions. This strange values in the URL are used to identify the sessions in case it can't use cookies for that. Please check "Enter Cookieless Sessions" section at:

    https://msdn.microsoft.com/en-us/library/aa479314.aspx