protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["Login"] != null) //if user is logged { d = o.searchOrders(Session["Login"].ToString()); //shopping cart GridView1.DataSource = d; GridView1.DataBind(); d2 = o.searchHistory(Session["Login"].ToString()); //history cart GridView2.DataSource = d2; GridView2.DataBind(); } else { Response.Redirect("/Login.aspx"); //else redirect } } }
protected void Page_Load(object sender, EventArgs e) { if (User.Identity.IsAuthenticated) { d = o.searchHistory(User.Identity.Name); GridView1.DataSource = d; GridView1.DataBind(); } else { Response.Redirect("/Account/Login.aspx"); } }