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...
c# download cefsharp
add a comment |
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...
c# download cefsharp
1
What version are you using? Does the problem reproduce if you apply yourDownloadHandlerto github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest-prerelease). 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 anapp.manifestwithcompatibilityentries, 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
add a comment |
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...
c# download cefsharp
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
c# download cefsharp
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 yourDownloadHandlerto github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest-prerelease). 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 anapp.manifestwithcompatibilityentries, 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
add a comment |
1
What version are you using? Does the problem reproduce if you apply yourDownloadHandlerto github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest-prerelease). 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 anapp.manifestwithcompatibilityentries, 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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
What version are you using? Does the problem reproduce if you apply your
DownloadHandlerto github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/69 (branch using the latest-prerelease). 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.manifestwithcompatibilityentries, 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