protected void Page_Load(object sender, EventArgs e) { Session["PPRId"] = null; Session["PPR2"] = null; string currentPage = Path.GetFileName(Request.Url.AbsolutePath); if (Request.Cookies["PPRCookie"] != null) { HttpCookie getCookie = Request.Cookies.Get("PPRCookie"); string userName = getCookie.Values["ministry"].ToString(); Session["ministry"] = getCookie.Values["ministry"].ToString(); Session["Rolls"] = getCookie.Values["Rolls"].ToString(); Session["LoginId"] = getCookie.Values["LoginId"].ToString(); Session["UserId"] = getCookie.Values["UserId"].ToString(); } if (!IsPostBack) { // Page.Header.DataBind(); // DisplayLastIpDetails(); // DisplayLastLoginDetails(); try { if (Session["Rolls"] == null) { //Response.Redirect("~/Login.aspx"); //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Your session has been expired');window.location ='https://eapdea.gov.in/ppr/Login.aspx';", true); } else { BindPendingTask(); // BindNotificationForMark(); // BindNotificationMessage(); DataSet ds = new DataSet(); MenuItem itemdashboard = new MenuItem(); itemdashboard.Text = "DashBoard"; if (Session["Rolls"] != null) { string Roll = Session["Rolls"].ToString(); if (Roll == "1") { itemdashboard.NavigateUrl = "~/Authenticate/admin/Default.aspx"; } else if (Roll == "4") { itemdashboard.NavigateUrl = "~/Authenticate/LinMin/Default.aspx"; } else if (Roll == "3") { itemdashboard.NavigateUrl = "~/Authenticate/Nodalofficer/Default.aspx"; } else if (Roll == "2") { itemdashboard.NavigateUrl = "~/Authenticate/DEAAdmin/Default.aspx"; } else if (Roll == "5") { itemdashboard.NavigateUrl = "~/Authenticate/admin/Default.aspx"; } else if (Roll == "6") { itemdashboard.NavigateUrl = "~/Authenticate/mdb/mdbpprmisreport.aspx"; } } MainMenu.Items.Add(itemdashboard); obj = new AuthenticatedModuleBL(); ds = obj.getLoginRollMenuBL(Session["Rolls"].ToString()); if (ds.Tables[0].Rows.Count > 0) { ds.Relations.Add("ChildRows", ds.Tables[0].Columns["ModuleId"], ds.Tables[1].Columns["ModuleId"]); foreach (DataRow level1datarow in ds.Tables[0].Rows) { MenuItem item = new MenuItem(); item.Text = level1datarow["ModuleName"].ToString(); //itemdashboard.NavigateUrl = Session["Rolls"].ToString() == "2" ? "~/Authenticate/DEAAdmin/Default.aspx" : "~/Authenticate/linmin/Default.aspx"; item.NavigateUrl = "javascript:;"; DataRow[] level2datarows = level1datarow.GetChildRows("ChildRows"); foreach (DataRow level2datarow in level2datarows) { MenuItem Childitem = new MenuItem(); Childitem.Text = level2datarow["FunctionName"].ToString(); Childitem.NavigateUrl = level2datarow["FunctionAddress"].ToString(); if (level2datarow["FunctionAddress"].ToString().Contains(".pdf")) { Childitem.Target = "_blank"; } item.ChildItems.Add(Childitem); if (Childitem.NavigateUrl.ToString().Contains(currentPage)) { Title.Text = "PPR - " + Childitem.Text.ToString(); } } MainMenu.Items.Add(item); } } MenuItem itemlogout = new MenuItem(); itemlogout.Text = "Logout"; itemlogout.NavigateUrl = "~/Logout.aspx"; MenuItem ContactUs = new MenuItem(); ContactUs.Text = "Contact Us"; ContactUs.NavigateUrl = "~/Authenticate/LinMin/Contactus.aspx"; MenuItem itemchangepass = new MenuItem(); itemchangepass.Text = "Change Password"; itemchangepass.NavigateUrl = "~/Authenticate/Admin/ChangePassword.aspx"; MainMenu.Items.Add(itemchangepass); MainMenu.Items.Add(ContactUs); MainMenu.Items.Add(itemlogout); } } catch (Exception ex) { LogError(ex); } } }
protected void Page_Load(object sender, EventArgs e) { if (Application["loginid_" + GetUserIP().Replace(".", "_")] == null) { Response.Redirect("~/Login.aspx"); } if (Application["passwordsaltedhash" + GetUserIP().Replace(".", "_")] == null) { Response.Redirect("~/Login.aspx"); } //authenticate the user and set session variables. string loginId = Application["loginid_" + GetUserIP().Replace(".", "_")].ToString(); Session["LoginId"] = loginId; string passwordSaltedHash = Application["passwordsaltedhash" + GetUserIP().Replace(".", "_")].ToString(); string passwordSalt = Application["salt_" + GetUserIP().Replace(".", "_")].ToString(); //clear global application variables Application["loginid_" + GetUserIP().Replace(".", "_")] = null; Application["passwordsaltedhash" + GetUserIP().Replace(".", "_")] = null; Application["salt_" + GetUserIP().Replace(".", "_")] = null; //userLevel required for granting & denying access to pages lator. objau = new AuthenticatedModuleBL(); obj = new LoginBL(); string Roll = objau.AuthenticateBL(loginId, passwordSaltedHash, passwordSalt); string userdetails = objau.AuthenticateGetUseridBL(loginId, passwordSaltedHash, passwordSalt); string[] udetails = userdetails.Split(';'); string UserId = udetails[0].ToString(); #region cokiesbasedsessionassing HttpCookie PPRCookie = new HttpCookie("PPRCookie"); Response.Cookies.Remove("PPRCookie"); Response.Cookies.Add(PPRCookie); #endregion if (Roll.Equals("NOTAUTHENTICATED") == false) { string ministry = objau.GetMinistryIdBL(loginId); if (ministry.Equals("deactivated")) { int existingFailedAttempts = obj.GetExistingFaildLoginAttempsBL(loginId); int newFailedAttempts = existingFailedAttempts + 1; objau.UpdateFaildLoginAttempsBL(loginId, newFailedAttempts); obj.LogEntryBL(String.Format("Invalid login attempt reached {0}.", newFailedAttempts), loginId); Response.Redirect("~/Default.aspx?error=deactivated"); } else { Session["ministry"] = HttpUtility.HtmlEncode(ministry); PPRCookie.Values.Add("ministry", HttpUtility.HtmlEncode(ministry)); } //objcrsf = new AntiCRSF(); AntiCRSF.GenerateCSRFToken(); objau.UpdateFaildLoginAttempsBL(loginId, 0); PPRCookie.Values.Add("Rolls", HttpUtility.HtmlEncode(Roll)); PPRCookie.Values.Add("LoginId", HttpUtility.HtmlEncode(loginId)); PPRCookie.Values.Add("UserId", HttpUtility.HtmlEncode(UserId)); PPRCookie.Values.Add("passwordSaltedHash", passwordSaltedHash); PPRCookie.Values.Add("passwordSalt", passwordSalt); DateTime dtxpiry = DateTime.Now.AddHours(1); PPRCookie.Expires = dtxpiry; Response.Cookies.Add(PPRCookie); Session["Name"] = HttpUtility.HtmlDecode(udetails[1].ToString()); Session["Designation"] = HttpUtility.HtmlDecode(udetails[2].ToString()); Session["Rolls"] = HttpUtility.HtmlDecode(Roll); Session["LoginId"] = HttpUtility.HtmlDecode(loginId); Session["UserId"] = HttpUtility.HtmlDecode(UserId); objau.UpdateLoginDateTimeBL(loginId); obj.LogEntryBL("User Logged In Successfully", loginId); Session["IsLoggedIn"] = "true"; string sessToken = Guid.NewGuid().ToString().Replace("-", ""); HttpCookie authCookie = new HttpCookie(".GISAUTH", sessToken); authCookie.HttpOnly = true; Session["ASPXAUTHToken"] = sessToken; Response.Cookies.Add(authCookie); if (Roll == "1") { Response.Redirect("~/Authenticate/admin/Default.aspx"); } else if (Roll == "4") { Response.Redirect("~/Authenticate/LinMin/Default.aspx"); } else if (Roll == "3") { Response.Redirect("~/Authenticate/NodalOfficer/Default.aspx"); } else if (Roll == "2") { Response.Redirect("~/Authenticate/DEAAdmin/Default.aspx"); } else if (Roll == "5") { Response.Redirect("~/Authenticate/admin/Default.aspx"); } else if (Roll == "6") { Response.Redirect("~/Authenticate/admin/filterreport.aspx"); } } else { int existingFailedAttempts = obj.GetExistingFaildLoginAttempsBL(loginId); int newFailedAttempts = existingFailedAttempts + 1; objau.UpdateFaildLoginAttempsBL(loginId, newFailedAttempts); obj.LogEntryBL(string.Format("Invalid login attempt reached {0}.", newFailedAttempts), loginId); Response.Redirect("~/Default.aspx?error=invalid"); } }
public string AuthenticateUser(string loginid, string salthas, string passshas) { string loginId = loginid;//Application["loginid_" + GetUserIP().Replace(".", "_")].ToString(); Session["LoginId"] = loginId; string passwordSaltedHash = salthas; //Application["passwordsaltedhash" + GetUserIP().Replace(".", "_")].ToString(); string passwordSalt = passshas; //Application["salt_" + GetUserIP().Replace(".", "_")].ToString(); objau = new AuthenticatedModuleBL(); obj = new LoginBL(); string Roll = objau.AuthenticateBL(loginId, passwordSaltedHash, passwordSalt); string UserId = objau.AuthenticateGetUseridBL(loginId, passwordSaltedHash, passwordSalt); #region cokiesbasedsessionassing HttpCookie PPRCookie = new HttpCookie("PPRCookie"); HttpContext.Current.Response.Cookies.Remove("PPRCookie"); HttpContext.Current.Response.Cookies.Add(PPRCookie); #endregion if (Roll.Equals("NOTAUTHENTICATED") == false) { string ministry = objau.GetMinistryIdBL(loginId); if (ministry.Equals("deactivated")) { int existingFailedAttempts = obj.GetExistingFaildLoginAttempsBL(loginId); int newFailedAttempts = existingFailedAttempts + 1; objau.UpdateFaildLoginAttempsBL(loginId, newFailedAttempts); obj.LogEntryBL(String.Format("Invalid login attempt reached {0}.", newFailedAttempts), loginId); Response.Redirect("~/Default.aspx?error=deactivated"); } else { Session["ministry"] = HttpUtility.HtmlEncode(ministry); PPRCookie.Values.Add("ministry", HttpUtility.HtmlEncode(ministry)); } //objcrsf = new AntiCRSF(); AntiCRSF.GenerateCSRFToken(); objau.UpdateFaildLoginAttempsBL(loginId, 0); PPRCookie.Values.Add("Rolls", HttpUtility.HtmlEncode(Roll)); PPRCookie.Values.Add("LoginId", HttpUtility.HtmlEncode(loginId)); PPRCookie.Values.Add("UserId", HttpUtility.HtmlEncode(UserId)); PPRCookie.Values.Add("passwordSaltedHash", passwordSaltedHash); PPRCookie.Values.Add("passwordSalt", passwordSalt); DateTime dtxpiry = DateTime.Now.AddHours(1); PPRCookie.Expires = dtxpiry; HttpContext.Current.Response.Cookies.Add(PPRCookie); HttpContext.Current.Session["Rolls"] = HttpUtility.HtmlEncode(Roll); HttpContext.Current.Session["LoginId"] = HttpUtility.HtmlEncode(loginId); HttpContext.Current.Session["UserId"] = HttpUtility.HtmlEncode(UserId); objau.UpdateLoginDateTimeBL(loginId); obj.LogEntryBL("User Logged In Successfully", loginId); HttpContext.Current.Session["IsLoggedIn"] = "true"; string sessToken = Guid.NewGuid().ToString().Replace("-", ""); HttpCookie authCookie = new HttpCookie(".GISAUTH", sessToken); authCookie.HttpOnly = true; HttpContext.Current.Session["ASPXAUTHToken"] = sessToken; HttpContext.Current.Response.Cookies.Add(authCookie); return(Roll); } else { int existingFailedAttempts = obj.GetExistingFaildLoginAttempsBL(loginId); int newFailedAttempts = existingFailedAttempts + 1; objau.UpdateFaildLoginAttempsBL(loginId, newFailedAttempts); obj.LogEntryBL(string.Format("Invalid login attempt reached {0}.", newFailedAttempts), loginId); return(Roll); //HttpContext.Current. Response.Redirect("~/Default.aspx?error=invalid"); } }
public void UserAuthentication() { AuthenticatedModuleBL objau; LoginBL obj; AntiCRSF objcrsf; if (Application["loginid_" + GetUserIP().Replace(".", "_")] == null) { Response.Redirect("~/Login.aspx"); } if (Application["passwordsaltedhash" + GetUserIP().Replace(".", "_")] == null) { Response.Redirect("~/Login.aspx"); } //authenticate the user and set session variables. string loginId = Application["loginid_" + GetUserIP().Replace(".", "_")].ToString(); Session["LoginId"] = loginId; string passwordSaltedHash = Application["passwordsaltedhash" + GetUserIP().Replace(".", "_")].ToString(); string passwordSalt = Application["salt_" + GetUserIP().Replace(".", "_")].ToString(); //clear global application variables Application["loginid_" + GetUserIP().Replace(".", "_")] = null; Application["passwordsaltedhash" + GetUserIP().Replace(".", "_")] = null; Application["salt_" + GetUserIP().Replace(".", "_")] = null; //userLevel required for granting & denying access to pages lator. objau = new AuthenticatedModuleBL(); obj = new LoginBL(); string Roll = objau.AuthenticateBL(loginId, passwordSaltedHash, passwordSalt); string UserId = objau.AuthenticateGetUseridBL(loginId, passwordSaltedHash, passwordSalt); if (Roll.Equals("NOTAUTHENTICATED") == false) { string ministry = objau.GetMinistryIdBL(loginId); if (ministry.Equals("deactivated")) { int existingFailedAttempts = obj.GetExistingFaildLoginAttempsBL(loginId); int newFailedAttempts = existingFailedAttempts + 1; objau.UpdateFaildLoginAttempsBL(loginId, newFailedAttempts); obj.LogEntryBL(String.Format("Invalid login attempt reached {0}.", newFailedAttempts), loginId); Response.Redirect("~/Login.aspx?error=deactivated"); } else { Session["ministry"] = HttpUtility.HtmlEncode(ministry); } //objcrsf = new AntiCRSF(); AntiCRSF.GenerateCSRFToken(); objau.UpdateFaildLoginAttempsBL(loginId, 0); Session["Rolls"] = HttpUtility.HtmlEncode(Roll); Session["LoginId"] = HttpUtility.HtmlEncode(loginId); Session["UserId"] = HttpUtility.HtmlEncode(UserId); objau.UpdateLoginDateTimeBL(loginId); obj.LogEntryBL("User Logged In Successfully", loginId); Session["IsLoggedIn"] = "true"; string sessToken = Guid.NewGuid().ToString().Replace("-", ""); HttpCookie authCookie = new HttpCookie(".GISAUTH", sessToken); authCookie.HttpOnly = true; Session["ASPXAUTHToken"] = sessToken; Response.Cookies.Add(authCookie); if (Roll == "1") { Response.Redirect("~/Authenticate/admin/Default.aspx"); } else if (Roll == "4") { Response.Redirect("~/Authenticate/LinMin/Default.aspx"); } else if (Roll == "3") { Response.Redirect("~/Authenticate/NodalOfficer/Default.aspx"); } else if (Roll == "2") { Response.Redirect("~/Authenticate/DEAAdmin/Default.aspx"); } else if (Roll == "5") { Response.Redirect("~/Authenticate/admin/Default.aspx", false); } else if (Roll == "6") { Response.Redirect("~/Authenticate/admin/filterreport.aspx"); } } else { int existingFailedAttempts = obj.GetExistingFaildLoginAttempsBL(loginId); int newFailedAttempts = existingFailedAttempts + 1; objau.UpdateFaildLoginAttempsBL(loginId, newFailedAttempts); obj.LogEntryBL(string.Format("Invalid login attempt reached {0}.", newFailedAttempts), loginId); //Response.Redirect("~/Login.aspx?error=invalid"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Page.Header.DataBind(); try { if (Session["Rolls"] == null) { //Response.Redirect("~/Login.aspx"); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Your session has been expired');window.location ='https://eapdea.gov.in/ppr/Login.aspx';", true); } else { BindPpprApprovalRequest(); BindNotificationForMark(); BindNotificationMessage(); DataSet ds = new DataSet(); MenuItem itemdashboard = new MenuItem(); itemdashboard.Text = "Home"; if (Session["Roll"] != null) { string Roll = Session["Rolls"].ToString(); if (Roll == "1") { itemdashboard.NavigateUrl = "~/Authenticate/LinMin/Default.aspx"; } else if (Roll == "4") { itemdashboard.NavigateUrl = "~/Authenticate/LinMin/Default.aspx"; } else if (Roll == "3") { itemdashboard.NavigateUrl = "~/Authenticate/DEAAdmin/Default.aspx"; } else if (Roll == "2") { itemdashboard.NavigateUrl = "~/Authenticate/DEAAdmin/Default.aspx"; } else if (Roll == "5") { itemdashboard.NavigateUrl = "~/Authenticate/admin/Default.aspx"; } else if (Roll == "6") { itemdashboard.NavigateUrl = "~/Authenticate/mdb/mdbpprmisreport.aspx"; } } MainMenu.Items.Add(itemdashboard); obj = new AuthenticatedModuleBL(); ds = obj.getLoginRollMenuBL(Session["Rolls"].ToString()); if (ds.Tables[0].Rows.Count > 0) { ds.Relations.Add("ChildRows", ds.Tables[0].Columns["ModuleId"], ds.Tables[1].Columns["ModuleId"]); foreach (DataRow level1datarow in ds.Tables[0].Rows) { MenuItem item = new MenuItem(); item.Text = level1datarow["ModuleName"].ToString(); //itemdashboard.NavigateUrl = Session["Rolls"].ToString() == "2" ? "~/Authenticate/DEAAdmin/Default.aspx" : "~/Authenticate/linmin/Default.aspx"; DataRow[] level2datarows = level1datarow.GetChildRows("ChildRows"); foreach (DataRow level2datarow in level2datarows) { MenuItem Childitem = new MenuItem(); Childitem.Text = level2datarow["FunctionName"].ToString(); Childitem.NavigateUrl = level2datarow["FunctionAddress"].ToString(); if (level2datarow["FunctionAddress"].ToString().Contains(".pdf")) { Childitem.Target = "_blank"; } item.ChildItems.Add(Childitem); } MainMenu.Items.Add(item); } } MenuItem itemlogout = new MenuItem(); itemlogout.Text = "Logout"; itemlogout.NavigateUrl = "~/Logout.aspx"; MenuItem ContactUs = new MenuItem(); ContactUs.Text = "Contact Us"; ContactUs.NavigateUrl = "~/Authenticate/LinMin/Contactus.aspx"; MenuItem itemchangepass = new MenuItem(); itemchangepass.Text = "Change Password"; itemchangepass.NavigateUrl = "~/Authenticate/Admin/ChangePassword.aspx"; MainMenu.Items.Add(itemchangepass); MainMenu.Items.Add(ContactUs); MainMenu.Items.Add(itemlogout); } } catch (Exception ex) { LogError(ex); } } }
protected void Page_Load(object sender, EventArgs e) { string currentPage = Path.GetFileName(Request.Url.AbsolutePath); Session["PPRId"] = null; Session["PPR2"] = null; if (Request.Cookies["PPRCookie"] != null) { HttpCookie getCookie = Request.Cookies.Get("PPRCookie"); string userName = getCookie.Values["ministry"].ToString(); Session["ministry"] = getCookie.Values["ministry"].ToString(); Session["Rolls"] = getCookie.Values["Rolls"].ToString(); Session["LoginId"] = getCookie.Values["LoginId"].ToString(); Session["UserId"] = getCookie.Values["UserId"].ToString(); } if (!IsPostBack) { Session["PPRId"] = null; Page.Header.DataBind(); try { DataSet ds = new DataSet(); if (Session["Rolls"] == null) { //Response.Redirect("~/Login.aspx"); //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Your session has been expired');window.location ='../Default.aspx';", true); } else { BindPpprApprovalRequest(); //BindNotificationForMark(); //BindNotificationMessage(); MenuItem itemdashboard = new MenuItem(); itemdashboard.Text = "DashBoard"; if (Session["Rolls"] != null) { string Roll = Session["Rolls"].ToString(); if (Roll == "1") { itemdashboard.NavigateUrl = "~/Authenticate/admin/Default.aspx"; } else if (Roll == "4") { itemdashboard.NavigateUrl = "~/Authenticate/LinMin/Default.aspx"; } else if (Roll == "3") { itemdashboard.NavigateUrl = "~/Authenticate/Nodalofficer/Default.aspx"; } else if (Roll == "2") { itemdashboard.NavigateUrl = "~/Authenticate/DEAAdmin/Default.aspx"; } else if (Roll == "5") { itemdashboard.NavigateUrl = "~/Authenticate/admin/Default.aspx"; } else if (Roll == "6") { itemdashboard.NavigateUrl = "~/Authenticate/admin/filterreport.aspx"; } } MainMenu.Items.Add(itemdashboard); obj = new AuthenticatedModuleBL(); ds = obj.getLoginRollMenuBL(Session["Rolls"].ToString()); } MenuItem DocumentLog = new MenuItem(); DocumentLog.Text = "Document Log"; DocumentLog.NavigateUrl = "~/DocumentLogModule.aspx"; MainMenu.Items.Add(DocumentLog); MenuItem PPR = new MenuItem(); PPR.Text = "PPR"; PPR.NavigateUrl = "~/PPRModule.aspx"; MainMenu.Items.Add(PPR); MenuItem Posed = new MenuItem(); Posed.Text = "Posed"; Posed.NavigateUrl = "~/PosedModule.aspx"; MainMenu.Items.Add(Posed); MenuItem Pipeline = new MenuItem(); Pipeline.Text = "Pipeline"; Pipeline.NavigateUrl = "~/PipelineModule.aspx"; MainMenu.Items.Add(Pipeline); MenuItem LoanNegotiation = new MenuItem(); LoanNegotiation.Text = "Loan Negotiation"; LoanNegotiation.NavigateUrl = "~/LoanNegotiationModule.aspx"; MainMenu.Items.Add(LoanNegotiation); MenuItem BoardApproval = new MenuItem(); BoardApproval.Text = "Board Approval"; BoardApproval.NavigateUrl = "~/BoardApprovalModule.aspx"; MainMenu.Items.Add(BoardApproval); MenuItem LoanSigning = new MenuItem(); LoanSigning.Text = "Loan Signing"; LoanSigning.NavigateUrl = "~/LoanSigningModule.aspx"; MainMenu.Items.Add(LoanSigning); MenuItem LoanEffectiveness = new MenuItem(); LoanEffectiveness.Text = "Loan Effectiveness"; LoanEffectiveness.NavigateUrl = "~/LoanEffectiveness.aspx"; MainMenu.Items.Add(LoanEffectiveness); MenuItem OnGoing = new MenuItem(); OnGoing.Text = "OnGoing"; OnGoing.NavigateUrl = "~/OnGoing.aspx"; MainMenu.Items.Add(OnGoing); MenuItem itemlogout = new MenuItem(); itemlogout.Text = "Logout"; itemlogout.NavigateUrl = "~/Logout.aspx"; MenuItem ContactUs = new MenuItem(); ContactUs.Text = "Contact Us"; ContactUs.NavigateUrl = "~/Authenticate/LinMin/Contactus.aspx"; MenuItem itemchangepass = new MenuItem(); itemchangepass.Text = "Change Password"; itemchangepass.NavigateUrl = "~/Authenticate/Admin/ChangePassword.aspx"; MainMenu.Items.Add(itemchangepass); MainMenu.Items.Add(ContactUs); MainMenu.Items.Add(itemlogout); } catch (Exception ex) { Alert.show("Session has been expire!"); LogError(ex); } } }