public static string CallUrl(string Url, string Method, string UserAgentString = "C# Application (compatible; MSIE 6.0; Windows NT 5.1)") { return(Urls.CallUrl(Url, Method, UserAgentString)); //From http://you.arenot.me/2010/09/28/facebooks-graph-api-and-asp-net/ string UserAgent = UserAgentString; int _timeout = 300000; HttpWebRequest req = null; HttpWebResponse res = null; // Initialise the web request req = (HttpWebRequest)WebRequest.Create(Url); req.Method = Method.Length > 0 ? Method : "POST"; req.UserAgent = UserAgent; // if (Proxy != null) req.Proxy = Proxy; req.Timeout = _timeout; req.KeepAlive = false; // This is needed in the Compact Framework // See for more details: http://msdn2.microsoft.com/en-us/library/1afx2b0f.aspx if (Method != "GET") { req.GetRequestStream().Close(); } string responseString = String.Empty; try { // Get response from the internet res = (HttpWebResponse)req.GetResponse(); using (StreamReader sr = new StreamReader(res.GetResponseStream())) { responseString = sr.ReadToEnd(); } } catch (Exception ex) { //TODO: Update using new code pattern: //var functionName = string.Format("{0}.GetMySQLDataSet", ThisClassName); //var msg = string.Format(""); //Info.LogException("Functions.CallUrl", ex); } return(responseString); }
public static string CallUrl(string Url) { return(Urls.CallUrl(Url)); return(CallUrl(Url, "GET")); }