Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:12:49+00:00 2026-06-14T05:12:49+00:00

For the past 2 days I’m trying to get my custom HTTP handler to

  • 0

For the past 2 days I’m trying to get my custom HTTP handler to work,
but no result. I get the following error:

Could not load type ‘AlarmHandler’.
Description: An unhandled
exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and
where it originated in the code.

Exception Details: System.Web.HttpException: Could not load type
‘AlarmHandler’.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.

I followed several tutorials, but i guess I’m missing something small.
I’m using the following configuration:

  • IIS 7.5
  • DefaultPool is set to Integrated mode
  • All files are in the root directory (C:\inetpub\wwwroot)
  • NO Handler mapping defined in IIS7.5
  • Web Project

AlarmHandler.ashx.cs:

using System.Web;
public class AlarmHandler : IHttpHandler
{
    // Constructor.
    public AlarmHandler() { }


    public void ProcessRequest(HttpContext context)
    {
        HttpRequest Request = context.Request;
        HttpResponse Response = context.Response;

        // Test code.
        Response.Write("<html>");
        Response.Write("<body>");
        Response.Write("<h1>Hello from a synchronous custom HTTP handler.</h1>");
        Response.Write("</body>");
        Response.Write("</html>");
    }


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

alarms.ashx:

<% @ WebHandler language="C#" class="AlarmHandler" codebehind="AlarmHandler.ashx.cs" %>

web.config:

<configuration>
    <system.webServer>
        <handlers>
            <add name="AlarmHandler" path="*.ashx" verb="*" type="IHttpHandler" />
        </handlers>
    </system.webServer>
</configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:12:50+00:00Added an answer on June 14, 2026 at 5:12 am

    What worked for me was changing:

    <% @ WebHandler language="C#" class="AlarmHandler" codebehind="AlarmHandler.ashx.cs" %>
    

    To:

    <% @ WebHandler language="C#" class="Namespace.AlarmHandler" codebehind="AlarmHandler.ashx.cs" %>
    

    Where Namespace is the namespace in which AlarmHandler is declared.

    With this in mind, I would think that changing the handler registration to this might be a good idea:

    <add name="AlarmHandler" path="*.ashx" verb="*" type="Namespace.AlarmHandler" />
    

    As an aside, I have used HTTP handlers on many occasions and have never bothered to register them (in my case I tend to explicitly invoke them via Ajax), so this line may not even be neccessary.

    Edit:

    In this case you are not using Visual Studio, which makes things a little different in that you won’t have a bin directory, so we will have to do things a bit differently with the handler.

    At the moment your handler is split across an ASHX and a CS file. This would normally be fine, but in your case we will need to combine them.

    This should be the contents of your Alarms.ashx file (you won’t need the AlarmHandler.ashx.cs file anymore):

    <% @ WebHandler language="C#" class="AlarmHandler" %>
    
    using System.Web;
    
    public class AlarmHandler : IHttpHandler
    {
        // Constructor.
        public AlarmHandler() { }
    
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest Request = context.Request;
            HttpResponse Response = context.Response;
    
            // Test code.
            Response.Write("<html>");
            Response.Write("<body>");
            Response.Write("<h1>Hello from a synchronous custom HTTP handler.</h1>");
            Response.Write("</body>");
            Response.Write("</html>");
        }
    
        public bool IsReusable
        {
            get { return false; }
        }
    }
    

    As an aside, the tutorials you have been following would almost certainly have assumed that you were using Visual Studio, which might explain some of the difficulty you encountered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for the past four days I am trying to understand the dijkstra's algorithm. But
For the past few days, I've been receiving the same error when trying to
I have been trying for the past four days to get this working. It's
I'm trying to get the past X days counting from today back using JavaScript.
I've spent several hours over the past few days trying to get PostgreSQL to
I have spent the past 2 days wondering why this is not working, but
I've been trying for the past 2 days but ultimately failed. I would like
I've been the past days trying to test my first in-app purchse iphone application.
For the past few days I have been trying to play any sound over
I've spent the past two days just trying to enable the sending of email

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.