.net编程--ASP.NET
程序员文章站
2023-12-28 11:10:04
...
一般处理程序代码示例:
<%@ WebHandler Language="C#" Class="Start1" %>
using System;
using System.Web;
public class Start1 : IHttpHandler {
public void ProcessRequest (HttpContext context) {
//给前端页面输出一个字符串
//context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
//给前端页面输出一个页面
//context.Response.ContentType = "text/html";
//context.Response.Write("<html><head><body><h1>你好</h1></body></head></html>");
//给前端页面输出一个图片
context.Response.ContentType = "image/jpg";
context.Response.Write("合照.jpg");
}
public bool IsReusable {
get {
return false;
}
}
}