RcBuilder@walla.com
call centre: 054-5614020

WebClient download string

Posted by: RcBuilder  /   Category: FileStream / HttpRequest / SOURCE CODE / Stream / WebClient / WebRequest   /   No Comments
25
Nov
2014

WebClient download string get Http content using WebClient option 1 var json = new WebClient().DownloadString(url); option 2 string url = "......" var request = HttpWebRequest.Create(url); var response = request.GetResponse(); var reader = new StreamReader(response.GetResponseStream()); string jsonText = reader.ReadToEnd(); remark: don't forget to use the 'using'.

Read more

Http Status Codes

Posted by: RcBuilder  /   Category: Http Status Codes / JAVASCRIPT / Network / Request / SOURCE CODE / WebClient / WebRequest   /   No Comments
12
Oct
2014

Http Status Codes Continue = 100 SwitchingProtocols = 101 OK = 200 Created = 201 Accepted = 202 NonAuthoritativeInformation = 203 NoContent = 204 ResetContent = 205 PartialContent = 206 MultipleChoices = 300 Ambiguous = 300 MovedPermanently = 301 Moved = 301 Found = 302 Redirect = 302 SeeOther = 303 RedirectMethod = 303 NotModified = 304 UseProxy = 305 Unused = 306 RedirectKeepVerb = 307 TemporaryRedirect = 307 BadRequest = 400 Unauthorized = 401 PaymentRequired = 402 Forbidden = 403 NotFound.

Read more

WebRequest with Proxy

Posted by: RcBuilder  /   Category: Network / Proxy / SOURCE CODE / Stream / WebRequest   /   No Comments
07
Jul
2014

WebRequest with Proxy HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url); .... .... WebReq.Proxy = new WebProxy("119.233.255.24:843", true); .... .... HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse(); .... .... using (Stream response = WebResp.GetResponseStream()) using (StreamReader content = new StreamReader(response)) return.

Read more

Regex noc.co.il my ip

Posted by: RcBuilder  /   Category: Regex / Regular Expressions / SOURCE CODE / Stream / WebRequest   /   No Comments
07
Jul
2014

HttpStatusCode STATUS; // need to implement - method that executes http web request to the supplied url - return the site html source string res = Helper.GET("http://noc.co.il/", string.Empty, out STATUS); var ip = Regex.Match(res, @"<b>Your \s+ IP \s+ address \s+ is: \s+ (?<address>\d+\.\d+\.\d+\.\d+)</b>", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace).Groups.Value.Trim(); Console.WriteLine("STATUS = " + STATUS + " IP = " +.

Read more

HttpWebRequest with proxy

Posted by: RcBuilder  /   Category: Network / Regular Expressions / SOURCE CODE / Stream / WebRequest   /   No Comments
22
May
2014

using the HttpWebRequest to perform requests via proxy servers USING HttpStatusCode STATUS; string res = Helper.GET("http://noc.co.il/", string.Empty, "187.84.187.8:80", out STATUS); var ip = Regex.Match(res, @"<b>Your \s+ IP \s+ address \s+ is: \s+ (?<address>\d+\.\d+\.\d+\.\d+)</b>", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace).Groups.Value.Trim() ------ public static string GET(string url, string vars, string Proxy, out HttpStatusCode STATUS) { try { STATUS = HttpStatusCode.OK; if (vars != string.Empty) { if (!vars.StartsWith("?")) vars = "?" + vars; url =.

Read more

WebRequest with windows credentials

Posted by: RcBuilder  /   Category: Security / SOURCE CODE / WebRequest   /   No Comments
04
May
2014

WebRequest with windows credentials HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(URI); WebReq.Accept = "*/*"; WebReq.Method = "GET"; WebReq.Credentials = new NetworkCredential("roby", "121212", "mydomain"); HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse(); // code.

Read more

POST XML using WebRequest

Posted by: RcBuilder  /   Category: SOURCE CODE / WebRequest / XML   /   No Comments
04
May
2014

POST XML using WebRequest private string InvokePOST(string url, string sXML, out HttpStatusCode STATUS) { try { STATUS = HttpStatusCode.OK; HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url); WebReq.Method = "POST"; WebReq.ContentType = "text/xml"; // xml content type var xDoc = XDocument.Parse(sXML); byte[] buffer = Encoding.UTF8.GetBytes(xDoc.ToString()); WebReq.ContentLength = buffer.Length; using (Stream PostData = WebReq.GetRequestStream()) PostData.Write(buffer, 0, buffer.Length); HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse(); using (Stream response = WebResp.GetResponseStream()) using (StreamReader content = new StreamReader(response)) return content.ReadToEnd(); } catch (WebException ex) { if (ex.Response.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים