Ejemplo n.º 1
0
        public async Task <JsonResult> GetTinyUrl(string url)
        {
            TinyUrl        provider = new TinyUrl(url);
            ShortUrlClient client   = ShortUrlClientFactory.Create(provider);

            return(Json(await client.ReceiveAsync(), JsonRequestBehavior.DenyGet));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> GetTrIm(string url)
        {
            string         key      = "36b56b77ac24e5595b626b38c6e00074";
            TrIm           provider = new TrIm(key, url);
            ShortUrlClient client   = ShortUrlClientFactory.Create(provider);

            return(Json(await client.ReceiveAsync(), JsonRequestBehavior.DenyGet));
        }
Ejemplo n.º 3
0
        public async Task <JsonResult> GetGoogl(string url)
        {
            string         key      = "AIzaSyD8UPkwOX2SZJGBFKazFZ1wFIJeVu6UWMA";
            Googl          provider = new Googl(key, url);
            ShortUrlClient client   = ShortUrlClientFactory.Create(provider);

            return(Json(await client.ReceiveAsync(), JsonRequestBehavior.DenyGet));
        }
Ejemplo n.º 4
0
        public async Task <JsonResult> GetBitLy(string url)
        {
            string         token    = "bc6da10fdeaf9464d82cdf475cfb3b19c1a506ca";
            Bitly          provider = new Bitly(token, url);
            ShortUrlClient client   = ShortUrlClientFactory.Create(provider);

            return(Json(await client.ReceiveAsync(), JsonRequestBehavior.DenyGet));
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string Url = "http://www.uol.com.br"; // digite o endereço

                IsGd            isgd     = new IsGd(Url);
                ShortUrlClient  client   = new ShortUrlClient(isgd);
                ShortUrlReceive response = client.Receive();
                client.Dispose();
                HLink.NavigateUrl = response.ShortUrl.AbsoluteUri;
            }
        }
Ejemplo n.º 6
0
        public async Task <ActionResult> Index()
        {
            string url = "http://www.globo.com";

            ShortUrlClient client = new ShortUrlClient(new IsGd(url));

            ShortUrlReceive response = await client.ReceiveAsync();

            client.Dispose();

            ViewBag.Url = response.ShortUrl;

            return(View());
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> Index()
        {
            TinyUrl turl = new TinyUrl("http://www.gmail.com");

            ShortUrlClient client = ShortUrlClientFactory.Create(turl);

            ShortUrlReceive response = await client.ReceiveAsync();

            client.Dispose();

            ViewBag.Url = response.ShortUrl;

            return(View());
        }