c# - 无法找到 HttpContextBase 即使我正在使用 System.Web

标签 c# .net httpcontext

代码

using System.Web;

abstract class CookieHandler
{
    public CookieHandler(string domain)
    {
         CookieDomain = domain;
    }
    public string CookieDomain { get; set; }

    public abstract void SetCookie(HttpContextBase context, CookieHandler value);
}

HttpContextBase 给我错误“找不到类型或命名空间 HttpContextBase” 当我尝试 HttpContext 时出现同样的错误。我想弄清楚为什么我不能再接收这个对象了。

我正在使用 .NET Framework 4.5.2 并且它有一个库类项目。

最佳答案

根据用户评论的建议,问题是我必须引用程序集 system.web.dll

关于c# - 无法找到 HttpContextBase 即使我正在使用 System.Web,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35757804/

相关文章:

c# - 我们如何从一种表单更改所有其他表单的背景颜色?

c# - 如何模拟 HttpContext.User

c# - 如何检查一个列表是否包含另一个列表 C#

c# - 如何根据生日计算年龄

c# - 如何从 Azure Function App 中的请求正文中检索字节数据

c# - HttpContext 仅在 IIS 7 中导致对象引用错误

c# - 简化从表单获取数据的过程

c# - 寻找一种更好的方法来排序我的 List<T>

c# - 单击 ComboBoxItem 问题事件后,WPF 将 ComboBox 设置为 -1 索引

c# - Numpy.NET 获取值