随笔分类 -  ASP.NET

摘要:两种方法: 后端的一般处理程序:Imge.ashx 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.UI.WebContro 阅读全文
posted @ 2016-02-27 22:05 赛跑的蜗牛 阅读(3566) 评论(0) 推荐(0) 编辑
摘要:创建cookie: 1 HttpCookie cookie = new HttpCookie("CurrentUser"); //创建一个名称为CurrentUser 的cookie对象 2 cookie.Values.Add("UserId", "1"); //在cookie对象添加 一项键值对 阅读全文
posted @ 2016-02-27 19:32 赛跑的蜗牛 阅读(290) 评论(0) 推荐(0) 编辑
摘要:日期格式化{0:yyyy-MM-dd HH:mm:ss.fff}与{0:yyyy-MM-dd hh:mm:ss.fff}的区别 使用24小时制格式化日期:{0:yyyy-MM-dd HH:mm:ss.fff}使用12小时制格式化日期:{0:yyyy-MM-dd hh:mm:ss.fff}以下同理,从 阅读全文
posted @ 2016-02-25 17:45 赛跑的蜗牛 阅读(8054) 评论(0) 推荐(0) 编辑
摘要:先要引用在程序集 System.Web.Extensions.dll 的类库,在类中 using System.Web.Script.Serialization 命名空间。 1、定义一个强类型的类(model): 1 [Serializable] 2 public class Person 3 { 阅读全文
posted @ 2016-02-25 17:31 赛跑的蜗牛 阅读(339) 评论(0) 推荐(0) 编辑
摘要:代码: 1 /// <summary> 2 /// HTML Table表格数据(html)导出EXCEL 3 /// </summary> 4 /// <param name="tableHeader">表头</param> 5 /// <param name="tableContent">内容< 阅读全文
posted @ 2016-02-25 09:51 赛跑的蜗牛 阅读(1173) 评论(0) 推荐(0) 编辑
摘要:在http调用时获取到的json数据中文是乱码的解决方法: 中文转Unicode:HttpUtility.UrlEncodeUnicode(string str);转换后中文格式:"%uxxxx" 举例:"柳_cdse53214" 转换结果是:"%u67f3_cdse53214" Unicode转中 阅读全文
posted @ 2016-02-17 15:29 赛跑的蜗牛 阅读(1895) 评论(0) 推荐(0) 编辑
摘要:当客户端向服务端传输特殊字符时报错,错误信息如下图:在asp.net中Request提交时出现有html代码或javascript等字符串时,程序系统会认为其具有潜在危险的值。环境配置会报出“从客户端 中检测到有潜在危险的Request.Form值”这样的错误。出现这种错误是因为你提交的Form中有... 阅读全文
posted @ 2016-01-12 13:29 赛跑的蜗牛 阅读(388) 评论(0) 推荐(0) 编辑