Avatar
0
Thanh Nguyen Beginner
Thanh Nguyen Beginner
C<h1>leaf xnet</h1>
Khi e send request post, data trả về tiếng việt bị lỗi dấu, e phải xử lý sao, e dùng xnet của c<h1></h1> <pre> string Data = "catID=0&amp;industryID=0&amp;page=" + i + "&amp;pageSize=50&amp;type=0&amp;code=&amp;businessTypeID=0&amp;orderBy=Code&amp;orderDir=ASC"; internal static string VietstockCookies = "ASP.NET_SessionId=lrbfkpfxdmwmj05mrq5blgfq; __RequestVerificationToken=k9bwKfd4YGZQAeP0ZL9z6wfdxO6RSL5FtBF1xcKzT0RIXpnei9AWbh0jxhrwG680efzGXzHV7ljZcVBligOasDq9TKgOp4TcMAtPYdlmFCw1; _ga=GA1.2.216441510.1629814377; _ga=GA1.3.216441510.1629814377; language=vi-VN; vts_usr_lg=100EAEFC480D67EB6D1BB84A7AA7CEAEB7ABC3D2D530D4976F32BBAD17E8024A7F2CB97A1FD9022CFBC8275195B07F63EE7B50C5ADFE9BFE7B85FAC991F7D12F08C56951DDDE451BEC11EBAA55B3AE427E65A64BDFAD4B11BF40F0F2A5C64F6FA018935553CF1BEFF16DF2D531F9C7ACE42341AB58780051EF49AB5BB73862F0; Theme=Light; isShowLogin=true; finance_viewedstock=A32,; _gid=GA1.2.1439481456.1633162407; _gid=GA1.3.1439481456.1633162407; ats_ads_referrer_history=%5B%22%22%5D; _gat_UA-1460625-2=1; __gads=ID=d26fadf65c45ca0f-2285f5fc06cc00e1:T=1629814377:RT=1633162469:S=ALNI_Ma2tHezNBgRnckhTpzYh35GAHhjbw"; string Post = SQL.Request.Post("https://finance.vietstock.vn/data/corporateaz", VietstockCookies, Data, ContentType); public static string Post(string url, string cookies = null, string data = null, string contentType = null) { while (true) { try { Leaf.xNet.HttpRequest xNetRequest = new Leaf.xNet.HttpRequest(); Leaf.xNet.CookieStorage Cookies = new Leaf.xNet.CookieStorage(); //Cookies.Add(""); xNetRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36"; xNetRequest.AddHeader("Cookie", cookies); //xNetRequest.SslProtocols = System.Security.Authentication.SslProtocols.Default; string PostData = null; PostData = xNetRequest.Post(url, data, contentType).ToString(); if (PostData != null) return PostData; } catch (Exception ex) { Console.WriteLine("Post url " + url); Console.WriteLine("data " + data); Console.WriteLine("Exception " + ex); Thread.Sleep(5000); } } } </pre>
Answer