问题描述
ASCIIEncodingencoding=newASCIIEncoding();byte[]data=encoding.GetBytes(parmstr);//Preparewebrequest...ServicePointManager.Expect100Continue=true;ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls;ServicePointManager.ServerCertificateValidationCallback=newRemoteCertificateValidationCallback(CheckValidationResult);HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(url+parmstr);myRequest.Method="POST";myRequest.Timeout=1000*60*10*10;myRequest.Accept="image/jpeg,application/x-ms-application,image/gif,application/xaml+xml,image/pjpeg,application/x-ms-xbap,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword,application/x-shockwave-flash,*/*";myRequest.UserAgent="Mozilla/4.0(compatible;MSIE5.0;WindowsNT)";myRequest.Headers.Add("Accept-Language","zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3");;myRequest.Credentials=CredentialCache.DefaultCredentials;myRequest.ContentType="application/x-www-form-urlencoded";myRequest.CookieContainer=myCookieContainer;myRequest.ContentLength=data.Length;myRequest.KeepAlive=false;myRequest.ProtocolVersion=HttpVersion.Version10;StreamnewStream=myRequest.GetRequestStream();//Sendthedata.newStream.Write(data,0,data.Length);newStream.Close();//GetresponseHttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();StreamReaderreader=newStreamReader(myResponse.GetResponseStream(),Encoding.UTF8);求大神!!新浪,网易这种网站就提示出错误,用Get的没问题,一用Post就提示403错误。
解决方案
解决方案二:
up人工顶
解决方案三:
up人工顶
解决方案四:
没人吗~~我没分了