I am trying to use HttpHandler in Asp.Net.I have made below changes in Web.Config file.
<httpHandlers>
<add verb="*"path="Crm"validate="false"type="PracticeWeb.ApplicationController,PracticeWeb"/>
</httpHandlers>
Also in ApplicationController.cs file
public class ApplicationController : System.Web.UI.Page, System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
public ApplicationController()
{
//
// TODO: Add constructor logic here
//..
}
public void ProcessRequest(HttpContext context)
{
HttpRequest Request = context.Request;
HttpResponse Response = context.Response;
// This handler is called whenever a file ending
// in .sample is requested. A file with that extension
// does not need to exist.
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
{
// To enable pooling, return true here.
// This keeps the handler in memory.
get { return false; }
}
}
I get the following error. on following line of Web.Config
<add verb="*" path="Crm" validate="false" type="PracticeWeb.ApplicationController,PracticeWeb"/>
Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'PracticeWeb' or one of its dependencies. The system cannot find the file specified.
Url used to access the application. http://localhost:1300/WebSitesPrac/Crm
The
ApplicationController
inherits fromSystem.Web.Page
. Try removing this from the class definition and just implement IHttpHandler and IRequiresSessionState.By deriving from the base type for WebForms your handler will be loading a lot of other types when it runs. I am not sure if this is the root cause of the problem but it is a good place to start.