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;','&')

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.