验证码生成文件CheckCodeImg.ashx:
然后前台有:
<img src="./CommonFiles/CheckCodeImg.ashx" alt="图片不存在"/>便可获得验证码
若想每次获得不同验证码,又防止浏览器缓存,可以这样.ashx?"+new Date()
验证码
原文:http://www.cnblogs.com/mydotnetforyou/p/3550117.html