G
Guest
I'm trying to write a custom handler for .rtf files on our website.
Using the book "Essential ASP.Net C#" as a guide, I wrote the following and
compiled to a dll (assembly named "rtf_cl":
using System;
using System.Web;
using System.Web.SessionState;
using System.IO;
namespace rtf_cl
{
public class rtfProc : IHttpHandler
{
public void ProcessRequest(HttpContext ctx)
{
string path, fnam, basefnam;
int idx;
path = ctx.Request.PhysicalPath;
idx = path.LastIndexOf("\\");
fnam = "";
basefnam = "";
if (idx >= 0)
{
fnam = path.Substring(idx+1,
path.Length-idx-1);
basefnam = fnam.Substring(0,fnam.Length-4);
// future code here, yadda yadda
}
ctx.Response.Write("testing fnam=" + fnam + "basefnam=" + basefnam);
}
public bool IsReusable
{
get {return true; }
}
}
}
I compiled that to "rtf_cl.dll" and copied it into the bin dir of the test
web app.
I went into IIS on the test web and mapped the .rtf document extension to
aspnet_isapi.dll, and put the appropriate entry in the web.config file. When
I run the test web page, which tries to load an .rtf document, the following
error appears:
======================================
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 rtfProc from assembly rtf_cl.
Source Error:
Line 4: <system.web>
Line 5: <httpHandlers>
Line 6: <add verb="GET" path="*.rtf" type="rtfProc, rtf_cl" />
Line 7: </httpHandlers>
Line 8:
Source File: c:\inetpub\wwwroot\rtfproc\web.config Line: 6
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
======================================
So, it claims to not be able to load the type from the assembly. I'm baffled.
Thanks for any assistance.
-- Frank Shofner
Using the book "Essential ASP.Net C#" as a guide, I wrote the following and
compiled to a dll (assembly named "rtf_cl":
using System;
using System.Web;
using System.Web.SessionState;
using System.IO;
namespace rtf_cl
{
public class rtfProc : IHttpHandler
{
public void ProcessRequest(HttpContext ctx)
{
string path, fnam, basefnam;
int idx;
path = ctx.Request.PhysicalPath;
idx = path.LastIndexOf("\\");
fnam = "";
basefnam = "";
if (idx >= 0)
{
fnam = path.Substring(idx+1,
path.Length-idx-1);
basefnam = fnam.Substring(0,fnam.Length-4);
// future code here, yadda yadda
}
ctx.Response.Write("testing fnam=" + fnam + "basefnam=" + basefnam);
}
public bool IsReusable
{
get {return true; }
}
}
}
I compiled that to "rtf_cl.dll" and copied it into the bin dir of the test
web app.
I went into IIS on the test web and mapped the .rtf document extension to
aspnet_isapi.dll, and put the appropriate entry in the web.config file. When
I run the test web page, which tries to load an .rtf document, the following
error appears:
======================================
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 rtfProc from assembly rtf_cl.
Source Error:
Line 4: <system.web>
Line 5: <httpHandlers>
Line 6: <add verb="GET" path="*.rtf" type="rtfProc, rtf_cl" />
Line 7: </httpHandlers>
Line 8:
Source File: c:\inetpub\wwwroot\rtfproc\web.config Line: 6
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
======================================
So, it claims to not be able to load the type from the assembly. I'm baffled.
Thanks for any assistance.
-- Frank Shofner