最近遇到的琐碎的问题asp.net

本文介绍了ASP.NET开发中的一些实用技巧,包括如何通过OnClientClick事件确保客户端验证的完成,避免使用Response.End的方法及其替代方案,如何正确传递Base-64编码参数,以及推荐的数据类型和解决浏览器缓存差异的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1, 在按钮的 OnClientClick 写js来确保用户做了要求的事,否则onclick事件不被触发,和使用验证控件一样。

 

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(); 来解决。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值