예제 #1
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;
            }
        }
예제 #2
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());
        }
예제 #3
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());
        }