protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null) { string cadena = "Debe iniciar sesion primero."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } else { Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.Format = "C2"; Chart1.ChartAreas[0].RecalculateAxesScale(); Chart1.Series[0].Label = "#VALY{C2}"; Chart1.Series[0].PostBackValue = "#VALX"; Response.Cache.SetCacheability(HttpCacheability.NoCache); //if (!this.IsPostBack) //{ Session["Reset"] = true; Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config"); SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState"); int timeout = (int)section.Timeout.TotalMinutes * 60000; ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true); //} } }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null) { string cadena = "Debe iniciar sesion primero."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("../Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } else { Usuario usuario = (Usuario)Session["usuario"]; if (!tipo.ReturnAdminPrivileges(usuario)) { string cadena = "Pagina%20disponible%20para%20administradores%20solamente"; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("../Inicio.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } else { Response.Cache.SetCacheability(HttpCacheability.NoCache); //if (!this.IsPostBack) //{ Session["Reset"] = true; Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config"); SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState"); int timeout = (int)section.Timeout.TotalMinutes * 60000; ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true); //} } } }
protected void Page_Load(object sender, EventArgs e) { string oauth_token = Request.QueryString["oauth_token"]; string oauth_verifier = Request.QueryString["oauth_verifier"]; if (oauth_token != null && oauth_verifier != null) { Application["oauth_token"] = oauth_token; Application["oauth_verifier"] = oauth_verifier; Response.Redirect("LinkedInAccountDetails.aspx?oauth_verifier=" + oauth_verifier + ""); } if (!IsPostBack) { form1.Action = QueryStringModule.Encrypt(Request.Url.Query.ToString().Replace("?", "")); if (Request.QueryString["id"] != null && Request.QueryString["id"] != null) { //After signup activate user account string RegOutId = Request.QueryString["id"]; ViewState["RegOutId"] = RegOutId; activate(); GetUserEmailId(); } } }
protected void Page_Load(object sender, EventArgs e) { txtDescripcion.Attributes.Add("onkeydown", "return (event.keyCode!=13);"); if (Session["usuario"] == null) { string cadena = "Debe iniciar sesion primero."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } else { if (Session["sortPalabra"] != null && Session["sortLista"] != null) { btnQuitar.Visible = true; dvProductos.DataSourceID = ""; dvProductos.DataSource = odsSort; dvProductos.DataBind(); } Response.Cache.SetCacheability(HttpCacheability.NoCache); //if (!this.IsPostBack) //{ Session["Reset"] = true; Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config"); SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState"); int timeout = (int)section.Timeout.TotalMinutes * 60000; ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true); //} } Session["sortPalabra"] = null; Session["sortLista"] = null; }
protected void Page_Load(object sender, EventArgs e) { Page.Form.Attributes.Add("enctype", "multipart/form-data"); if (!IsPostBack) { form1.Action = QueryStringModule.Encrypt(Request.Url.Query.ToString().Replace("?", "")); ViewState["orgid"] = Convert.ToInt32(Request.QueryString["orgid"]); if (Convert.ToString(Session["ExternalUserId"]) != "" && Session["ExternalUserId"] != null) { ViewState["UserID"] = Convert.ToInt32(Session["ExternalUserId"].ToString()); } else { Response.Redirect("Landing.aspx", true); } if (Convert.ToString(Session["UserTypeId"]) != "" && Session["UserTypeId"] != null) { ViewState["FlagUser"] = Convert.ToInt32(Session["UserTypeId"].ToString()); } lblUserName.InnerText = Convert.ToString(Session["LoginName"]); GetLoginUserDetails(); BindMessages(); BindNotificationRequest(); GetMessageNotification(); } GetNotifications(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null) { string cadena = "Debe iniciar sesion primero."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("../Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } else { if (Session["estado"] != null) { Session["estado"] = null; } else if (Request.QueryString["mensaje"] != null) { string mensaje = QueryStringModule.Decrypt(Request.QueryString["mensaje"]); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + mensaje.Replace(".", "").Replace("%20", " ") + "');", true); } Response.Cache.SetCacheability(HttpCacheability.NoCache); //if (!this.IsPostBack) //{ Session["Reset"] = true; Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config"); SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState"); int timeout = (int)section.Timeout.TotalMinutes * 60000; ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true); //} } }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null) { string cadena = "Debe iniciar sesion primero."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("../Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } else { if (Session["encabezado"] != null && Session["detalle"] != null) { //TipoMoneda moneda = new TipoMoneda(); Encabezado encabezado = (Encabezado)Session["encabezado"]; List <Detalle> detalles = (List <Detalle>)Session["detalle"]; txtCondicionesPago.Value = encabezado.CondicionPago; txtContacto.Value = encabezado.Contacto; txtCorreo.Value = encabezado.Correo; txtDireccion.Value = encabezado.Direccion; txtEntrega.Value = encabezado.Entrega; txtFecha_.Value = DateTime.Parse(encabezado.Fecha).ToShortDateString(); txtIVA.Value = encabezado.Iva.ToString(); //moneda.Nombre = encabezado.Tipo_moneda; //moneda.ReadNombre(); txtMoneda.DataBind(); System.Web.UI.WebControls.ListItem select = txtMoneda.Items.FindByText(encabezado.Tipo_moneda); select.Selected = true; //txtMoneda.Value = encabezado.Tipo_moneda; txtNeto.Value = encabezado.Neto.ToString(); txtNombre.Value = encabezado.Razon_social; txtRut.Value = encabezado.Rut; txtTelefono.Value = encabezado.Telefono; txtTotal.Value = encabezado.Total.ToString(); detallestring = ListaDetallesString(detalles); objetoDetalles.Value = ListaStringToString(detallestring); Response.Cache.SetCacheability(HttpCacheability.NoCache); //if (!this.IsPostBack) //{ Session["Reset"] = true; Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config"); SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState"); int timeout = (int)section.Timeout.TotalMinutes * 60000; ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true); //} } else { string cadena = "Seleccionar cotizacion primero."; //string cadena = "Debe iniciar sesion primero."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("../Inicio.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } } }
protected void manageButton_Command(object sender, CommandEventArgs e) { Button manage_Button = (Button)sender; string buttonName = manage_Button.ID; string mealType = buttonName.Substring(0, buttonName.IndexOf("ManageButton")); AccordionPane live_Meal = (AccordionPane)manage_Button.Parent.Parent; HiddenField meal_ID_Field = (HiddenField)live_Meal.FindControl(mealType + "MealIDField"); string meal_ID = meal_ID_Field.Value; String redirectVariables = "yum=" + meal_ID.ToString(); string encryptedQuery = QueryStringModule.Encrypt(redirectVariables); this.Response.Redirect("~/editMeal.aspx" + encryptedQuery); }
protected void Page_Load(object sender, EventArgs e) { Page.Form.Attributes.Add("enctype", "multipart/form-data"); if (!IsPostBack) { form1.Action = QueryStringModule.Encrypt(Request.Url.Query.ToString().Replace("?", "")); ViewState["orgid"] = Convert.ToInt32(Request.QueryString["orgid"]); ViewState["RegType"] = Convert.ToString(Session["RegType"]); if (Convert.ToString(Session["ExternalUserId"]) != "" && Session["ExternalUserId"] != null) { if (Convert.ToString(Session["RegType"]) != "" && Session["RegType"] != null) { if (Convert.ToString(ViewState["RegType"]) == "A") { ViewState["UserID"] = Convert.ToInt32(Session["ExternalUserId"].ToString()); } else { Response.Redirect("SuperAdminLanding.aspx", true); } } else { Response.Redirect("SuperAdminLanding.aspx", true); } } else { Response.Redirect("SuperAdminLanding.aspx", true); } if (Convert.ToString(Session["UserTypeId"]) != "" && Session["UserTypeId"] != null) { ViewState["FlagUser"] = Convert.ToInt32(Session["UserTypeId"].ToString()); } lblUserName.InnerText = Convert.ToString(Session["LoginName"]); GetLoginUserDetails(); } //HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false); //HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); //HttpContext.Current.Response.Cache.SetNoStore(); //Response.Cache.SetExpires(DateTime.Now.AddSeconds(1)); //Response.Cache.SetValidUntilExpires(true); //GetNotifications(); SetBreadcrumb(); }
protected void btnLogin_Click(object sender, EventArgs e) { Usuario usuario = new Usuario(); usuario.Usuario_ = txtUsuario.Value; if (usuario.Read()) { if (usuario.Password.Equals(txtPassword.Value)) { if (usuario.Estado != "Habilitado") { string cadena = "El%20Usuario%20esta%20deshabilitado."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } else { Session["usuario"] = usuario; Response.Redirect("Inicio.aspx", false); Context.ApplicationInstance.CompleteRequest(); } } else { string cadena = "Password Incorrecto."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } } else { string cadena = "Usuario Invalido"; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } }
protected void Page_Load(object sender, EventArgs e) { Conection obj = new Conection(); obj.set_ConexionString(ConfigurationManager.ConnectionStrings["MyConexion"].ConnectionString); if (Session["usuario"] != null) { Response.Redirect("Inicio.aspx", false); Context.ApplicationInstance.CompleteRequest(); } else { if (Request.QueryString["mensaje"] != null) { string mensaje = QueryStringModule.Decrypt(Request.QueryString["mensaje"]); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + mensaje.Replace(".", "").Replace("%20", " ") + "');", true); } } }
protected void Page_Load(object sender, EventArgs e) { myConnection = new SqlConnection(connectionString); // Determine the sections to render UserManager manager = new UserManager(); if (UserExists(manager)) { HasRegistered.Visible = true; NeedsToRegister.Visible = false; // change to FALSE for deploy // Set up meal details mealChefNameLabel.Text = User.Identity.GetUserName().ToString(); Uri editMealURI = new Uri(HttpContext.Current.Request.Url.AbsoluteUri); string encryptedString = HttpUtility.ParseQueryString(editMealURI.Query).Get("enc"); string decryptedString = QueryStringModule.Decrypt(encryptedString); mealID = HttpUtility.ParseQueryString(decryptedString).Get("yum"); if (CheckMealHost()) { mealIDField.Value = mealID; if (!IsPostBack) { SetMealDetails(); } } else { mealID = "0"; throw new Exception("Page not found."); } } else { HasRegistered.Visible = false; // change to FALSE for deploy NeedsToRegister.Visible = true; mealChefNameLabel.Text = "unregistered"; } }
protected void Page_Load(object sender, EventArgs e) { txtCodigo.Attributes.Add("onkeydown", "return (event.keyCode!=13);"); if (Session["usuario"] == null) { string cadena = "Debe iniciar sesion primero."; int count = cadena.Count(); string mensaje = QueryStringModule.Encrypt(cadena); Response.Redirect("Login.aspx" + mensaje.Replace("enc", "mensaje"), false); Context.ApplicationInstance.CompleteRequest(); } else { if (Session["codigo"] != null) { txtCodigo.Text = Session["codigo"].ToString(); btnBuscar_Click(sender, e); } Response.Cache.SetCacheability(HttpCacheability.NoCache); //if (!this.IsPostBack) //{ Session["Reset"] = true; Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config"); SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState"); int timeout = (int)section.Timeout.TotalMinutes * 60000; ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true); //} //else //{ // Session["Reset"] = true; // Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config"); // SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState"); // int timeout = (int)section.Timeout.TotalMinutes * 1000 * 60; // ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true); //} } }
private void SendMail(DO_Registrationdetails objRegistration) { try { SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); string mailfrom = ConfigurationManager.AppSettings["mailfrom"]; string mailServer = ConfigurationManager.AppSettings["mailServer"]; string username = ConfigurationManager.AppSettings["UserName"]; string Password = ConfigurationManager.AppSettings["Password"]; string Port = ConfigurationManager.AppSettings["Port"]; string MailURL = ConfigurationManager.AppSettings["MailURL"]; string MailSSL = ConfigurationManager.AppSettings["MailSSL"]; string MailTo = objRegistration.UserName.Trim(); string Mailbody = ""; SmtpClient clientip = new SmtpClient(mailServer); clientip.Port = Convert.ToInt32(Port); clientip.UseDefaultCredentials = false; if (MailSSL != "0") { clientip.EnableSsl = true; } string id = "id=" + Session["ExternalUserId"]; string encript = QueryStringModule.Encrypt(id.ToString()); clientip.Credentials = new System.Net.NetworkCredential(username, Password); string DisplayName = ConfigurationManager.AppSettings["DisplayName"]; try { MailMessage Rmm2 = new MailMessage(); Rmm2.IsBodyHtml = true; Rmm2.From = new System.Net.Mail.MailAddress(mailfrom); Rmm2.Body = Mailbody.ToString(); System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString("<b>Account verification</b>" + "<br><br>" + "Dear" + " " + objRegistration.FirstName + " " + objRegistration.LastName + "," + "<br><br>Thank you for creating Skorkel account.<br><br>Your username is your email address which you'll need when you log in.<br><br>Please click on the link below to activate your account." + "<br><br>" + "<a href='" + MailURL + "/SignUp1.aspx?id=" + Session["ExternalUserId"] + "'>" + MailURL + "/SignUp1.aspx" + encript + "</a>" + "<br><br><br>" + "Thanks," + "<br>" + "Skorkel Team" + "<br><br>****This is a system generated message. Kindly do not reply****", null, "text/html"); Rmm2.To.Clear(); Rmm2.To.Add(MailTo); Rmm2.Subject = "Skorkel new account information"; Rmm2.AlternateViews.Add(htmlView); Rmm2.IsBodyHtml = true; clientip.Send(Rmm2); Rmm2.To.Clear(); } catch (FormatException ex) { ex.Message.ToString(); return; } catch (SmtpException ex) { ex.Message.ToString(); return; } finally { conn.Close(); } } catch (Exception ex) { ex.Message.ToString(); } }
//private void SendMail(string To, string UName, string CustPassword) //{ // try // { // SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); // string mailfrom = ConfigurationManager.AppSettings["mailFrom"]; // string mailServer = ConfigurationManager.AppSettings["mailServer"]; // string username = ConfigurationManager.AppSettings["UserName"]; // string Password = ConfigurationManager.AppSettings["Password"]; // string Port = ConfigurationManager.AppSettings["Port"]; // string MailSSL = ConfigurationManager.AppSettings["MailSSL"]; // string MailTo = To; // // MailTo = "*****@*****.**"; // SmtpClient clientip = new SmtpClient(mailServer); // clientip.Port = Convert.ToInt32(Port); // NetworkCredential cre = new NetworkCredential(username, Password); // clientip.UseDefaultCredentials = false; // if (MailSSL != "0") // clientip.EnableSsl = true; // clientip.Credentials = cre; // string DisplayName = ConfigurationManager.AppSettings["DisplayName"]; // try // { // string Topic = string.Empty; // string Description = string.Empty; // string empid = string.Empty; // string str = "<p> Hi , </p>"; // str += "<p> We have created a new Skorkel Account for you. </p>"; // str += "<p> Your account details are: <br /> Email id for login: "******" <br /> Password:"******"</p>"; // str += "<br /> <br /><p><a href='http://115.124.123.151/Landing.aspx' >www.skorkel.com</a> </p>"; // System.Net.Mail.MailMessage mm2 = new System.Net.Mail.MailMessage(); // mm2.From = new System.Net.Mail.MailAddress(mailfrom, DisplayName); // System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(str, null, "text/html"); // mm2.To.Clear(); // mm2.CC.Clear(); // mm2.Bcc.Clear(); // mm2.To.Add(MailTo); // mm2.Subject = "Skorkel - Account created"; // mm2.AlternateViews.Add(htmlView); // mm2.IsBodyHtml = true; // clientip.Send(mm2); // mm2.To.Clear(); // mm2.CC.Clear(); // mm2.Bcc.Clear(); // } // catch (FormatException ex) // { // ex.Message.ToString(); // return; // } // catch (SmtpException ex) // { // ex.Message.ToString(); // return; // } // finally // { // conn.Close(); // } // } // catch (Exception ex) // { // ex.Message.ToString(); // } //} private void SendMail(string userName) { try { DataTable dtRecord = new DataTable(); string body = null; SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); string mailfrom = ConfigurationManager.AppSettings["mailfrom"]; string mailServer = ConfigurationManager.AppSettings["mailServer"]; string username = ConfigurationManager.AppSettings["UserName"]; string Password = ConfigurationManager.AppSettings["Password"]; string Port = ConfigurationManager.AppSettings["Port"]; string MailURL = ConfigurationManager.AppSettings["MailURL"]; string MailSSL = ConfigurationManager.AppSettings["MailSSL"]; string MailTo = userName.Trim(); string Mailbody = ""; SmtpClient clientip = new SmtpClient(mailServer); clientip.Port = Convert.ToInt32(Port); clientip.UseDefaultCredentials = false; if (MailSSL != "0") { clientip.EnableSsl = true; } string id = "id=" + Session["ExternalUserId"]; string encript = QueryStringModule.Encrypt(id.ToString()); clientip.Credentials = new System.Net.NetworkCredential(username, Password); string DisplayName = ConfigurationManager.AppSettings["DisplayName"]; dtRecord.Clear(); objRegistration.UserName = userName; dtRecord = objRegistrationDB.GetDataTableRecord(objRegistration, DA_Registrationdetails.RegistrationDetails.UserRecordByMail); try { MailMessage Rmm2 = new MailMessage(); Rmm2.IsBodyHtml = true; Rmm2.From = new System.Net.Mail.MailAddress(mailfrom, DisplayName); Rmm2.Body = Mailbody.ToString(); using (StreamReader reader = new StreamReader(Server.MapPath("~/EmailTemplate.htm"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", Convert.ToString(dtRecord.Rows[0]["vchrFirstName"] + " " + dtRecord.Rows[0]["vchrLastName"])); body = body.Replace("{Content}", "Welcome to Skorkel. Skorkel is a one stop platform for you to - <ul><li>connect with the law student community</li>" + "<li>research and collaborate</li><li>access legal news</li><li>access journals and contribute blogs & articles</li><li>apply for jobs and internships</li></ul>" + "Please click on <a href=" + MailURL + " style='color:#01B7BD; text-decoration: none;'>" + MailURL + "</a> to log in"); body = body.Replace("{RedirectURL}", MailURL); System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(body, null, MediaTypeNames.Text.Html); Rmm2.To.Clear(); Rmm2.To.Add(MailTo); Rmm2.Subject = "Welcome to Skorkel"; Rmm2.AlternateViews.Add(htmlView); Rmm2.IsBodyHtml = true; clientip.Send(Rmm2); FCMNotification.Send("Welcome to Skorkel", "Welcome to Skorkel. Skorkel is a one stop platform for you to - connect with the law student community; research and collaborate; " + "access legal news; access journals and contribute blogs & articles; apply for jobs and internships.", Convert.ToString(dtRecord.Rows[0]["intRegistrationID"]), MailURL); Rmm2.To.Clear(); } catch (FormatException ex) { ex.Message.ToString(); return; } catch (SmtpException ex) { ex.Message.ToString(); return; } finally { conn.Close(); } } catch (Exception ex) { ex.Message.ToString(); } }