ex34c.h

来自「不好意思」· C头文件 代码 · 共 45 行

H
45
字号
// Ex34c.h

#pragma once

#using <system.dll>
#using <system.web.dll>
using namespace System;
using namespace System::Web;
using namespace System::IO;
namespace Ex34c
{
public __gc class SourceCodeHandler :
	public IHttpHandler
	{
		void ProcessRequest(HttpContext* context)
		{
			context->Response->Write("Viewing file: ");
			context->Response->Write(context->Request->PhysicalPath);
			context->Response->Write("<br>");
			try 
			{
				StreamReader* sr;
				sr = new StreamReader(context->Request->PhysicalPath);
				String* str;
				do
				{
					str = sr->ReadLine();
					context->Response->Write("<p>");
					context->Response->Write(str);
					context->Response->Write("</p>");
				} while (str != 0);
			}
			catch (FileNotFoundException* )
			{
				context->Response->Write("<h2>Sorry - the log you requested is not available</h2>");
			}
		}

		__property bool get_IsReusable() 
		{
		  return true; 
		}
	};
}

⌨️ 快捷键说明

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