现有A登陆页面(.jsp),登陆成功后弹出下载框,点打开直接连接到B页面(.asp),点保存就把B页面保存到本地(.htm)
现在要用ASP.NET实现,如何做?
请教高手

解决方案 »

  1.   

    利用httpWebRequest登录.然后下载.
      

  2.   

    在ASP中怎么做,在.NET中就怎么做,没什么特别的地方
      

  3.   

    参考:
    http://community.csdn.net/Expert/topic/5282/5282327.xml?temp=0.619870249936297
      

  4.   

    将对方登录所需要的input元素的值post到对方页面上,完成登录同时保存cookie下载时带着这个cookie就可以了.
      

  5.   

    而且B页面保存到本地后是一个HTML Document文件
      

  6.   

    public  string getHTMLByUrlCook(string url,ref System.Net.CookieContainer cook,string sMethod,string Param,bool bAutoRedirect,System.Text.Encoding ecode)
    {
    sMethod = sMethod.ToUpper();
    sMethod = sMethod!="POST"?"GET":sMethod;
    string res ="";
    HttpWebRequest re =(HttpWebRequest)HttpWebRequest.Create(url);
    re.CookieContainer = cook; // attach the cook object 
    re.Method = sMethod;
    re.AllowAutoRedirect = bAutoRedirect;
    re.UserAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; MyIE2; .NET CLR 1.1.4322)";
    if(Public.Session.bUsePox) //利用代理
    {
    int Port = 80;
     
    //re.Referer="http://expert.csdn.net/Expert/topic/2839/2839298.xml?temp=.2714197";
    //re.ClientCertificates = new System.Security.Cryptography.X509Certificates.X509CertificateCollection();
    //re.ClientCertificates = System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile();//re.Timeout = 2000;
    re.Referer = url;
    if (sMethod =="POST") // Post data to Server
    {
    re.ContentType="application/x-www-form-urlencoded";
    Byte[] b = this.getByteFromString(Param,ecode);
    re.ContentLength = b.Length;
    try
    {
    Stream oSRe = re.GetRequestStream();
    oSRe.Write(b,0,b.Length);
    oSRe.Close();
    oSRe = null;
    }
    catch(Exception )
    {
    re = null;
    return "-1";
    }
    }HttpWebResponse rep = null;
    Stream oResponseStream = null;
    StreamReader oSReader = null;
    try
    {
    rep=(HttpWebResponse)re.GetResponse();oResponseStream = rep.GetResponseStream();
    oSReader  = new StreamReader(oResponseStream,ecode);
    res =oSReader.ReadToEnd();
    }
    catch (System.Net.WebException  e)
    {
    //res ="-1";res = e.ToString();
    }if (rep!=null) 
    {
    rep.Close();
    rep = null;
    }
    if(oResponseStream!= null)
    {
    oResponseStream.Close();
    oResponseStream = null;
    }if(oSReader!=null)
    {
    oSReader.Close();
    oSReader = null;
    }
    re = null;return res;}
      

  7.   

    if(session.busepox)//利用代理
    提示system.web.sessionstate.httpsessionstate不包含bUsePox的定义byte[] b=this.getbytefromstring(param,ecode)
    提示_default并不包含getbytefromstring的定义