<%@ WebHandler Language="C#" Class="GlobalInfoHandler" %>using System;
using System.Web;
    public class GlobalInfoHandler : IHttpHandler
    {        public void ProcessRequest(HttpContext context)
        {
           
            //context.Response.ContentType = "text/plain";
            context.Response.Write("Hello World");
        }        public bool IsReusable
        {
            get
            {
                return false;
            }
        }    }
web.config里下边这样写
  <add verb="*" path="*.aspx" type="GlobalInfoHandler" validate="false"/>要报错..配置错误 
说明: 在处理向该请求提供服务所需的配置文件时出错。请检查下面的特定错误详细信息并适当地修改配置文件。 分析器错误消息: 未能加载类型“GlobalInfoHandler”。源错误: 

解决方案 »

  1.   

      <httpHandlers>
            <add verb="*" path="*.jpg" type="程序集名称
    .GlobalInfoHandler" validate="false"/>
          </httpHandlers>
      

  2.   

    楼上的.我直接在website里加的这样.没有程序集啊..要咋搞?
      

  3.   

     public void ProcessRequest(HttpContext context) {
                string FileName = context.Server.MapPath(context.Request.FilePath);
                if (context.Request.UrlReferrer != null) {
                    if (context.Request.UrlReferrer.Host == null) {
                        context.Response.ContentType = "image/JPEG";
                        context.Response.WriteFile("~/no.jpg"); 
                    } else {
                  if (context.Request.UrlReferrer.Host.IndexOf("") > -1)                     {
                            context.Response.ContentType = "image/JPEG";
                            context.Response.WriteFile(FileName);
                        } else {
                            context.Response.ContentType = "image/JPEG";
                            context.Response.WriteFile("~/no.jpg");
                        }
                    }
                } else{
                    context.Response.ContentType = "image/JPEG";
                    context.Response.WriteFile(FileName);
                }
            }
     
    <httpHandlers>
           <add verb="*" path="*.jpg" type="IHTTPHandler实现的类, 该类所在的程序集" />
     </httpHandlers>