Welcome Guest Search | Active Topics | Sign In | Register

Open or Save a downloaded file Options
M.Kramer
Posted: Thursday, January 28, 2016 10:53:50 AM
Rank: Advanced Member
Groups: Member

Joined: 11/3/2015
Posts: 65
Hello,

I want to open a dialog before downloading a file which asks if the file should be downloaded or opened directly. Is that possible?

Best regards

Marius Kramer
eo_support
Posted: Thursday, January 28, 2016 11:11:15 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You can try to handle ShouldForceDownload event and set e.ForceDownload to true in your event handler to force the browser to treat the page as a download. Note that this event is fired for both the top frame and iframes.

Thanks!
M.Kramer
Posted: Thursday, January 28, 2016 11:24:32 AM
Rank: Advanced Member
Groups: Member

Joined: 11/3/2015
Posts: 65
Hi,
thank you for your quick response.
I don’t want to force the download, but I want to give the user the possibility to open it without downloading the file.
regards
eo_support
Posted: Thursday, January 28, 2016 11:36:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
That's what force download is for. If a page can be directly opened by the browser, it will be displayed (opened) instead of being downloaded --- unless you force it as a download in this case. So if you force download, it will be downloaded, if you don't, it will be opened.
M.Kramer
Posted: Thursday, January 28, 2016 11:47:34 AM
Rank: Advanced Member
Groups: Member

Joined: 11/3/2015
Posts: 65
thank you, I will try it on monday
M.Kramer
Posted: Friday, March 18, 2016 4:44:19 AM
Rank: Advanced Member
Groups: Member

Joined: 11/3/2015
Posts: 65
okay ... monday was a lie :D ...

now I've solved the problem ...

using something like this:


private void BeforeDownload(object sender, BeforeDownloadEventArgs e)
{
e.ShowDialog = false;
}

private void DownloadCompleted(object sender, DownloadEventArgs e)
{
if (File.Exists(@e.Item.FullPath.ToString()))
{
System.Diagnostics.Process.Start(@e.Item.FullPath.ToString());
}
else
{
MessageBox.Show("Unable to open file: " + @e.Item.FullPath.ToString());
}
}

thanks :)
eo_support
Posted: Friday, March 18, 2016 8:37:52 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Great. Glad to hear that you got it working!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.