原先验证码是这么写的:
<div class="lib"> <span class="lib_l">验证码:</span><span class="lib_r"><asp:TextBox ID="verifyCode_txt" runat="server" Width="90px" CssClass="r_text r_text3" runat="server" MaxLength="4"></asp:TextBox><a href="#"><img id="imgVerify" alt="看不清?点击更换" onclick="this.src=this.src+'?'" src="VerifyCode.aspx?" style="vertical-align: bottom; 80px; height: 20px; border: 1px solid #ccc;" /></a></span></div>
之后点击“重新登录”,
Response.Write("<script>window.parent.location.href='LoginNew2.aspx'</script>");
但之后我断点到VerifyCode.aspx.cs是没有访问到的,请问下这是怎么回事??
论坛大牛给的解决方法:
一般都是IE缓存引起的
方案一:对页面进行不缓存处理
protected void Page_Load(object sender, EventArgs e)
{
Response.Expires = 0;
Response.CacheControl = "no-cache";
}
方案二:<img标签用js输出
<script type="text/javascript" language="JavaScript">
var numkey = Math.random();
numkey = Math.round(numkey*10000);
document.write("<img src="VerifyCode.aspx?k="+ numkey +"" onClick="this.src+=Math.random()" alt="图片看不清?点击重新得到验证码" style="cursor:pointer;" />");
</script>
最有我用了第二种方法实现了,第一种方法依旧是失败的!!有待解决
<div class="lib"> <span class="lib_l">验证码:</span><span class="lib_r"><asp:TextBox ID="verifyCode_txt" runat="server" Width="90px" CssClass="r_text r_text3" runat="server" MaxLength="4"></asp:TextBox><a href="#"> <script type="text/javascript" language="JavaScript"> var numkey = Math.random(); numkey = Math.round(numkey*10000); document.write("<img src="VerifyCode.aspx?k="+ numkey +"" onClick="this.src+=Math.random()" alt="图片看不清?点击重新得到验证码" style="vertical-align: bottom; 80px; height: 20px; border: 1px solid #ccc;cursor:pointer;" />"); </script> </a></span> </div>