代码如下:Encoding encoding = Encoding.GetEncoding("GB2312");string postData = "";
// URL
string strUrl = "http://192.168.0.154/oa/login.asp";
postData += ("uid=duan");
postData += ("&pwd=123456");
byte[] data = encoding.GetBytes(postData);// 准备请求...
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strUrl);
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// 发送数据
newStream.Write(data,0,data.Length);
newStream.Close();各位看看是不是不能使用这种方法?
// URL
string strUrl = "http://192.168.0.154/oa/login.asp";
postData += ("uid=duan");
postData += ("&pwd=123456");
byte[] data = encoding.GetBytes(postData);// 准备请求...
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strUrl);
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// 发送数据
newStream.Write(data,0,data.Length);
newStream.Close();各位看看是不是不能使用这种方法?
解决方案 »
- SQL数据类型与asp.net中文本框中文本匹配的类型
- Ajax control toolkit使用问题
- uploadify http error 500错误怎么解决
- 拜托.net高人指路~~
- script实现 广告轮播控件的问题
- javascript 读取 datagrid 的问题
- 想在表头放一个按钮来控制表格动态伸缩,该怎么实现?
- javascript问题,如何在调用window.print()时不让显示出打印设置页而直接打印?
- VS.NET你们一般是用网格模式还是流模式?
- 怎样知道访问者是否使用代理,怎样取得代理IP?
- 求UltraEdit9.10注册码
- 超头疼难题:程序设计阶段是否不应当把组件加入到GAC中?谢谢!!!
以我有限的知识↑他能得到什么啊?
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strUrl);
NetworkCredential myCred=new NetworkCredential("name","pas");
myRequest.Credentials=myCred