善用 HttpContext & HttpRuntime & HostingEnvironment
摘要:HttpContext.Current返回当前请求的 HttpContext 对象。如此我们就可以直接访问Request、Response、Session、Application等对象,和Page中访问等同。我们无需再将Page用参数的方式传递到我们的类库对象中。HttpContext.Current.Session["name"] = "猪八戒";string name = HttpContext.Current.Request.Param["name"];HttpContext.Current.Response.Write(&qu
阅读全文
写代码过程中断电引起异常:HRESULT: 0x80070057 (E_INVALIDARG) 的处理
摘要:碰到这个异常的原因很偶然:现象:Solution在ReBuild过程中断电了,来电恢复了,重析编译整个Solution不报错,但在浏览页面时始终无法正常浏览,而在design的视图中,每个aspx的首行代码都报错。http://www.dezai.cn/blog/article.asp?id=355解决过程:搜索找到很多国内的方案,有的建议重新引用AjaxControlToolkit.dll,还有就是清除asp.net的缓存文件,但都没有看到想要的效果,最后在一个国外MSDN的贴子(http://social.msdn.microsoft.com/Forums/en-US/csharpide/
阅读全文