//破解密碼
WebClient wc = new WebClient();
wc.Encoding = Encoding.Utf8;
for(int i=0;i<500;i++)
{
string flag = wc.DownloadString("http://xxxx/xxx.aspx?TextBox1=admin+"&TextBox2="+i+");
if(flag.Contains("true"))
{
Console.Write("密碼是:"+i);
}
}
//暴力注冊
在頁面中使用WebBrowser控件,執行注冊頁面,然後注冊
WebBrowser1.Document.GetElementById("TextBox1").SetAttribute("Value","aaa");
WebBrowser1.Document.GetElementById("TextBox2").SetAttribute("Value","bbb");
WebBrowser1.Document.GetElementById("Button1").InvokeMember("Click");
防止注冊機器人的辦法:
1、加注冊驗證碼
2、有限次數的登入鎖定
Session登入驗證
public class XXX:IHttpHandler,IRequiresSessionState
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "image/JPEG";
using(Bitmap bitmap = new Bitmap(100,50))
{
using(Graphics g = Graphics.FromImage(bitmap))
{
Random rd = new Random();
int code = rd.Next();
string strCode = code.ToString();
g.DrawString(strCode,new Font("Arial",20),Brushes.Green,new PointF(0,0));
//儲存到Session中,需要實作IRequiresSessionState接口
HttpContext.Current.Session["Code"] = strCode;
//可以畫一些折線
g.DrawEllipse(Pens.Red,new Rectangle(10,10,10,10));
bitmap.Save(context.Response.OutputStream,ImageFormat.Jpeg);
}
}
}
在頁面中放一個Image控件來顯示該圖檔,然後通過比較輸入的驗證碼和Session中儲存的值進行比較判斷。
<img src="xxx.ashx" onclick="this.src=xxx.ashx?tag='+new Date() "/>
<a href="http://www.cnblogs.com/guoyiqi/archive/2011/07/26/2139181.html"></a>
資訊提示
<!--這個是html代碼-->
<div id="div1" style="display: none; width:300px; position: absolute">
<table border="0" style="border:2px solid green" cellpadding="0">
<tr>
<td id="td_N" align="center" height="20px" style="color:#004080;background:ECF5FF">
<strong>提示資訊</strong>
</td>
</tr>
<tr>
<td id="td1" height="25px" style="color: black;background:white;">
</table>
</div>
<!--下面的則是js的顯示隐藏方法-->
function Show(content) {
document.getElementById("td1").innerText = "" + content;
x = event.clientX + document.body.scrollLeft;
y = event.clientY + document.body.scrollTop + 30;
div1.style.display = "block";
div1.style.left = x;
div1.style.top = y;
function Hide() {
div1.style.display = "none";
<a></a>