Response.Write 方法在 .net core 2.1 上不起作用



Response.Write("string goes here."(;

上面的语句显示了我的 .net core 2.1 项目控制器中的错误。即使我已经包含了诸如 系统网 .

确切的错误消息:

错误 CS1061"HttpResponse"不包含"写入"的定义,并且找不到接受类型为"HttpResponse"的第一个参数的可访问扩展方法"写入"(是否缺少 using 指令或程序集引用?

谢谢

使用 Microsoft.AspNetCore.HttpNuget Package 和命名空间 Microsoft.AspNetCore.Http 然后您可以使用:

using Microsoft.AspNetCore.Http ;
....
Response.Write("String Goes here.");

最新更新