摘要: 构建基于forms的验证机制过程如下: 1,设置IIS为可匿名访问和asp.net web.config中设置为form验证 2,检索数据存储验证用户,并检索角色(如果不是基于角色可不用) 3,使用FormsAuthenticationTicket创建一个Cookie并回发到客户端,并存储 角色到票据中,如: FormsAuthentication.SetAuthCookie(Username,true | false) cookies保存时间: HttpContext.Current.Response.Cookies[FormsAuthentication.FormsCookieName]. 阅读全文
posted @ 2011-06-14 12:50 Code & Life 阅读(1365) 评论(0) 推荐(1) 编辑
摘要: View Code 1usingSystem;2usingSystem.Collections.Generic;3usingSystem.Linq;4usingSystem.Text;5usingSystem.Web.Security;6usingSystem.Web;7usingSystem.Configuration;8usingSecom.EMS.Web.Common.Helper;9usingSecom.EMS.Web.Common.Models;1011namespaceSecom.EMS.Web.Common.Helper12{13publicclassUserHelper14{1 阅读全文
posted @ 2011-06-14 12:48 Code & Life 阅读(473) 评论(0) 推荐(0) 编辑
摘要: 项目开发时候,库为一个从备份还原的库,ASP.net程序执行报一下异常 :SQL Server 检测到基于一致性的逻辑 I/O 错误 校验和不正确(应为: 0xd4eae74b,但实际为: 0xd4eb674b)。在文件 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\CCMS.mdf' 中、偏移量为 0x000000005be000 的位置对数据库 ID 7 中的页 (1:735) 执行 读取 期间,发生了该错误。SQL Server 错误日志或系统事件日志中的其他消息可能提供了更详细信息。这是一个威胁数据库 阅读全文
posted @ 2011-06-03 15:35 Code & Life 阅读(1724) 评论(1) 推荐(0) 编辑
摘要: 概括的说Remoting与Web Services的区别是:(1)既支持TCP信道又支持HTTP信道,传输速度快(2)即可传输XML的SOAP包又可传输二进制流,效率高(3)Remoteing主要用于C/S结构项目(4)不一定要依赖IIS服务器其实现的原理并没有本质的区别,在应用开发层面上有以下区别:1、Remoting可以灵活的定义其所基于的协议,如果定义为HTTP,则与Web Service就没有什么区别了,一般都喜欢定义为TCP,这样比Web Service稍为高效一些2、Remoting不是标准,而Web Service是标准;3、Remoting一般需要通过一个WinForm或是Wi 阅读全文
posted @ 2011-05-20 10:42 Code & Life 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 在Asp.Net 2.0里,已经能够在WebMethod里使用 Session 、 Application 这种服务器变量了。一、Session [WebMethod(EnableSession = true)] public string Hello() { return "Hello," + Session["user"]; } [WebMethod(EnableSession = false)] public string Hello1() { return "Hello," + Session["user" 阅读全文
posted @ 2011-05-19 13:56 Code & Life 阅读(683) 评论(0) 推荐(0) 编辑
摘要: 1protectedvoidPage_Load(objectsender,EventArgse)2{34using(SqlConnectionconn=newSqlConnection())5{6//dosomething7}89}IL查看:从图中可以看出:是在try{}finally{}中实现。IDisposable是对非托管资源释放,using真正实现的Dispose()是放在finally中实现。 阅读全文
posted @ 2011-05-19 10:49 Code & Life 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 1<scripttype="text/javascript">23varxmlhttp;4varurl="ajax.aspx";56functioncreatexmlttp(){78if(window.XMLHttpRequest){9xmlhttp=newXMLHttpRequest();10}1112if(window.ActiveXobject){13try{1415xmlhttp=newActiveXObject("Microsoft.XMLHTTP");16}17catch(e){1819try{20xmlhtt 阅读全文
posted @ 2011-05-18 15:47 Code & Life 阅读(335) 评论(0) 推荐(0) 编辑
摘要: 今天在操作数据库时,需要将字符串转换成Decimal类型。代码如下:select cast('0.12' as decimal(18,2)); select convert(decimal(18,2), '0.12');当需要将科学计数法的数字字符串转换成Decimal时,这2种写法都报错:Msg 8114, Level 16, State 5, Line 1Error converting data type varchar to numeric.select cast('0.12e+006' as decimal(18,2)); select 阅读全文
posted @ 2011-05-18 15:34 Code & Life 阅读(5334) 评论(0) 推荐(0) 编辑
摘要: 1、利用线程池发起异步操作View Code 1usingSystem;2usingSystem.Threading;34namespaceAsynchronous5{6classProgram7{8staticvoidMain(string[]args)9{10Console.WriteLine("主线程:准备发起一系列异步操作...");11ThreadPool.QueueUserWorkItem(ComputeBoundOp,5);12ThreadPool.QueueUserWorkItem(ComputeBoundOp,7);13Console.WriteLine( 阅读全文
posted @ 2011-05-06 10:46 Code & Life 阅读(468) 评论(0) 推荐(0) 编辑
摘要: 一个优秀的 JavaScript 框架,一篇 jQuery 常用方法及函数的文章留存备忘。jQuery 常见操作实现方式$("标签名") //取html元素 document.getElementsByTagName("")$("#ID") //取单个控件document.getElementById("")$("div #ID") //取某个控件中 控件$("#ID #ID") // 通过控件ID取其中的控件$("标签.class样式名") //通过cl 阅读全文
posted @ 2011-05-04 14:49 Code & Life 阅读(918) 评论(0) 推荐(0) 编辑