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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

4 Comments

i have created module but i need to start two classes at a time at each request
but in both classes you are implementing IHTTPHandler. The error you are getting is due to not implementing IHttpModule.
it goes like this public class clsMyHandler2 : IHttpModule
also for two requests at a time you need to create two separate modules and add separate entries in web.config

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.