public static string getTinyURL(string url_)
{
string retVal = "";
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://tinyurl.com/api-create.php?url=" + url_);
if (HttpContext.Current.Request.Url.Authority.Trim().ToLower().Contains("".Trim().ToLower()) || HttpContext.Current.Request.Url.Authority.Trim().ToLower().Contains("localhost".Trim().ToLower()))
{ }
else
{
WebProxy myproxy = new WebProxy("", 8080);
myproxy.BypassProxyOnLocal = false;
request.Proxy = myproxy;
}
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader srd = new StreamReader(response.GetResponseStream());
retVal = srd.ReadToEnd();
}
catch (Exception ex)
{
}
return retVal;
}
No comments:
Post a Comment