protected void Button1_Click(object sender, EventArgs e) { TextBox2.Text = ""; try { Db db = new Db(); db.S_long = Util_l.To64(TextBox1.Text); db.S_short = "00"; db.User_id = HttpContext.Current.Request.AnonymousID; db.View_count = 0; JObject ret = Util_l.PostJson(Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/api/Default/"), JObject.FromObject(db)); if (ret != null) { Ret_info ret_info = ret.ToObject <Ret_info>(); if (ret_info.B_result) { if (ret_info.Db_list.Count > 0) { TextBox2.Text = Request.Url.GetLeftPart(UriPartial.Authority) + "/" + ret_info.Db_list[0].S_short; } } else { TextBox2.Text = ret_info.S_error; } } } catch (Exception ex) { } TextBox2.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Util_l.Secure_url(Util_l.Nvl(RouteData.Values["id"])); if (id.Length != 0) { Response.Redirect("~/api/Default/" + HttpContext.Current.Request.AnonymousID + "/" + Util_l.To64(id)); return; // Выполнить переход на сервис для поиска короткой ссылки } Label1.Text = "Пользователь - " + HttpContext.Current.Request.AnonymousID; TextBox2.Visible = false; } }
public async void LoadDb() { try { Label1.Text = ""; //JObject ret = Util_l.GetJson(Request.Url.GetLeftPart(UriPartial.Authority) + "/api/Default/"+ HttpContext.Current.Request.AnonymousID); ServiceReference1.Service1Client v = new ServiceReference1.Service1Client(); ServiceReference1.Ret_info ret_info = await v.GetAsync(HttpContext.Current.Request.AnonymousID); v.Close(); if (ret_info != null) { if (ret_info.B_result) { if (ret_info.Db_list.Count() > 0) { List <Db_view1> v_list = new List <Db_view1>(); for (int i = 0; i < ret_info.Db_list.Count(); i++) { Db_view1 v1 = new Db_view1(); v1.S_short = Request.Url.GetLeftPart(UriPartial.Authority) + "/" + ret_info.Db_list[i].S_short; v1.S_long = Util_l.From64(ret_info.Db_list[i].S_long); v1.View_count = ret_info.Db_list[i].View_count; v_list.Add(v1); } GridView1.DataSource = v_list; GridView1.DataBind(); } } else { Label1.Text = ret_info.S_error; } } } catch (Exception ex) { Label1.Text = ex.ToString(); } }
public void LoadDb() { try { Label1.Text = ""; JObject ret = Util_l.GetJson(Request.Url.GetLeftPart(UriPartial.Authority) + "/api/Default/" + HttpContext.Current.Request.AnonymousID); if (ret != null) { Ret_info ret_info = ret.ToObject <Ret_info>(); if (ret_info.B_result) { if (ret_info.Db_list.Count > 0) { List <Db_view1> v_list = new List <Db_view1>(); foreach (Db db in ret_info.Db_list) { Db_view1 v1 = new Db_view1(); v1.S_short = Request.Url.GetLeftPart(UriPartial.Authority) + "/" + db.S_short; v1.S_long = Util_l.From64(db.S_long); v1.View_count = db.View_count; v_list.Add(v1); } GridView1.DataSource = v_list; GridView1.DataBind(); } } else { Label1.Text = ret_info.S_error; } } } catch (Exception ex) { Label1.Text = ex.ToString(); } }