2016-05-25 7 views
0

sharePoint 2010アプリケーションでExcelおよびPDFファイルを作成しています。私は作成されたすべてのフォルダ/ファイルを圧縮するルーチンを作成しましたが、 "タイプ 'System.Security.Permission.FileIO.Permission、mscorlib、...'のアクセス許可の要求があります。 以下は私のコードです。私はwebformプロジェクトでそれを試して、それは正常に動作します。 私はionic.zipライブラリにC#SharePoint 2010 zip作成の許可が拒否されました

public void GetZipOfFile(string zipname, string DirectoryToZip) 
    { 
    try 
    { 
     zipname += ".zip"; 
     HttpResponse oResponse = HttpContext.Current.Response; 
     oResponse.Clear(); 
     oResponse.Charset = ""; 
     using (ZipFile zip = new ZipFile()) 
     { 
     System.IO.Directory.GetFiles(DirectoryToZip); 
     zip.Comment = String.Format("This zip archive was created For Access Bank InfoPool"); 
     zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression; 
     zip.AddDirectory(DirectoryToZip); 
     zip.Save(oResponse.OutputStream); 
     zip.Dispose(); 
     } 
     oResponse.ContentType = "application/octet-stream"; 
     oResponse.AddHeader("Content-Disposition", "attachment;filename=\"" + zipname + "\""); 
     oResponse.End(); 
    } 
    catch (Exception ex) 
    { 
    lblMessage.Visible = true; 
    lblMessage.Text = ex.Message; 
    } 
} 

を使用すべてのヘルプは理解されるであろう。

答えて

0

解決!それは信頼レベルの問題でした。私は間違った設定ファイルを編集していました(私は最初の開発者ではなく、完成するために参加しました)。

ありがとうございました。

関連する問題