如何在ashx页面里面使用Response对象

2025-01-25 02:35:12
推荐回答(1个)
回答1:

using System;
using System.Web;
using System.IO;
using System.Drawing;

public class SavePhoto : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
//System.Web.UI.Page page = new System.Web.UI.Page();

context.Response.ContentType = "text/plain";

if (context.Request.Form["PHeight"] != null && context.Request.Form["PWidth"] != null && context.Request.Form["strBMP"] != null)
{
try
{
int height = int.Parse(context.Request.Form["PHeight"].ToString());
int width = int.Parse(