protected void Page_Load(object sender, EventArgs e) { try { l_Error.Visible = false; if (!Page.IsPostBack) { if (Session["userName"] == null) { Response.Redirect("Login.aspx"); } else { } if (Request["CompanyCode"] != null) { SessionManager.AddCompanyToSession(HttpContext.Current, Convert.ToString(Request["CompanyCode"])); } BindAgentCustomer(); } } catch (Exception ex) { var message = new JavaScriptSerializer().Serialize(ex.Message.ToString()); var script = string.Format("alert({0});", message); ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "", script, true); } }