本文介绍了如何添加webhandler<%@ WebHandler%>在我的.ashx文件上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dear All

when i add webhandler in my .ashx file it is not accepted, any one give me the solution for this

My handler code:


<% @ WebHandler language="C#" class="WebUI2.DownHandler" codebehind="DownHandler.cs" %>

Thanks
Sathik

推荐答案

<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;

public class Handler : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        context.Response.Write("Hello World");
    }

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


这篇关于如何添加webhandler&lt;%@ WebHandler%&gt;在我的.ashx文件上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 05:14