摘要: HttpHandler HttpHandler是HTTP请求的处理中心,真正地对客户端请求的服务器页面做出编译和执行,并将处理过后的信息附加在HTTP请求信息流中再次返回到HttpModule中。 HttpHandler与HttpModule不同,一旦定义了自己的HttpHandler类,那么它对系统的HttpHandler的关系将是“覆盖”关系。 IHttpHandler接口声明 public interface IHttpHandler { bool IsReusable { get; } public void ProcessRequest(HttpContext cont... 阅读全文
posted @ 2012-07-09 16:19 TigerWang1986 阅读(657) 评论(0) 推荐(1) 编辑
摘要: 项目中httpModules应用:WapModule.cs:public class WapModule:IHttpModule{ public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(context_BeginRequest); } // 处理BeginRequest 事件的实际代码 void context_BeginRequest(object sender, EventArgs e) ... 阅读全文
posted @ 2012-07-09 15:25 TigerWang1986 阅读(6292) 评论(12) 推荐(2) 编辑
摘要: 代码:public static void CleanTemp(string strTempPath) { try { DirectoryInfo DirFile = new DirectoryInfo(strTempPath); //首先删除此文件夹下的文件 foreach (FileInfo file in DirFile.GetFiles()) { file.Delete(); ... 阅读全文
posted @ 2012-07-06 14:31 TigerWang1986 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 常常用于访问某个接口返回字符串,然后对字符串进行处理从而获得有效信息;代码: /// <summary> /// 请示URL地址获取信息 /// </summary> /// <param name="strURL">URL地址</param> /// <returns></returns> public static string SendMsg(string strURL) { string strHtmlContent = null; try ... 阅读全文
posted @ 2012-07-06 13:43 TigerWang1986 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 代码:using System.Runtime.InteropServices;public class INIClass { //ini文件的路径名称 public string inipath; // 声明INI文件的写操作函数 WritePrivateProfileString() [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, str... 阅读全文
posted @ 2012-07-06 11:09 TigerWang1986 阅读(636) 评论(0) 推荐(0) 编辑
摘要: 代码: namespace Assist.Log{ public static class DownLog { private static string FileName = string.Empty; private static StreamWriter swLog = null; private static readonly string ExtName = "_DownLog.txt";//日志类型 private static readonly string ConfigLogPath = "LogPath";/... 阅读全文
posted @ 2012-07-05 17:21 TigerWang1986 阅读(220) 评论(0) 推荐(0) 编辑
摘要: public partial class ServerTest : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { for (int i = 0; i < 100000; i++) { DoUrl("http://192.168.20.125/"); } } public void DoUrl(string url) { ... 阅读全文
posted @ 2012-07-05 15:03 TigerWang1986 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 代码如下: public static string GetPageControl(int CurrentPage, int TotalPage, string Url) { int intStartPage = 0; int intEndPage = 0; StringBuilder strbControlHTML = new StringBuilder(); //如果当前页不是第一页,显示上一页 if (CurrentPage != 1) ... 阅读全文
posted @ 2012-07-05 14:43 TigerWang1986 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 代码:string ftpServerIP; string ftpUserID; string ftpPassword; FtpWebRequest reqFTP;//获得文件大小 public long GetFileSize(string filename) { long fileSize = 0; try { FileInfo fileInf = new FileInfo(filename); ... 阅读全文
posted @ 2012-07-05 14:01 TigerWang1986 阅读(505) 评论(0) 推荐(0) 编辑
摘要: 代码: /// <summary> /// HTTP资源下检测URL地址下文件大小 /// </summary> /// <param name="Url"></param> /// <returns></returns> public static double GetSizeURL(string Url) { double length = 0; try { HttpWebRequest request = (H... 阅读全文
posted @ 2012-07-05 13:51 TigerWang1986 阅读(421) 评论(0) 推荐(0) 编辑