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

Is Search Engine Bot

Posted by: RcBuilder  /   Category: HttpContext / HttpRequest / List / Reference Types / Search Engines / SEO / SOURCE CODE / UserAgent   /   No Comments
16
Nov
2014

Is Search Engine Bot public static bool IsSearchEngineBot(System.Web.HttpContext context) { List<string> robots = new List<string>(); robots.Add("googlebot"); robots.Add("spider"); robots.Add("yahoo"); robots.Add("architext"); robots.Add("baidu"); robots.Add("msnbot"); robots.Add("scooter"); robots.Add("slurp"); robots.Add("teoma"); robots.Add("yandex"); try { string userAgent = context.Request.UserAgent.ToLower(); if(userAgent == string.Empty) return false; foreach (string robot in robots) if (userAgent.Contains(robot)) return true; return false; } catch { return false;.

Read more

jsonp – the basic

Posted by: RcBuilder  /   Category: AJAX / button / CROSS DOMAIN / Generic Handlers / HTML / HttpRequest / JAVASCRIPT / jQuery / JSON / onclick event / SOURCE CODE   /   No Comments
06
Oct
2014

jsonp - the basic SERVER string callback = string.Empty; if (context.Request.QueryString != null) callback = context.Request.QueryString.Trim(); if (callback == string.Empty) return; string json_data = ""; context.Response.Write(string.Concat(callback, "(", json_data, ");")); CLIENT <script src="JS/jquery-1.4.2.min.js" type="text/javascript"></script> <script type="text/javascript"> function JsonP_Callback(json_res) { alert(json_res); } function JsonP_Call() { $.ajax({ dataType: "jsonp", // jsonp type url: "JsonP.ashx", jsonp: "callback", // param name jsonpCallback: "JsonP_Callback" // callback function name }); } </script> HTML <input type="button" value="JsonP_Call" onclick="JsonP_Call()".

Read more

Stream – Download File

Posted by: RcBuilder  /   Category: Files / HttpRequest / SOURCE CODE / Stream   /   No Comments
30
Sep
2014

Stream - Download File public static void CreateStreamDownload(string fileName) { System.IO.Stream stream = null; //This controls how many bytes to read at a time and send to the client int bytesToRead = 10000; // Buffer to read bytes in chunk size specified above byte; // The number of bytes read try { //Create a WebRequest to get the file HttpWebRequest fileReq = (HttpWebRequest)HttpWebRequest.Create(string.Concat(CSCode.BLL.Config.Keys.HostSyncAddress, "Uploaded/temp/", fileName)); //Create a response.

Read more

HttpRequest.Params

Posted by: RcBuilder  /   Category: form / HttpRequest / SOURCE CODE   /   No Comments
23
Sep
2014

HttpRequest.Params combined collection of: 1.Query-string parameters 2.Form fields 3.Cookies 4.Server variables USING //this code will look for the param named "param1" within all the collections presented above //not recommended due to less best practices! var param1 =.

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