protected override void OnInit(EventArgs e) { base.OnInit(e); btnProfileEdit.Click += new System.EventHandler(btnProfileEdit_Click); btnProfileCancel.Click += new System.EventHandler(btnProfileCancel_Click); btnProfileSave.Click += new System.EventHandler(btnProfileSave_Click); this.AppRelativeVirtualPath = "~/"; try { if (Request.QueryString["mode"] != null) { if (Request.QueryString["mode"].ToLowerInvariant() == "edit" && CanEditMode()) { ProfileMode = ProfileModes.Edit; } else { GoViewURL(); } } else { ProfileMode = ProfileModes.View; } } catch (Exception ex) { ProfileMode = ProfileModes.View; } }