In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "ASP.NET data acquisition program how to achieve", in daily operation, I believe many people in ASP.NET data acquisition program how to achieve the problem there are doubts, Xiaobian consulted all kinds of information, sorting out simple and easy to use the operation method, hope to answer everyone "ASP.NET data acquisition program how to achieve" doubts help! Next, please follow the small series to learn together!
ASP.NET skills of data acquisition procedures *** step, in the beginning of downloading data, some sites are to log in to see the corresponding data, this requires us to send login user name and password, but I am logged in, but his server is not garbage, where he redirected, a total of 2 SESSION, this second SESSION I do not know how to catch. So I speculated ^-^, using software to capture SESSION down a software called Ethereal, with the following code added to the HTTP request header
WebClient myWebClient = new WebClient(); string sessionkey=textBox78.Text; string refererurl=textBox77.Text; myWebClient.Headers.Clear(); myWebClient.Headers.Add("Cookie",sessionkey); myWebClient.Headers.Add("Referer", refererurl); myWebClient.Headers.Add("User-agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031107 Debian/1.5-3");
This will deceive the server, haha
ASP.NET skills of data acquisition procedures Step 2, code download
byte[] myDataBuffer = myWebClient.DownloadData(remoteUri); download = Encoding.Default.GetString(myDataBuffer);
ASP.NET skills of the data acquisition program third step, the data match, I will read the stream into the data, and then use IndexOf to get the location of the two key fields, and then use Substring to take out, I know this is stupid, but with regular expressions difficult ah (who will point me down), after matching the string I will use the following function to remove the HTML code:
private string StripHTML(string strHtml) { string [] aryReg ={ @"]*?>.*? ", @"", @"([\r\n])[\s]+", @"&(quot|#34);", @"&(amp|#38);", @"&(lt|#60);", @"&(gt|#62);", @"&(nbsp|#160);", @"&(iexcl|#161);", @"&(cent|#162);", @"&(pound|#163);", @"&(copy|#169);", @"(\d+);", @"-->", @"
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.