protected void Page_Load(object sender, EventArgs e) { ChekcNamefirst.ValidationExpression = AppConfig.CheckNameRegEx; checklastnameforreg.ValidationExpression = AppConfig.CheckNameRegEx; if (!IsPostBack) { if (Session["AccountDetail"] != null) { SetDeafultPageSize(); //gvAdminList.VirtualItemCount = Convert.ToInt32(BAL_AdminList.GetTotalAdminCount()); // set the gridview initial pageindex into viewstate gvIndex = gvAdminList.PageIndex; FillGrid(string.Empty, string.Empty); string str = Convert.ToString(CommonShared.DecryptQueryString("id", Request.QueryString["data"])); if (!string.IsNullOrEmpty(str)) { lblMode.Text = str; Label4.Text = "Edit Admin"; GetRecords(); } else { Label4.Text = "Add Admin"; lblMode.Text = "0"; } } else { Response.Redirect("~/AdminLogin.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { CompareValidator1.ValueToCompare = DateTime.Today.ToString("MM/dd/yyyy"); //txtDesc.BasePath = ConfigurationManager.AppSettings["FCKBasePath"].ToString(); txtDesc.BasePath = AppConfig.FCKBasePath; if (!IsPostBack) { if (Session["AccountDetail"] != null) { SetDeafultPageSize(); //gvCategory.VirtualItemCount = Convert.ToInt32(BAL_News.GetTotalNewsCount()); //set the gridview initial pageindex into viewstate gvIndex = gvCategory.PageIndex; FillGrid(); string str = Convert.ToString(CommonShared.DecryptQueryString("id", Request.QueryString["data"])); if (!string.IsNullOrEmpty(str)) { lblMode.Text = str; Label4.Text = "Edit News/Events"; GetRecords(); } else { Label4.Text = "Add News/Events"; lblMode.Text = "0"; } } else { Response.Redirect("~/AdminLogin.aspx"); } } }
public void Rewrite_BeginRequest(object sender, System.EventArgs args) { string strURI = HttpContext.Current.Request.Url.ToString(); string strPath = HttpContext.Current.Request.Url.AbsolutePath; #region URL Rewriting For Large Images if (strPath.Contains("/LargeImage.aspx")) { string _QueryString = CommonShared.DecryptQueryString("id", HttpContext.Current.Request.QueryString["data"]); if (!string.IsNullOrEmpty(_QueryString)) { Hashtable h1 = new Hashtable(); h1.Add("id", _QueryString); HttpContext.Current.RewritePath("~/User/LargeImage.aspx?data=" + CommonShared.EncryptQueryString(h1), false); } else { Hashtable h1 = new Hashtable(); h1.Add("id", _QueryString); HttpContext.Current.RewritePath("~/User/LargeImage.aspx?data=" + CommonShared.EncryptQueryString(h1), false); } } #endregion #region URL rewriting for Tell A Frnd list else if (strPath.Contains("/TellAFriend.aspx")) { HttpContext.Current.RewritePath("~/User/Email.aspx", false); } #endregion #region URL Rewriting for login Page else if (strPath.Contains("/Login.aspx")) { string _query = Convert.ToString(HttpContext.Current.Request.QueryString); HttpContext.Current.RewritePath("~/User/Login.aspx?" + _query, false); } #endregion #region URL Rewriting For Product Promotions else if (strPath.Contains("/Best_Features.aspx")) { HttpContext.Current.RewritePath("~/User/BestFeatures.aspx?Key=Best", false); } else if (strPath.Contains("/Monthly_Special.aspx")) { HttpContext.Current.RewritePath("~/User/BestFeatures.aspx?Key=Month", false); } else if (strPath.Contains("/New_Year_Special.aspx")) { HttpContext.Current.RewritePath("~/User/BestFeatures.aspx?Key=Year", false); } else if (strPath.Contains("/Hot_Items.aspx")) { HttpContext.Current.RewritePath("~/User/BestFeatures.aspx?Key=Hot", false); } #endregion #region URL Rewriting For Others else { #region URL Rewriting For Category List if (strPath.Contains("/Category/")) { //string _QueryString = strPath.Replace("/Category/", string.Empty); //string _QueryString = strPath.IndexOf("/Category/"); string _QueryString = strPath.Substring(strPath.IndexOf("/Category/")).Replace("/Category/", string.Empty); if (!string.IsNullOrEmpty(_QueryString)) { if (_QueryString.Contains(".aspx")) { string _PostedURL = _QueryString; string[] redirect = _QueryString.Split('/'); _QueryString = redirect[redirect.Length - 1]; DataTable table = URLCheck.CheckForCategory(_QueryString.Replace("_", " ").Replace(".aspx", string.Empty)); if (table.Rows.Count > 0) { Hashtable h1 = new Hashtable(); h1.Add("id", table.Rows[0]["CategoryIdName"]); HttpContext.Current.RewritePath("~/User/CategoryList.aspx?data=" + CommonShared.EncryptQueryString(h1) + "&PostURL=" + _PostedURL, false); } else { Hashtable h1 = new Hashtable(); h1.Add("id", 0); HttpContext.Current.RewritePath("~/User/CategoryList.aspx?data=" + CommonShared.EncryptQueryString(h1), false); } } } } #endregion #region URL Rewriting Products if (strPath.Contains("/Products/")) { //string _QueryString = strPath.Replace("/ECommerce/Products/", string.Empty); string _QueryString = strPath.Substring(strPath.IndexOf("/Products/")).Replace("/Products/", string.Empty); if (!string.IsNullOrEmpty(_QueryString)) { if (_QueryString.Contains(".aspx")) { string[] redirect = _QueryString.Split('/'); _QueryString = redirect[redirect.Length - 1]; DataTable table = URLCheck.CheckForCategory(_QueryString.Replace("_", " ").Replace(".aspx", string.Empty)); if (table.Rows.Count > 0) { Hashtable h1 = new Hashtable(); h1.Add("id", table.Rows[0]["CategoryIdName"]); HttpContext.Current.RewritePath("~/User/ProductList.aspx?data=" + CommonShared.EncryptQueryString(h1), false); } else { Hashtable h1 = new Hashtable(); h1.Add("id", 0); HttpContext.Current.RewritePath("~/User/ProductList.aspx?data=" + CommonShared.EncryptQueryString(h1), false); } } } } #endregion #region URL Rewriting Product Details if (strPath.Contains("/ProductDetails/")) { //string _QueryString = strPath.Replace("/ECommerce/ProductDetails/", string.Empty); string _QueryString = strPath.Substring(strPath.IndexOf("/ProductDetails/")).Replace("/ProductDetails/", string.Empty); if (!string.IsNullOrEmpty(_QueryString)) { if (_QueryString.Contains(".aspx")) { string[] redirect = _QueryString.Split('/'); _QueryString = redirect[redirect.Length - 1]; DataTable table = URLCheck.CheckForProductList(_QueryString.Replace("_", " ").Replace(".aspx", string.Empty)); if (table.Rows.Count > 0) { Hashtable h1 = new Hashtable(); h1.Add("id", table.Rows[0]["ProductIdName"]); HttpContext.Current.RewritePath("~/User/ProductDetails.aspx?data=" + CommonShared.EncryptQueryString(h1), false); } else { Hashtable h1 = new Hashtable(); h1.Add("id", 0); HttpContext.Current.RewritePath("~/User/ProductDetails.aspx?data=" + CommonShared.EncryptQueryString(h1), false); } } } } #endregion } #endregion }