SharePoint 2010和ASHX处理器

本文关键字:处理器 ASHX 2010 SharePoint | 更新日期: 2023-09-27 18:09:24

我试图得到一个web部件部署和使用一个Silverlight web部件内的上传控件。然而,当我访问我的ashx时,在应用程序日志中收到以下错误:

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

我有一个UploadHandler.cs文件与以下代码:

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);
        }
    }
}

}

在我的。ashx文件中有以下内容:

<%@程序集名称="Microsoft。SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@程序集名称="FileUploadSP,版本=1.0.0.0,文化=中性,PublicKeyToken=7c8e2c3ef53023ee" %><%@ WebHandler语言=" c# " Class="FileUploadSP. "UploadHandler " %>

我无法使.ashx像我期望的那样工作。我错过了什么?

谢谢!

SharePoint 2010和ASHX处理器

检查您的程序集是否在网上。配置安全列表,并已部署到GAC, iis重置。

Ashx可以被阻止(并在中央管理中解锁),但我猜从你的错误,这不是情况。

对我来说,它是在中央admin ->安全下被阻止的文件类型。