Why is Html.Raw escaping ampersand in anchor tag in ASP.NET MVC 4?

前端 未结 5 1695
旧时难觅i
旧时难觅i 2020-12-01 20:43

I have a URL I would like to render in an anchor tag as-is in a Razor view. I would have thought Html.Raw would be the way to go:

@{
    string test = \"http         


        
5条回答
  •  庸人自扰
    2020-12-01 21:34

    why don't you use jquery to post the url:

        $(function () {
        $('form').submit(function () {
            $.ajax({
                url: this.action,
                type: this.method,
                data: { a:'firstvalue', b: 'secondvalue'},
                success: function (result) {
    //code for successful result
                }
            });
            return false;
        });
    });
    

    in controller

    public ActionResult Fetch(string a, string b)
        {
            //write required codes here
                return View();
    
        }
    

提交回复
热议问题