在winform中,使用了Request,但是说"当前上下问中不存在Request"
按照网上说的加了using System.Web.UI;
求助.
按照网上说的加了using System.Web.UI;
求助.
解决方案 »
- c# 取网页中间一段 求助
- 期末作业 求大侠帮忙
- C# SendMessage 或 PostMessage 怎麽發送一個鍵啊,如F1键 谁能以 windows的 計算器为例 给一个提示啊.只要成功就行
- SQL 查询不重复
- 一个五子棋的人机算法,有兴趣的进来讨论下
- 为什么加上这句就出错,在使用 SQLserver 时,加这句就没错啊
- c#有没有读取和播放媒体不是通过文件而是通过byte[]或stream的类?
- ★★★★★★★★★★★★★欢迎加入QQ群(883170)目前里面有34个.net程序员★★★★★★★
- 如何实现xp界面
- informix数据库显示时乱码问题??
- C#中的Tempstr
- 我为什么没有权限上传头像泥??
demo:
static class WebFunc
{
private static CookieContainer cookie = new CookieContainer();
private static string contentType = "application/x-www-form-urlencoded";
private static string accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight-2-b1, */*";
private static string userAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)";
public static string GetHtmlEx(string url, Encoding encoding)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent = userAgent;
request.ContentType = contentType;
request.CookieContainer = cookie;
request.Accept = accept;
request.Method = "get";
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream, encoding);
String html = reader.ReadToEnd();
response.Close();
return html;
}
} //本文来自CSDN博客,转载请标明出处:
//http://blog.csdn.net/wuyazhe/archive/2010/07/17/5741941.aspx
实现什么功能如webclient,webbrower