求解决错误:命名空间“System.Web”中不存在类型或命名空间名称“HttpContext”

chenzhangyi55 2011-05-05 12:45:50

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Web;
namespace 实验项目
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}


private void button1_Click(object sender, EventArgs e)
{
string id = System.Web.HttpContext.Current.Request.QueryString["name"];
string website = System.Web.HttpContext.Current.Request.QueryString["website"];
System.Web.HttpContext.Current.Response.Write(id + "< br>" + website);
System.Web.HttpContext.Current.Response.Write("你使用的是" + System.Web.HttpContext.Current.Request.RequestType + "方式传送数据");
}
}
}



为什么HttpContext下总是有红线发生错误了!!
错误显示:命名空间“System.Web”中不存在类型或命名空间名称“HttpContext”。是否缺少程序集引用?
应该怎么解决呢?
...全文
1365 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
孟子E章 2011-05-06
  • 打赏
  • 举报
回复
public partial class Form1 : Form

你这是网站项目吗?怎么会是继承 Form ?

chenzhangyi55 2011-05-06
  • 打赏
  • 举报
回复
我是做项目的,不是做网站的!!
孟子E章 2011-05-05
  • 打赏
  • 举报
回复
winform里面使用System.Web空间下的类,如编码方法,需要在工程属性-添加引用,添加System.Web.dll的文件的引用
孟子E章 2011-05-05
  • 打赏
  • 举报
回复
System.Web.HttpContext.Current.Request是用在 Webform中的,不是winform
遥望那些年 2011-05-05
  • 打赏
  • 举报
回复
创建网站项目,不是创建WinForm项目。。。
单线程加锁 2011-05-05
  • 打赏
  • 举报
回复
是做的项目,不是做的网站吧?

110,552

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧