473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Cannot load my custom HttpHandler

I followed the example at http://support.microsoft.com/kb/308001/EN-US/
and created my own HttpHandler.

Here is the code:

using System.Web;

namespace MyNameSpace
{
public class SyncHttpHandler: IHttpHandler
{
public SynHttpHandler()
{
//
// TODO: Add constructor logic here
//
}

public bool IsReusable
{
get { return false; }
}

public void ProcessRequest(HttpContext context)
{
context.Response.Write("Hello from custom HttpHandler.");
}
}
}

I have this (inter alia) in my web.config:

<httpHandlers>
<add verb="*" path="*.sync" type="SyncHttpHandler,
SyncHttpHandler" />
</httpHandlers>

I have added the .sync extension to aspnet_isapi.dll by following the
instruction as well.

Now, when I try to check out my web application, I get this (where
Line 145 is highlighted in red).

Server Error in '/' Application.
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 type 'SyncHttpHandler' from
assembly 'SyncHttpHandler'.

Source Error:

Line 143: [snip]
Line 144: [snip]
Line 145: <add verb="*" path="*.sync"
type="SyncHttpHandler, SyncHttpHandler" />
Line 146: </httpHandlers>
Line 147: <httpModules>

So, what am I missing?

TALIA=Thanks a lot in advance.
Jul 8 '08 #1
5 7288
you used a namespace defining your type, so you must use when specifying the
type.

<add verb="*"
path="*.sync"
type="MyNameSpace.SyncHttpHandler, SyncHttpHandler" />
-- bruce (sqlwork.com)
"Author" wrote:
I followed the example at http://support.microsoft.com/kb/308001/EN-US/
and created my own HttpHandler.

Here is the code:

using System.Web;

namespace MyNameSpace
{
public class SyncHttpHandler: IHttpHandler
{
public SynHttpHandler()
{
//
// TODO: Add constructor logic here
//
}

public bool IsReusable
{
get { return false; }
}

public void ProcessRequest(HttpContext context)
{
context.Response.Write("Hello from custom HttpHandler.");
}
}
}

I have this (inter alia) in my web.config:

<httpHandlers>
<add verb="*" path="*.sync" type="SyncHttpHandler,
SyncHttpHandler" />
</httpHandlers>

I have added the .sync extension to aspnet_isapi.dll by following the
instruction as well.

Now, when I try to check out my web application, I get this (where
Line 145 is highlighted in red).

Server Error in '/' Application.
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 type 'SyncHttpHandler' from
assembly 'SyncHttpHandler'.

Source Error:

Line 143: [snip]
Line 144: [snip]
Line 145: <add verb="*" path="*.sync"
type="SyncHttpHandler, SyncHttpHandler" />
Line 146: </httpHandlers>
Line 147: <httpModules>

So, what am I missing?

TALIA=Thanks a lot in advance.
Jul 8 '08 #2
On Jul 8, 5:44*pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
you used a namespace defining your type, so you must use when specifying the
type.

*<add verb="*"
* * path="*.sync"
* * type="MyNameSpace.SyncHttpHandler, SyncHttpHandler" />

-- bruce (sqlwork.com)

"Author" wrote:
I followed the example athttp://support.microsoft.com/kb/308001/EN-US/
and created my own HttpHandler.
Here is the code:
using System.Web;
namespace MyNameSpace
{
* * public class SyncHttpHandler: IHttpHandler
* * {
* * * * public SynHttpHandler()
* * * * {
* * * * * * //
* * * * * * // TODO: Add constructor logic here
* * * * * * //
* * * * }
* * * * public bool IsReusable
* * * * {
* * * * * * get { return false; }
* * * * }
* * * * public void ProcessRequest(HttpContext context)
* * * * {
* * * * * * context.Response.Write("Hello from custom HttpHandler.");
* * * * }
* * }
}
I have this (inter alia) in my web.config:
<httpHandlers>
* * * * * * <add verb="*" path="*.sync" type="SyncHttpHandler,
SyncHttpHandler" />
</httpHandlers>
I have added the .sync extension to aspnet_isapi.dll by following the
instruction as well.
Now, when I try to check out my web application, I get this (where
Line 145 is highlighted in red).
Server Error in '/' Application.
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 type 'SyncHttpHandler' from
assembly 'SyncHttpHandler'.
Source Error:
Line 143: [snip]
Line 144: [snip]
Line 145: * * * * * *<add verb="*" path="*.sync"
type="SyncHttpHandler, SyncHttpHandler" />
Line 146: * * * *</httpHandlers>
Line 147: * * * *<httpModules>
So, what am I missing?
TALIA=Thanks a lot in advance.
Yes, that was the problem. Thank you.

One more question. In this dumb example, the ProcessRequest method
simply outputs that silly "Hello from custom HttpHandler" sentence.
Normally, in the real world, what kind of stuff do we do in this
method?

Jul 9 '08 #3
On Jul 8, 5:44*pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
you used a namespace defining your type, so you must use when specifying the
type.

*<add verb="*"
* * path="*.sync"
* * type="MyNameSpace.SyncHttpHandler, SyncHttpHandler" />

-- bruce (sqlwork.com)

"Author" wrote:
I followed the example athttp://support.microsoft.com/kb/308001/EN-US/
and created my own HttpHandler.
Here is the code:
using System.Web;
namespace MyNameSpace
{
* * public class SyncHttpHandler: IHttpHandler
* * {
* * * * public SynHttpHandler()
* * * * {
* * * * * * //
* * * * * * // TODO: Add constructor logic here
* * * * * * //
* * * * }
* * * * public bool IsReusable
* * * * {
* * * * * * get { return false; }
* * * * }
* * * * public void ProcessRequest(HttpContext context)
* * * * {
* * * * * * context.Response.Write("Hello from custom HttpHandler.");
* * * * }
* * }
}
I have this (inter alia) in my web.config:
<httpHandlers>
* * * * * * <add verb="*" path="*.sync" type="SyncHttpHandler,
SyncHttpHandler" />
</httpHandlers>
I have added the .sync extension to aspnet_isapi.dll by following the
instruction as well.
Now, when I try to check out my web application, I get this (where
Line 145 is highlighted in red).
Server Error in '/' Application.
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 type 'SyncHttpHandler' from
assembly 'SyncHttpHandler'.
Source Error:
Line 143: [snip]
Line 144: [snip]
Line 145: * * * * * *<add verb="*" path="*.sync"
type="SyncHttpHandler, SyncHttpHandler" />
Line 146: * * * *</httpHandlers>
Line 147: * * * *<httpModules>
So, what am I missing?
TALIA=Thanks a lot in advance.
After a little research of IHttpHandler, I think that mostly it is
used to do URL Rewriting. What else other than this?

Also, the C# example given at http://msdn.microsoft.com/en-us/libr...6d(VS.80).aspx
showing below:

void Button_Click(Object sender,EventArgs e)
{
Response.Write("Data submitted to this page");
}

void Page_Load(Object sender,EventArgs e)
{

// Rewrite the internal path to send the client
// to the page passed to the RewritePath method.
Context.RewritePath("HttpContext_Next.aspx");
}

I am confused by this Page_Load implementation. How is

Context.RewritePath("whatever_page.aspx");

gonna work in Page_Load of an aspx web page? Shouldn't it be in the
ProcessRequest method of a class of type IHttpHandler?

BTW, google newsgroup is sorta slow these two days. It takes about 12
hours for a post to show up.
Jul 9 '08 #4
On Jul 9, 12:11*pm, Author <gnewsgr...@gmail.comwrote:
On Jul 8, 5:44*pm, bruce barker

<brucebar...@discussions.microsoft.comwrote:
you used a namespace defining your type, so you must use when specifying the
type.
*<add verb="*"
* * path="*.sync"
* * type="MyNameSpace.SyncHttpHandler, SyncHttpHandler" />
-- bruce (sqlwork.com)
"Author" wrote:
I followed the example athttp://support.microsoft.com/kb/308001/EN-US/
and created my own HttpHandler.
Here is the code:
using System.Web;
namespace MyNameSpace
{
* * public class SyncHttpHandler: IHttpHandler
* * {
* * * * public SynHttpHandler()
* * * * {
* * * * * * //
* * * * * * // TODO: Add constructor logic here
* * * * * * //
* * * * }
* * * * public bool IsReusable
* * * * {
* * * * * * get { return false; }
* * * * }
* * * * public void ProcessRequest(HttpContext context)
* * * * {
* * * * * * context.Response.Write("Hello from custom HttpHandler.");
* * * * }
* * }
}
I have this (inter alia) in my web.config:
<httpHandlers>
* * * * * * <add verb="*" path="*.sync" type="SyncHttpHandler,
SyncHttpHandler" />
</httpHandlers>
I have added the .sync extension to aspnet_isapi.dll by following the
instruction as well.
Now, when I try to check out my web application, I get this (where
Line 145 is highlighted in red).
Server Error in '/' Application.
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 type 'SyncHttpHandler' from
assembly 'SyncHttpHandler'.
Source Error:
Line 143: [snip]
Line 144: [snip]
Line 145: * * * * * *<add verb="*" path="*.sync"
type="SyncHttpHandler, SyncHttpHandler" />
Line 146: * * * *</httpHandlers>
Line 147: * * * *<httpModules>
So, what am I missing?
TALIA=Thanks a lot in advance.

After a little research of IHttpHandler, I think that mostly it is
used to do URL Rewriting. *What else other than this?

Also, the C# example given athttp://msdn.microsoft.com/en-us/library/sa5wkk6d(VS.80).aspx
showing below:

void Button_Click(Object sender,EventArgs e)
{
* *Response.Write("Data submitted to this page");

}

void Page_Load(Object sender,EventArgs e)
{

* *// Rewrite the internal path to send the client
* *// to the page passed to the RewritePath method.
* *Context.RewritePath("HttpContext_Next.aspx");

}

I am confused by this Page_Load implementation. *How is

Context.RewritePath("whatever_page.aspx");

gonna work in Page_Load of an aspx web page? *Shouldn't it be in the
ProcessRequest method of a class of type IHttpHandler?

BTW, google newsgroup is sorta slow these two days. *It takes about 12
hours for a post to show up.
Well this one did show up quick, but before this one I replied to
bruce and thanked him/you for pointing out the mistake, which hasn't
shown up yet. Google is getting shaky.

BTW, I tried the following in my HttpHandler

public void ProcessRequest(HttpContext context)
{
//context.Response.Write("Hello from custom
HttpHandler.");
if (context.Request.RawUrl.ToLower().Contains("sync") )
{
context.RewritePath("~\index.aspx");
}
}

And then when I tried to request a page such as Default.sync, it shows
me a blank page, instead of what I was expecting to see in
index.aspx. Not sure what is going on.
Jul 9 '08 #5
On Jul 9, 12:51*pm, Author <gnewsgr...@gmail.comwrote:
On Jul 9, 12:11*pm, Author <gnewsgr...@gmail.comwrote:
On Jul 8, 5:44*pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
you used a namespace defining your type, so you must use when specifying the
type.
*<add verb="*"
* * path="*.sync"
* * type="MyNameSpace.SyncHttpHandler, SyncHttpHandler" />
-- bruce (sqlwork.com)
"Author" wrote:
I followed the example athttp://support.microsoft.com/kb/308001/EN-US/
and created my own HttpHandler.
Here is the code:
using System.Web;
namespace MyNameSpace
{
* * public class SyncHttpHandler: IHttpHandler
* * {
* * * * public SynHttpHandler()
* * * * {
* * * * * * //
* * * * * * // TODO: Add constructor logic here
* * * * * * //
* * * * }
* * * * public bool IsReusable
* * * * {
* * * * * * get { return false; }
* * * * }
* * * * public void ProcessRequest(HttpContext context)
* * * * {
* * * * * * context.Response.Write("Hello from custom HttpHandler.");
* * * * }
* * }
}
I have this (inter alia) in my web.config:
<httpHandlers>
* * * * * * <add verb="*" path="*.sync" type="SyncHttpHandler,
SyncHttpHandler" />
</httpHandlers>
I have added the .sync extension to aspnet_isapi.dll by following the
instruction as well.
Now, when I try to check out my web application, I get this (where
Line 145 is highlighted in red).
Server Error in '/' Application.
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 type 'SyncHttpHandler' from
assembly 'SyncHttpHandler'.
Source Error:
Line 143: [snip]
Line 144: [snip]
Line 145: * * * * * *<add verb="*" path="*.sync"
type="SyncHttpHandler, SyncHttpHandler" />
Line 146: * * * *</httpHandlers>
Line 147: * * * *<httpModules>
So, what am I missing?
TALIA=Thanks a lot in advance.
After a little research of IHttpHandler, I think that mostly it is
used to do URL Rewriting. *What else other than this?
Also, the C# example given athttp://msdn.microsoft.com/en-us/library/sa5wkk6d(VS.80).aspx
showing below:
void Button_Click(Object sender,EventArgs e)
{
* *Response.Write("Data submitted to this page");
}
void Page_Load(Object sender,EventArgs e)
{
* *// Rewrite the internal path to send the client
* *// to the page passed to the RewritePath method.
* *Context.RewritePath("HttpContext_Next.aspx");
}
I am confused by this Page_Load implementation. *How is
Context.RewritePath("whatever_page.aspx");
gonna work in Page_Load of an aspx web page? *Shouldn't it be in the
ProcessRequest method of a class of type IHttpHandler?
BTW, google newsgroup is sorta slow these two days. *It takes about 12
hours for a post to show up.

Well this one did show up quick, but before this one I replied to
bruce and thanked him/you for pointing out the mistake, which hasn't
shown up yet. *Google is getting shaky.

BTW, I tried the following in my HttpHandler

* * *public void ProcessRequest(HttpContext context)
* * * * {
* * * * * * //context.Response.Write("Hello from custom
HttpHandler.");
* * * * * * if (context.Request.RawUrl.ToLower().Contains("sync") )
* * * * * * {
* * * * * * * * context.RewritePath("~\index.aspx");
* * * * * * }
* * * * }

And then when I tried to request a page such as Default.sync, it shows
me a blank page, instead of what I was expecting to see in
index.aspx. *Not sure what is going on.
OK, have to do a recursive call to ProcessRequest like so:

public void ProcessRequest(HttpContext context)
{
//context.Response.Write("Hello from custom
HttpHandler.");
if (context.Request.RawUrl.ToLower().Contains("sync") )
{
context.RewritePath("~/index.aspx");
IHttpHandler handler =
System.Web.UI.PageParser.GetCompiledPageInstance(" ~/index.aspx", null,
context );
handler.ProcessRequest(context);
}
}

Not sure why a recursive call to ProcessRequest is needed.
Jul 9 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hanse Davion | last post by:
Can anyone provide some insight on what this problem could be? I have searched the web, read forums, and all the installation documentation for the dotnetnuke feeware portal from asp.net. I am...
3
by: Ralf Müller | last post by:
hi all! in my custom HttpHandler HttpContext.Current.Session is not set - why? greetings, ralf
2
by: Alex Nitulescu | last post by:
Hi. I have a web.config which says that all files with the "axd" extension should by a special handler. The handler writes some stats to the "axd" page. Public Class WhosOnHandler Implements...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
8
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
0
by: Mutley | last post by:
Hi All, I have a custom HttpHandler that handles requests for pages with my custom file extension of sfdl. Within the ProcessRequest method of the custom handler I want then to getthe page. I...
5
by: iainfogg | last post by:
I had an ASP.NET 2.0 site which works fine on my PC. I have just copied it to a server, and set it up to run in a virtual folder. The web pages work fine, but the graphics won't load - if I try to...
1
by: henke.lundin | last post by:
Hello, I am having problems with Server.Transfer(string, bool) in the ProcessRequest method of a custom HTTP handler. I get the "Error executing child request" error message. The page that I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.