472,976 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,976 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 7259
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.