Cookiecontainer cookies = new Cookiecontainer ();
String url = "http://120.24.56.48:8889/api/auth/login?username=13590372650&password=wjkj110";
HttpWebRequest myhttpwebrequest = (HttpWebRequest) webrequest.create (URL);
Myhttpwebrequest.timeout = 20 * 1000; Connection timed out
myhttpwebrequest.accept = "*/*";
Myhttpwebrequest.useragent = "mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; trident/4.0;) ";
Myhttpwebrequest.cookiecontainer = new Cookiecontainer (); Staging to new instances </span>
Myhttpwebrequest.getresponse (). Close ();
cookies = Myhttpwebrequest.cookiecontainer; Save Cookies</span>
String cookiesstr = MyHttpWebRequest.CookieContainer.GetCookieHeader (Myhttpwebrequest.requesturi); Convert cookies into strings
url = "http://120.24.56.48:8889/api/auth/login?username=13590372650&password=wjkj110";
myHttpWebRequest = (HttpWebRequest) webrequest.create (URL);
Myhttpwebrequest.timeout = 20 * 1000; Connection timed out
myhttpwebrequest.accept = "*/*";
Myhttpwebrequest.useragent = "mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; trident/4.0;) ";
Myhttpwebrequest.cookiecontainer = cookies; Using the cookie method I have saved </span>
MYHTTPWEBREQUEST.HEADERS.ADD ("Cookie", cookiesstr); Use of the saved Cookies method II
HttpWebResponse myhttpwebresponse = (HttpWebResponse) myhttpwebrequest.getresponse ();
Stream stream = Myhttpwebresponse.getresponsestream ();
Stream. ReadTimeout = 15 * 1000; Read timeout
StreamReader sr = new StreamReader (Stream, encoding.getencoding ("Utf-8"));
String strwebdata = Sr. ReadToEnd ();
String richTextBox1 = Cookiesstr + "\r\n\r\n" + strwebdata;
C # Web Fetch server cookie