mvc 4 assembly reference missing for Json.Encode

后端 未结 3 592
谎友^
谎友^ 2020-11-30 07:47

I am trying to call a Json.Encode(...) method in MVC 4 and I\'m getting an error: The name \'Json\' does not exist in the current context.

3条回答
  •  温柔的废话
    2020-11-30 08:00

    To be clear, even after you add the correct reference to your project, you still have to add this line at the top of your Razor page:

    @using System.Web.Helpers;
    

提交回复
热议问题