当前上下文 httpcontext.current
获取 get 或post httpcontext.current.request.methodetype(得到是大写字符串)
获取form中的数据 httpcontext.current.request.form[index or name];
验证是cs两边都要验证
获取服务器文件路径 httpcontext.current.server.mappath(filename)
写模板是用占字符,之后 用file.readalltext得到的取代占字符.
返回文本解析 httpcontext.current.contexttype="text/html" \ "text\plait"
如果用到sqldatareader,注意要不用using,而是在 返回出close掉,当然大数据才用阅读器,否则用sqldataadapter.
本文介绍了 ASP.NET Web 开发中的一些实用技巧,包括如何使用 HttpContext 对象来获取请求方式、读取表单数据、验证客户端和服务端的安全性、获取服务器文件路径等。此外还提到了模板使用和文件读取的方法,以及如何处理 SQLDataReader 和 SqlDataAdapter 的最佳实践。
382

被折叠的 条评论
为什么被折叠?



