Jump to content
Xtreme .Net Talk

How do I create an ISAPI filter for manipulating files between server and client?


Recommended Posts

Posted

Ladies and Gentlemen,

 

I have created a VB.NET class that, when given a physical path to a .TIFF file, will output the file, edited to show a watermark.

 

What I would like to do is take this logic and put it in - I believe - an ISAPI filter, and configure my web server so that any time a file of extension .TIFF is fetched, it is put "through the wringer", so that the client browser gets the watermarked .TIFF

 

I am completely over my head at this point, so even the most simplistic of advice that gets me started is greatly appreciated.

 

Charles.

Posted

Thanks for the link! I extracted the code as suggested, yet I am still getting an error, to wit:

 

got the following error message:

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 Acme.SimpleHandler from assembly TestWM.

 

Source Error:

Line 3: <system.web>

Line 4: <httpHandlers>

Line 5: <add verb="*" path="test.aspx" type="Acme.SimpleHandler,TestWM"/>

Line 6: </httpHandlers>

Line 7: </system.web>

 

Here are the steps I went through:

 

First, I created a "Class Library" solution in VB, adding a class file like so:

Imports System.Web

Namespace Acme

Public Class SimpleHandler : Implements IHttpHandler

Public Sub ProcessRequest(ByVal Context As HttpContext) Implements IHttpHandler.ProcessRequest

Context.Response.Write("Hello World!")

End Sub

 

Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable

Get

Return True

End Get

End Property

End Class

End Namespace

 

which I compiled under the name TestWM.dll; the file of which I moved from the project's bin directory to the website's bin directory. I then created a web.config file as directed:

 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<system.web>

<httpHandlers>

<add verb="*" path="test.aspx" type="Acme.SimpleHandler,TestWM"/>

</httpHandlers>

</system.web>

</configuration>

 

The website name, as registered in my IIS directory, is WatermarkTest, and so, I entered the following URL:

 

http://localhost/WatermarkTest/test.aspx

 

giving me the resultant error message.

 

Any ideas? My hunch is that I have a security setting botched. Changing the TestWM in the web.config gives me a different batch of error messages, on the order of "I can't find any assembly named TestWM.dll or TestWM.exe in any of these default directories", yet changing the Acme.SimpleHandler to something nonsensical gives me the same error detailed above.

 

Thanks for your help,

 

Charles.

Posted

The file Imports System.web, and has the following references in the reference folder:

 

System

System.Data

System.Web

System.XML

 

And pardon my ignorance, but gac = ?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...