CS0103 C# The name 'Json' does not exist in the current context

前端 未结 3 1750

Well,

I have written JsonResult funtion. But i get the following error:

CS0103 C# The name \'Json\' does not exist in the current context

3条回答
  •  臣服心动
    2021-01-11 13:43

    Page must be derived from Controller class to Json () and JsonResult() part by using Microsoft.AspNetCore.Mvc;

    If you are using Razor page model then you can face this issue. I got it after too much time spending.

    You can also change your page derived from Controller instead of pagemodel like this public class User: Controller

提交回复
热议问题