SqlConnection conn = new Sqlcheck (). oconn ();
The 2nd method of Invocation sqlcheck.jk1986_checksql ();
string osql = "SELECT COUNT (*) from admin";
SqlCommand ocmd = new SqlCommand (osql, Conn);
Using System;
Using System.Data;
Using System.Configuration;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
Using System.Data.SqlClient;
<summary>
Summary description of Sqlcheck
</summary>
//#region, #endregion to be more aesthetically pleasing to the VS code display, capable of folding and expanding
public class Sqlcheck
{
public Sqlcheck ()
{
//
//TODO: Add constructor logic here
//
}
public SqlConnection oconn ()
{
& nbsp; SqlConnection conn = new SqlConnection ();
Conn. ConnectionString = configurationmanager.connectionstrings["studyconnectionstring"]. ToString ();
//1th method of Invocation jk1986_checksql ();
jk1986_checksql ();
if (conn. state = = connectionstate.closed )
{
Conn. Open ();
}
return conn;
}
Public DataTable GetSource (string Getds)
{
SqlConnection conn = oconn ();
SqlDataAdapter da = new SqlDataAdapter (GETDS, Conn);
DataSet ds = new DataSet ();
Da. Fill (ds, "News");
Return DS. tables["News"];
}
public static void Jk1986_checksql ()
{
String jk1986_sql = "Exec↓select↓drop↓alter↓exists↓union↓and↓or↓xor↓order↓mid↓asc↓execute↓xp_ Cmdshell↓insert↓update↓delete↓join↓declare↓char↓sp_oacreate↓wscript.shell↓xp_regwrite↓ ' ↓;↓--';
string[] Jk_sql = Jk1986_sql. Split (' ↓ ');
foreach (String jk in Jk_sql)
{
-----------------------Anti Post injection-----------------------
if (System.Web.HttpContext.Current.Request.Form!= null)
{
for (int k = 0; k < System.Web.HttpContext.Current.Request.Form.Count; k++)
{
String getsqlkey = System.web.httpcontext.current.request.form.keys[k];
String GetIP;
if (System.web.httpcontext.current.request.form[getsqlkey). ToLower (). Contains (JK) = = True)
{
System.Web.HttpContext.Current.Response.Write ("<script Language=javascript>alert" ( ' ASP.net (C # version) anti-injection program prompts you not to submit illegal characters! ↓\n\nblog:http://hi.baidu.com/ahhacker86 \n\nby: