1, 在按钮的 OnClientClick 写js来确保用户做了要求的事,否则onclick事件不被触发,和使用验证控件一样。
<asp:Button runat="server" ID="Button1" Text="Postback" OnClientClick="if(!myFunc()) return false;"/>
<mce:script type="text/javascript"><!-- function myFunc() { if() { return false; } return ture; } // --></mce:script>
2, Response.End不能写在try{}块中。
可以参考 http://support.microsoft.com/kb/312629/EN-US/
For Response.End, call the HttpContext.Current.ApplicationInstance.CompleteRequest method instead of Response.End to bypass the code execution to the Application_EndRequest event.
或者想其他办法写的try块外面。
3, base-64通过 abc.aspx?a=base-64字符。这样传参时会被转义,所以需要Server.UrlEncode()
29SpzbZPvSjxC7R5JmaifB1xrJ+ghbQV //base-64
29SpzbZPvSjxC7R5JmaifB1xrJ ghbQV //直接传过来的
29SpzbZPvSjxC7R5JmaifB1xrJ%2bghbQV //使用Server.UrlEncode()
The base-64 digits in ascending order from zero are the uppercase characters "A" to "Z", the lowercase characters "a" to "z", the numerals "0" to "9", and the symbols "+" and "/". The valueless character, "=", is used for trailing padding
4, Use varchar(max), nvarchar(max), and varbinary(max) data types instead of text, ntext, and image data types.
5,火狐和IE的缓存不一样,按后退按钮返回后保存的页面状态也不一样。
在page_load里添加 Response.Cache.SetNoStore(); 来解决。