The previous time wanted to directly in MVC in one of the most stupid way to output a script, so think of Response.Write, but later found very problematic, because the output in this way is directly in the first line of the page appears, so the script function is not called at all, so the Html.raw ()
Today, we observed that the traditional ASP. NET and MVC use the Response.Write output, and found that there are some differences between the two in the occurrence position.
ASP. NET MVC
Public ActionResult Index () { var a = 1; var b = 2; Response.Write ("<a onclick=a ('" + A + "', '" + B + "') > Baidu </a>"); return View (); }
Output:
asp
protected void Page_Load (object sender, EventArgs e) { var a = 1; var B = 2; Response.Write ("<a onclick=a ('" + A + "', '" + B + "') > Baidu </a>"); }
Output:
So using Response.Write in MVC simply doesn't get the function in JS, but ASP. NET can
The difference between ASP. NET and ASP in the background directly splicing output