0

The Following code returns http://localhost:23843/home/GetBooksTitles?partial=yes&typeofbook=livre instead of http://localhost:23843/home/GetBooksTitles?partial=yes&typeofbook=livre. It returns & instead of &.

How do I tell dotnet not to encode url like that ?

    var url = '<%: Url.Action("GetBooksTitles","home", 
               new { partial="yes",typeofbook="livre"},"http")%>';
        alert(url);

Note: I don't want to user url.replace('&amp;','&')

Bellash
  • 7,560
  • 6
  • 53
  • 86

1 Answers1

1

You should use Html.Raw

var url = '<%: Html.Raw(Url.Action("GetBooksTitles","home", 
               new { partial="yes",typeofbook="livre"},"http"))%>';
alert(url);

By default Asp.net MVC engine will encode string automatically. in case if you want raw string you can use Html.Raw.

Rashmin Javiya
  • 5,173
  • 3
  • 27
  • 49