0
votes

I'm trying to get a webpart deployed and using a Silverlight webpart with an upload control inside. I am however, receiving the following error in the application log when I access my ashx.

Exception information: 
Exception type: HttpParseException 
Exception message: Could not create type 'FileUploadSP.UploadHandler'. 

I've got an UploadHandler.cs file with the following code:

namespace FileUploadSP
{
public class UploadHandler : RadUploadHandler 
{
    public override void ProcessStream()
    {
        base.ProcessStream();

        if (this.IsFinalFileRequest())
        {
            string filename = this.Request.Form["RadUAG_fileName"];
            string fullPath = @"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\FileUploadSP\FileTemp\";
            SPContext.Current.Web.AllowUnsafeUpdates = true;
            FileStream fs = new FileStream(fullPath + filename, FileMode.Open);
            SPContext.Current.Web.Files.Add("/UploadLibrary/" + filename, fs, true);
            fs.Close();
            File.Delete(fullPath + filename);
        }

    }
}

}

And I have the following in my .ashx file:

<%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Assembly Name="FileUploadSP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7c8e2c3ef53023ee" %> <%@ WebHandler Language="C#" Class="FileUploadSP.UploadHandler" %>

I cannot get the .ashx to work as I expected to. What am I missing?

Thanks!

2
You'll probably get a better response over at SharePoint - Kyle Trauberman
Thanks, I'll post it over there as well. - PixelMuse

2 Answers

1
votes

Check your assembly is in the web.config safe list, and has been deployed to the GAC, with an iis reset.

Ashx can be blocked (and unblocked in central admin), but I guess from your error this is not the case.

1
votes

For me, it was the blocked file types under central admin -> security. ASHX was on the no-no list.