Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"The directive 'WebHandler' is unknown." Anyone know why?

Status
Not open for further replies.

ifx

Technical User
Feb 26, 2002
57
GB
Hi All,
I have a web handler (.ashx) file I created to manipulate an image. It works perfectly in one directory, but when I move it somewhere else (on a different website by on the same server) it throws up a Parser Error with the message:
The directive 'WebHandler' is unknown.

The line it indicates as causing this is the very first line of the file:
<%@ WebHandler language="VB" class="FSImgHandler" %>

I've checked Google to no avail, tried setting the directory to an Application directory but that didn't work, reuploaded the file but still no joy. Any ideas would be much appreciated. Oh, it's .NET 1.1 on IIS 6. Thanks!
 
did you recompile the code before coping to the server? did you get any errors when compiling. asp.net 1.1 doesn't have a partial build feature like asp.net 2.0.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Hi, thanks for the reply. I forgot to mention it's not compiled (in the dll sense of the word). The main contents of the actual .ashx file is below. I tried it on another website (again, on the same server), and it worked a treat. I think it might be a setting in IIS but I can't see anything different between the one that won't work and the ones that are OK. Cheers, Rob


Code:
<%@ WebHandler language="VB" class="MyImgHandler" %>

Imports System
Imports System.Web
Imports System.Data
Imports System.Data.SQLClient
Imports System.drawing
Imports System.drawing.imaging
Imports System.drawing.text
Imports System.text
Imports System.IO
Imports System.drawing.drawing2d
Imports System.Configuration.ConfigurationSettings

Public Class MyImgHandler: Implements IHttpHandler


	Public Overridable ReadOnly Property IsReusable As Boolean Implements IHttpHandler.IsReusable
		Get
			Return True
		End Get
	End Property

	Overridable Sub ProcessRequest(ByVal ctx As HttpContext) Implements IHttpHandler.ProcessRequest

End Sub

End Class
 
OK, I figured it out! Just in case anyone wants to know: I checked the web.config in the root of the website (despite my ashx being in it's own application directory which was a sub directory off the root). In there was this bit of code:

<httpHandlers>
<add verb="*" path="*.*" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>

I commented it out and now my WebHandler works! Hopefully I haven't broken anything by doing that.... doesn't look like it so far!

Cheers,
Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top