private void LoginButton_Click(object sender, EventArgs e) { if (Request.Cookies["CheckCode"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('您的浏览器设置已被禁用 Cookies,您必须设置浏览器允许使用 Cookies 选项后才能使用本系统。');</script>"); return; } if (String.Compare(Request.Cookies["CheckCode"].Value, VerifyCodeTextBox.Text.ToString().Trim(), true) != 0) { VerifyCodeTextBox.Text = ""; VerifyCodeTextBox.Focus(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('对不起,验证码错误!');</script>"); return; } SiteConfigInfo si = SiteConfigs.GetConfig(); if (si != null && AdminPasswordIsValid(PasswordTextBox.Text, si)) { System.Web.Security.FormsAuthentication.SetAuthCookie("administrator", true); Response.Redirect(ReturnURL); } else { PasswordTextBox.Focus(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('对不起,密码错误!');</script>"); } }
public bool htmlInjectionValida(String _informacion, ref String _mensaje, String _etiquetaReferente, ref System.Web.UI.WebControls.TextBox _control) { bool isMatch = this.htmlInjectionRegex.IsMatch(_informacion); if (isMatch) { _mensaje = "Caracteres no permitidos en " + _etiquetaReferente.Replace(":", ""); _control.Focus(); } return isMatch; }
public bool sqlInjectionValida(String _informacion, ref String _mensaje, String _etiquetaReferente, ref System.Web.UI.WebControls.TextBox _control) { bool isMatch = this.sqlInjectionRegex.IsMatch(_informacion); if (isMatch) { _mensaje = "Bloqueo de caracteres en el campo " + _etiquetaReferente.Replace(":", ""); _control.Focus(); } return(isMatch); }
public bool sqlInjectionValida(String _informacion, ref String _mensaje, String _etiquetaReferente, ref System.Web.UI.WebControls.TextBox _control) { Regex sqlInjectionRegex = new Regex(@"('(''|[^'])*')|(\b(ALTER|alter|Alter|CREATE|create|Create|DELETE|delete|Delete|DROP|drop|Drop|EXEC(UTE){0,1}|exec(ute){0,1}|Exec(ute){0,1}|INSERT( +INTO){0,1}|insert( +into){0,1}|Insert( +into){0,1}|MERGE|merge|Merge|SELECT|Select|select|UPDATE|update|Update|UNION( +ALL){0,1}|union( +all){0,1}|Union( +all){0,1})\b)"); bool isMatch = sqlInjectionRegex.IsMatch(_informacion); if (isMatch) { _mensaje = "Caracteres no permitidos en " + _etiquetaReferente.Replace(":", ""); _control.Focus(); } return(isMatch); }
public bool htmlInyectionValida(string _informacion, ref string _mensaje, string _etiquetaReferente, ref System.Web.UI.WebControls.TextBox _control) { Regex tagRegex = new Regex(@"<.*?>|&.*?;"); bool respuesta = tagRegex.IsMatch(_informacion); if (respuesta) { _mensaje = "Caracteres no permitidos en " + _etiquetaReferente.Replace(":", ""); _control.Focus(); } return(respuesta); }
public bool htmlInyectionValida(string inf, ref string ms, string _etiquetaReferente, ref System.Web.UI.WebControls.TextBox _control) { Regex tagRegex = new Regex(@"<.*?>|&.*?;"); bool Resultado = tagRegex.IsMatch(inf); if (Resultado) { ms = "Caracteres no permitidos en " + _etiquetaReferente.Replace(":", ""); _control.Focus(); } return(Resultado); }
public bool SQLInyectionValida(string _informacion, ref string _mensaje, string _etiquetaReferente, ref System.Web.UI.WebControls.TextBox _control) { Regex tagPegex = new Regex(@"('(''|[^'])*')|(\b(ALTER|alter|Alter|CREATE|create|Create| DELETE|Delate|delate|DROP|drop|Drop|EXEC(UTE){0,1}|exec(ute){0,1}| Exec(ute){0,1}|INSERT( +INTO){0,1}|insert( +into){0,1}|Insert( +into){0,1}|MERGE| union( +all){0,1}|Union( +all){0,1})\b)" ); bool respuesta = tagPegex.IsMatch(_informacion); if (respuesta) { _mensaje = "Caracter no permitido en " + _etiquetaReferente.Replace(":", ""); _control.Focus(); } return(respuesta); }
public bool SqlInyectionValida(string _informacion, ref string _mensaje, string _etiquetaReferente, ref System.Web.UI.WebControls.TextBox _control) { Regex tagRejex = new Regex(@"('(''|[^'])*')|(\b(ALTER|alter|Alter|CREATE| create|Create|DELETE|delete|Delete|DROP|drop|Drop|EXEC(UTE){0,1}|exec(ute){0,1}| Exec(ute){0,1}|INSERT( +INTO){0,1}|insert( +into){0,1}|Insert( +into){0,1}|MERGE| merge|Merge|SELECT|Select|select|UPDATE|update|Update|UNION( +ALL){0,1}| union( +all){0,1}|Union( +all){0,1})\b)"); bool respuesta = tagRejex.IsMatch(_informacion); if (respuesta) { _mensaje = "Esta sintaxis no se permite: " + _etiquetaReferente.Replace(":", ""); _control.Focus(); } return(respuesta); }
public bool sqlInyectionValida(string info, ref string ms, string etc, ref System.Web.UI.WebControls.TextBox ct) { Regex tagRegex = new Regex(@"('(''|[^'])*')|(\b(ALTER|alter|Alter|CREATE| create|Create|DELETE|delete|Delete|DROP|drop|Drop|EXEC(UTE){0,1}|exec(ute){0,1}| Exec(ute){0,1}|INSERT( +INTO){0,1}|insert( +into){0,1}|Insert( +into){0,1}|MERGE| merge|Merge|SELECT|Select|select|UPDATE|update|Update|UNION( +ALL){0,1}| union( +all){0,1}|Union( +all){0,1})\b)"); bool respuesta = tagRegex.IsMatch(info); if (respuesta) { ms = "Sintaxis no permetida en " + etc.Replace(":", ""); ct.Focus(); } return(respuesta); }
public static void ShowMessage(Control page, TextBox txt, string msgString) { msgString = msgString.Replace("'", "\\'"); ScriptManager.RegisterStartupScript(page, page.GetType(), "MsgBox", "alert('" + msgString + "');", true); txt.Focus(); }