Ejemplo n.º 1
0
        public JsonResult StartShort(Dat dt)
        {
            strurl = new Uri(Request.Url.AbsoluteUri).ToString();
            string    sub    = strurl.Substring(0, strurl.Length - 10);
            string    ss     = dt.Longurl;
            Shortener sh     = new Shortener();
            string    stoped = sh.ShortURL(ss);
            string    str    = sub + @"Index/" + stoped;

            if (stoped == "stopURL")
            {
                str = "stop";
            }
            else
            {
                sh.TokenSave(ss, str);
            }
            var dat = new
            {
                name = str
            };

            return(Json(dat, JsonRequestBehavior.AllowGet));
        }