CefSharp download file permissions











up vote
0
down vote

favorite












I am new to CefSharp and trying to get it to handle downloads. I have implemented IDownloadHandler and it's downloading just how I want to a temp directory. However, after download I try to do more with the file, but it seems it's downloaded with no permissions whatsoever, so it gives me access denied when I try to do anything with it (in this case unpack the zip file).



I can go view the file through File Explorer and I get the message in the security tab 'No groups or users have permission to access this object...'. If I add myself as a user it's fine, but without doing that I can't do anything with the file.



So how do you download something and make it accessible to use?



Here is my download handler class:



class CefDownloadHandler : IDownloadHandler
{
public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
{
Debug.WriteLine("Before Download");

callback.Continue(Path.Combine(Path.GetTempPath(), downloadItem.SuggestedFileName), false);
}

public void OnDownloadUpdated(IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
{
if (downloadItem.IsComplete)
{
new FileInfo(downloadItem.FullPath).SetAccessControl(new System.Security.AccessControl.FileSecurity())
CoreApp.StartContentLoad(downloadItem.FullPath, downloadItem.Url);
}

}
}


EDIT



This seems to be related to the location after more testing. I was originally saving to the temp directory using Path.GetTempPath() and having this issue. Just to test I modifed to use a folder under %appdata% and it saves with normal permissions and works. I have access and permissions to the temp folder so I'm not sure why but it seems to be related to that...










share|improve this question




















  • 1




    What version are you using? Does the problem reproduce if you apply your DownloadHandler to github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest -pre release). I'm not seeing any problems, nor have I had other reports of problems.
    – amaitland
    Nov 7 at 10:02






  • 1




    Could be one of those cases you need an app.manifest with compatibility entries, see github.com/cefsharp/CefSharp.MinimalExample/blob/master/…
    – amaitland
    Nov 7 at 10:05










  • I'm using version 57 and unfortunately I have to do so. The program is an add-in to another program that uses CEF 57 so I have to align with that...
    – sfaust
    Nov 7 at 16:48










  • I don't think I can do a manifest when it's an add-in to another program can I? Sorry I should have mentioned that part at first. However, I am running this as a standalone application for testing the base system but in final form it will have to be embedded in the other app that I don't have control of...
    – sfaust
    Nov 7 at 16:50















up vote
0
down vote

favorite












I am new to CefSharp and trying to get it to handle downloads. I have implemented IDownloadHandler and it's downloading just how I want to a temp directory. However, after download I try to do more with the file, but it seems it's downloaded with no permissions whatsoever, so it gives me access denied when I try to do anything with it (in this case unpack the zip file).



I can go view the file through File Explorer and I get the message in the security tab 'No groups or users have permission to access this object...'. If I add myself as a user it's fine, but without doing that I can't do anything with the file.



So how do you download something and make it accessible to use?



Here is my download handler class:



class CefDownloadHandler : IDownloadHandler
{
public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
{
Debug.WriteLine("Before Download");

callback.Continue(Path.Combine(Path.GetTempPath(), downloadItem.SuggestedFileName), false);
}

public void OnDownloadUpdated(IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
{
if (downloadItem.IsComplete)
{
new FileInfo(downloadItem.FullPath).SetAccessControl(new System.Security.AccessControl.FileSecurity())
CoreApp.StartContentLoad(downloadItem.FullPath, downloadItem.Url);
}

}
}


EDIT



This seems to be related to the location after more testing. I was originally saving to the temp directory using Path.GetTempPath() and having this issue. Just to test I modifed to use a folder under %appdata% and it saves with normal permissions and works. I have access and permissions to the temp folder so I'm not sure why but it seems to be related to that...










share|improve this question




















  • 1




    What version are you using? Does the problem reproduce if you apply your DownloadHandler to github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest -pre release). I'm not seeing any problems, nor have I had other reports of problems.
    – amaitland
    Nov 7 at 10:02






  • 1




    Could be one of those cases you need an app.manifest with compatibility entries, see github.com/cefsharp/CefSharp.MinimalExample/blob/master/…
    – amaitland
    Nov 7 at 10:05










  • I'm using version 57 and unfortunately I have to do so. The program is an add-in to another program that uses CEF 57 so I have to align with that...
    – sfaust
    Nov 7 at 16:48










  • I don't think I can do a manifest when it's an add-in to another program can I? Sorry I should have mentioned that part at first. However, I am running this as a standalone application for testing the base system but in final form it will have to be embedded in the other app that I don't have control of...
    – sfaust
    Nov 7 at 16:50













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am new to CefSharp and trying to get it to handle downloads. I have implemented IDownloadHandler and it's downloading just how I want to a temp directory. However, after download I try to do more with the file, but it seems it's downloaded with no permissions whatsoever, so it gives me access denied when I try to do anything with it (in this case unpack the zip file).



I can go view the file through File Explorer and I get the message in the security tab 'No groups or users have permission to access this object...'. If I add myself as a user it's fine, but without doing that I can't do anything with the file.



So how do you download something and make it accessible to use?



Here is my download handler class:



class CefDownloadHandler : IDownloadHandler
{
public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
{
Debug.WriteLine("Before Download");

callback.Continue(Path.Combine(Path.GetTempPath(), downloadItem.SuggestedFileName), false);
}

public void OnDownloadUpdated(IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
{
if (downloadItem.IsComplete)
{
new FileInfo(downloadItem.FullPath).SetAccessControl(new System.Security.AccessControl.FileSecurity())
CoreApp.StartContentLoad(downloadItem.FullPath, downloadItem.Url);
}

}
}


EDIT



This seems to be related to the location after more testing. I was originally saving to the temp directory using Path.GetTempPath() and having this issue. Just to test I modifed to use a folder under %appdata% and it saves with normal permissions and works. I have access and permissions to the temp folder so I'm not sure why but it seems to be related to that...










share|improve this question















I am new to CefSharp and trying to get it to handle downloads. I have implemented IDownloadHandler and it's downloading just how I want to a temp directory. However, after download I try to do more with the file, but it seems it's downloaded with no permissions whatsoever, so it gives me access denied when I try to do anything with it (in this case unpack the zip file).



I can go view the file through File Explorer and I get the message in the security tab 'No groups or users have permission to access this object...'. If I add myself as a user it's fine, but without doing that I can't do anything with the file.



So how do you download something and make it accessible to use?



Here is my download handler class:



class CefDownloadHandler : IDownloadHandler
{
public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
{
Debug.WriteLine("Before Download");

callback.Continue(Path.Combine(Path.GetTempPath(), downloadItem.SuggestedFileName), false);
}

public void OnDownloadUpdated(IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
{
if (downloadItem.IsComplete)
{
new FileInfo(downloadItem.FullPath).SetAccessControl(new System.Security.AccessControl.FileSecurity())
CoreApp.StartContentLoad(downloadItem.FullPath, downloadItem.Url);
}

}
}


EDIT



This seems to be related to the location after more testing. I was originally saving to the temp directory using Path.GetTempPath() and having this issue. Just to test I modifed to use a folder under %appdata% and it saves with normal permissions and works. I have access and permissions to the temp folder so I'm not sure why but it seems to be related to that...







c# download cefsharp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 18:01

























asked Nov 7 at 6:05









sfaust

465820




465820








  • 1




    What version are you using? Does the problem reproduce if you apply your DownloadHandler to github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest -pre release). I'm not seeing any problems, nor have I had other reports of problems.
    – amaitland
    Nov 7 at 10:02






  • 1




    Could be one of those cases you need an app.manifest with compatibility entries, see github.com/cefsharp/CefSharp.MinimalExample/blob/master/…
    – amaitland
    Nov 7 at 10:05










  • I'm using version 57 and unfortunately I have to do so. The program is an add-in to another program that uses CEF 57 so I have to align with that...
    – sfaust
    Nov 7 at 16:48










  • I don't think I can do a manifest when it's an add-in to another program can I? Sorry I should have mentioned that part at first. However, I am running this as a standalone application for testing the base system but in final form it will have to be embedded in the other app that I don't have control of...
    – sfaust
    Nov 7 at 16:50














  • 1




    What version are you using? Does the problem reproduce if you apply your DownloadHandler to github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest -pre release). I'm not seeing any problems, nor have I had other reports of problems.
    – amaitland
    Nov 7 at 10:02






  • 1




    Could be one of those cases you need an app.manifest with compatibility entries, see github.com/cefsharp/CefSharp.MinimalExample/blob/master/…
    – amaitland
    Nov 7 at 10:05










  • I'm using version 57 and unfortunately I have to do so. The program is an add-in to another program that uses CEF 57 so I have to align with that...
    – sfaust
    Nov 7 at 16:48










  • I don't think I can do a manifest when it's an add-in to another program can I? Sorry I should have mentioned that part at first. However, I am running this as a standalone application for testing the base system but in final form it will have to be embedded in the other app that I don't have control of...
    – sfaust
    Nov 7 at 16:50








1




1




What version are you using? Does the problem reproduce if you apply your DownloadHandler to github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest -pre release). I'm not seeing any problems, nor have I had other reports of problems.
– amaitland
Nov 7 at 10:02




What version are you using? Does the problem reproduce if you apply your DownloadHandler to github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest -pre release). I'm not seeing any problems, nor have I had other reports of problems.
– amaitland
Nov 7 at 10:02




1




1




Could be one of those cases you need an app.manifest with compatibility entries, see github.com/cefsharp/CefSharp.MinimalExample/blob/master/…
– amaitland
Nov 7 at 10:05




Could be one of those cases you need an app.manifest with compatibility entries, see github.com/cefsharp/CefSharp.MinimalExample/blob/master/…
– amaitland
Nov 7 at 10:05












I'm using version 57 and unfortunately I have to do so. The program is an add-in to another program that uses CEF 57 so I have to align with that...
– sfaust
Nov 7 at 16:48




I'm using version 57 and unfortunately I have to do so. The program is an add-in to another program that uses CEF 57 so I have to align with that...
– sfaust
Nov 7 at 16:48












I don't think I can do a manifest when it's an add-in to another program can I? Sorry I should have mentioned that part at first. However, I am running this as a standalone application for testing the base system but in final form it will have to be embedded in the other app that I don't have control of...
– sfaust
Nov 7 at 16:50




I don't think I can do a manifest when it's an add-in to another program can I? Sorry I should have mentioned that part at first. However, I am running this as a standalone application for testing the base system but in final form it will have to be embedded in the other app that I don't have control of...
– sfaust
Nov 7 at 16:50

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53184332%2fcefsharp-download-file-permissions%23new-answer', 'question_page');
}
);

Post as a guest





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53184332%2fcefsharp-download-file-permissions%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

横浜市

Prokocim

Hungria