DotNetZip:使用C#权限问题创建zip [英] DotNetZip: creating zip with C# permissions issue

查看:53
本文介绍了DotNetZip:使用C#权限问题创建zip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用DotNetZip,并且注意到我在Mac上遇到了权限问题.这似乎只发生在我使用内容处理时.

I am using DotNetZip and have noticed that i am getting permission issues on Mac's. This seems to only occur when i use content disposition.

即,如果我只是将其保存到磁盘上

ie if i just save it to disk

using (ZipFile zip = new ZipFile(@"C:\zip\temp.zip"))
{
   // this works fine
}

但是,如果我使用这样的内容配置,则在Mac上,用户权限被拒绝(未选中每个组)

but if i use content disposition like so, on mac the user permissions are denied ( everyone group is unchecked)

Response.ContentType = "application/zip";
Response.AddHeader("content-disposition", "filename=" + filename);

using (ZipFile zip = new ZipFile(Response.OutputStream))
{
    // 
}

推荐答案

您可以尝试将ApplicationType更改为"application/octet-stream".信不信由你,以前对我来说已经解决了一些问题.还是值得一试.

You could try changing the ApplicationType to "application/octet-stream". Believe it or not that has fixed problems for me before. It's worth a shot anyway.

最大的问题是,如何从Mac端请求文件?如果是提供文件的Windows Web服务器,则Windows无法在客户端设置权限.如果是网络浏览器(Safari/Firefox),则可能只是在默认设置下运行.因此,了解从Mac请求文件的内容可能有助于获得正确的答案.

The biggest question is how is the file being requested from the Mac's side? If it's a Windows web server offering up the file, Windows can't set the permissions on the client side. If it's a web browser (Safari/Firefox) they're probably just running on the default settings. So knowing what is requesting the file from the Mac could help get the right answer.

这篇关于DotNetZip:使用C#权限问题创建zip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆