请问一个关于从应用程序中请求一个http登陆连接资源的问题,请高手帮忙我在应用程序中:

EcRain 2003-08-20 10:33:31
我还是没有解决这个问题
...全文
34 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
panyee 2003-08-20
  • 打赏
  • 举报
回复
是可以, 这有什么问题? 结果正确, 还要得到什么
大雨仔 2003-08-20
  • 打赏
  • 举报
回复
两个结合起来用吧,我知道你是什么用途了,是想登陆一个网站然后再进入子页面对吧,我也做过,不懂的可以与我联系,我的MSN Stdotleo@hotmail.com
EcRain 2003-08-20
  • 打赏
  • 举报
回复
你可以用WebClient
panyee 2003-08-20
  • 打赏
  • 举报
回复
用HttpWebRequest
EcRain 2003-08-20
  • 打赏
  • 举报
回复
using System;
using System.Net;
using System.Text;
using System.Collections.Specialized;

class TestSubmit
{
public static void Main()
{

WebClient myWebClient = new WebClient();
NameValueCollection myNameValueCollection = new NameValueCollection();
myNameValueCollection.Add("user","Admin");
myNameValueCollection.Add("pwd","123456");
string header = "";
byte[] responseArray =

myWebClient.UploadValues("http://localhost/test/testsubmit.asp","POST",myNameValueCollection);
header = myWebClient.ResponseHeaders[4].ToString() + "\n";
string content = Encoding.Default.GetString(responseArray);
Console.WriteLine(content);

}

}

2. TestSubmit.asp:

<%
dim sKey
for each sKey in Request.Form
Response.Write(sKey & "=" & Request.Form(sKey) & "<BR>")
next
%>
panyee 2003-08-20
  • 打赏
  • 举报
回复
指什么登陆连接资源?

110,534

社区成员

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

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

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