请高手帮忙,在线等 现有A登陆页面(.jsp),登陆成功后弹出下载框,点打开直接连接到B页面(.asp),点保存就把B页面保存到本地(.htm)现在要用ASP.NET实现,如何做?请教高手 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 利用httpWebRequest登录.然后下载. 在ASP中怎么做,在.NET中就怎么做,没什么特别的地方 参考:http://community.csdn.net/Expert/topic/5282/5282327.xml?temp=0.619870249936297 将对方登录所需要的input元素的值post到对方页面上,完成登录同时保存cookie下载时带着这个cookie就可以了. 而且B页面保存到本地后是一个HTML Document文件 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;} if(session.busepox)//利用代理提示system.web.sessionstate.httpsessionstate不包含bUsePox的定义byte[] b=this.getbytefromstring(param,ecode)提示_default并不包含getbytefromstring的定义 求一条sql语句 奇怪,UpdatePanel内pageload里加上ScriptManager.RegisterStartupScript,其他Script就不能运行? DataGrid模板列的问题 如何根据传递过来的值选种DropDownlist的某一项啊? 郁闷,帮我!---->明天就要讲了. 为什么我的播放页面行呢? 怎样让treeview背景透明? 一般asp.net 程序员的薪金是多少?(来者有分) 这是什么问题? 一个简单的DataGrid与SQL问题 asp.net前臺使用的一些JavaScript代碼為什么沒有作用? 在一个页面上根据已有的坐标添加图片
http://community.csdn.net/Expert/topic/5282/5282327.xml?temp=0.619870249936297
{
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;}
提示system.web.sessionstate.httpsessionstate不包含bUsePox的定义byte[] b=this.getbytefromstring(param,ecode)
提示_default并不包含getbytefromstring的定义