用程序实现 http://my.chinahr.com/Login.aspx 的登录,获取登录后的页面  用户名:testyingcai 密码:ggg123456在线等~~~~~~求代码~~~~~

解决方案 »

  1.   

     <form name="form1" method="post" action="Login.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1" autocomplete="off">
      

  2.   

    <form name="form1" method="post" action="http://my.chinahr.com/Login.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1" autocomplete="off">
      

  3.   


    我的意思是,从自己的页面里输入用户名和密码就可以登录到 http://my.chinahr.com/Login.aspx 登录后的页面。
      

  4.   

    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你要的地址,不知这样行不,你可以试试
      

  5.   

    代码现在开不了VS本本不行了
    我说下大体思路
    获取账号,密码与数据库对比返回TRUE或FALSE,
    TRUE跳转账号保存到session,FALSE提示账号或者密码错误。不知道你是不是要这个。
      

  6.   

    这个一般都需要api提供,如果对方只用form提交的话,可以把input修改成一样的 name action换成他们的,兴许可以,不过上面的用了控件,这就要改成和他一样的本地控件id clientID
      

  7.   

    抓一下包,根据报文构造web request,post过去就可以了吧LoginModule_ascx$btnLogin 登录
    LoginModule_ascx$ddlDomai...
    LoginModule_ascx$tbPasswo... ggg123456
    LoginModule_ascx$tbUserNa... testyingcai
      

  8.   


    .net登录还要获取 _eventValidation 和_viewState 但是页面中没有_eventValidation。可否写一段代码给我
      

  9.   


    同行 可以给我也发一份么?谢谢[email protected]
      

  10.   

    无奈,现在上csdn总也找不到答案了~~~~~~