⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newhandler.cs

📁 俄罗斯方块源码 俄罗斯方块源码 俄罗斯方块源码
💻 CS
字号:
using System;
using System.IO;
using System.Web;
using ProcessRequest;

namespace MyHandler
{
	/// <summary>
	/// NewHandler 的摘要说明。
	/// </summary>
	public class NewHandler : IHttpHandler
	{
		ProcessRequest.ProcessRequest pr = new ProcessRequest.ProcessRequest();		

		public NewHandler()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//			
		}

      public void ProcessRequest(System.Web.HttpContext context)
      {
		    string url1 = context.Request.RawUrl;
            string url2 = @"http://localhost:8000"+url1;

		    string strURL = pr.FilterChar(url1);		    

		    string path = context.Server.MapPath("html\\"+strURL+".htm"); 

		    if (File.Exists(path))
		    {	
			   string HtmlBody;
			   pr.OpenFile(path,out HtmlBody);			   
			   context.Response.Write(HtmlBody);				   
		    }
		    else
		    {			  
			   string HtmlBody;
			   pr.GetFile(url2,out HtmlBody);				   
			   pr.SaveFile(path,HtmlBody);			  
			   context.Response.Write(HtmlBody);		
		    }		   
		}

      public bool IsReusable
      {
         get
         {
             return true;
         }
      }
	 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -