模拟网站登录,在线等 用程序实现 http://my.chinahr.com/Login.aspx 的登录,获取登录后的页面 用户名:testyingcai 密码:ggg123456在线等~~~~~~求代码~~~~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <form name="form1" method="post" action="Login.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1" autocomplete="off"> <form name="form1" method="post" action="http://my.chinahr.com/Login.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1" autocomplete="off"> 我的意思是,从自己的页面里输入用户名和密码就可以登录到 http://my.chinahr.com/Login.aspx 登录后的页面。 public HttpWebResponse GetResponse(string url) { HttpWebResponse resp=null; try { HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); req.Credentials = CredentialCache.DefaultCredentials; req.Timeout=20000;//设置超时时间为20秒 req.Accept="*/*"; req.Referer="http://my.chinahr.com/Login.aspx?UserID=aa&Pwd=111111"; resp = (HttpWebResponse)req.GetResponse(); } catch { if(resp != null) resp.Close(); } return resp; } //获取指定网址源码 public string source(string url) { string source=""; HttpWebResponse resp=null; try { resp=GetResponse(url); StreamReader sr = new StreamReader(resp.GetResponseStream(),Encoding.Default); source = sr.ReadToEnd(); resp.Close(); } catch { if(resp != null) resp.Close(); } return source; }最后来个redirect你要的地址,不知这样行不,你可以试试 代码现在开不了VS本本不行了我说下大体思路获取账号,密码与数据库对比返回TRUE或FALSE,TRUE跳转账号保存到session,FALSE提示账号或者密码错误。不知道你是不是要这个。 这个一般都需要api提供,如果对方只用form提交的话,可以把input修改成一样的 name action换成他们的,兴许可以,不过上面的用了控件,这就要改成和他一样的本地控件id clientID 抓一下包,根据报文构造web request,post过去就可以了吧LoginModule_ascx$btnLogin 登录LoginModule_ascx$ddlDomai... LoginModule_ascx$tbPasswo... ggg123456LoginModule_ascx$tbUserNa... testyingcai .net登录还要获取 _eventValidation 和_viewState 但是页面中没有_eventValidation。可否写一段代码给我 同行 可以给我也发一份么?谢谢[email protected] 无奈,现在上csdn总也找不到答案了~~~~~~ 关于coolite多个文件上传 asp.net 站点不兼容IE9 ajaxpro.2.dll,在前台调用CS方法问题 Infragistics UltraWebGrid 添加列的问题 提议!!顶者有分 怎么让__VIEWSTATE彻底消失 C#串口通信问题 url重写的问题 怎么做删除确认(VB.net)? gridview列宽怎么可以拖动啊 登录后返回刚刚浏览的页面 将Stream转为为Flash文件.怎么转换
我的意思是,从自己的页面里输入用户名和密码就可以登录到 http://my.chinahr.com/Login.aspx 登录后的页面。
{
HttpWebResponse resp=null;
try
{
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Credentials = CredentialCache.DefaultCredentials;
req.Timeout=20000;//设置超时时间为20秒
req.Accept="*/*";
req.Referer="http://my.chinahr.com/Login.aspx?UserID=aa&Pwd=111111";
resp = (HttpWebResponse)req.GetResponse();
}
catch
{
if(resp != null)
resp.Close();
} return resp;
}
//获取指定网址源码
public string source(string url)
{
string source="";
HttpWebResponse resp=null;
try
{
resp=GetResponse(url);
StreamReader sr = new StreamReader(resp.GetResponseStream(),Encoding.Default);
source = sr.ReadToEnd(); resp.Close();
}
catch
{
if(resp != null)
resp.Close();
} return source;
}
最后来个redirect你要的地址,不知这样行不,你可以试试
我说下大体思路
获取账号,密码与数据库对比返回TRUE或FALSE,
TRUE跳转账号保存到session,FALSE提示账号或者密码错误。不知道你是不是要这个。
LoginModule_ascx$ddlDomai...
LoginModule_ascx$tbPasswo... ggg123456
LoginModule_ascx$tbUserNa... testyingcai
.net登录还要获取 _eventValidation 和_viewState 但是页面中没有_eventValidation。可否写一段代码给我
同行 可以给我也发一份么?谢谢[email protected]