0

Let us consider two class with same name space and extend IHttpHandler as below

Class 1:

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

namespace MyPipeLine
{
     public class clsMyHandler1 : IHttpHandler
     {
          public void ProcessRequest(System.Web.HttpContext context)
          {
               context.Response.Write("The page request is " + context.Request.RawUrl.ToString());
          }

     }

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

Class 2:

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

namespace MyPipeLine
{
     public class clsMyHandler2 : IHttpHandler
     {
          public void ProcessRequest(System.Web.HttpContext context)
          {
               context.Response.Write("The page request is " + context.Request.RawUrl.ToString());

          }

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

in above namespace is: MyPipeLine which has two classes clsMyHandler1,clsMyHandler2 there by

i have given entry in web.config file as

 <system.webServer>
    <modules>
         <add name="mymodule" type="MyPipeLine.clsMyHandler1,MyPipeLine.clsMyHandler2" />   
      </modules>        
</system.webServer>

and when i compiled the application it throw me error as

Could not load file or assembly 'MyPipeLine.clsMyHandler2' or one of its dependencies. The system cannot find the file specified.

I think C# see all modules like classes. Do you have any idea for solving this question?

eandersson
  • 25,781
  • 8
  • 89
  • 110
GowthamanSS
  • 1,434
  • 4
  • 33
  • 58

1 Answers1

1

You want to create a module and implementing interface for HTTP Handler. Use this IHttpModule

Mujtaba Hassan
  • 2,495
  • 2
  • 20
  • 29