Forum  General Visual ...  Announce It! ( ...  Easy downloading API was added to 6.4 and will be released with the next version.
Previous Previous
 
Next Next
New Post 12/20/2010 3:18 AM
  sramirez@dynacal.com
381 posts
3rd Level Poster


Re: Easy downloading API was added to 6.4 and will be released with the next version. 
Modified By sramirez@dynacal.com  on 12/20/2010 7:46:14 AM)

If I don't want to use an Image but a file like a CSV what resourcehandle do I use?

I have tried the URLResourceHandle with the following code:

Link.Download(New Resources.UrlResourceHandle("Resources/Sample Download.doc"))

Is this the correct way to do it?

Also, in IE, I had to enable the Intranet setting in order for it to allow me to download the file when running from localhost.  When I put this onto a production website am I going to have to have my IE8 users change their settings to be able to download the file using the Link.download?   If the answer is yes, they will have to change their settings, is there another way to do it so they don't have to change their settings?

Thanks,

Shawn

 
New Post 12/21/2010 3:03 PM
  palli
11824 posts
1st Level Poster




Re: Easy downloading API was added to 6.4 and will be released with the next version. 

Hi Shawn,

Regarding the ResourceHandles in general, then the different types of ResourceHandles (ImageResourceHandle, AssemblyResourceHandle ...) can be considered as helper classes, making it easier for you to construct an Url to a resource, but all of them do actually render as an Url to the resource being referenced. The ImageResourceHandle is a shortcut for referencing images on the Resources/Images folder etc.

You should be able to use the UrlResourceHandle as you do in your post.

Regarding the need to change IE's security settings to allow the downloads, does arise from the fact that IE consideres as insecure all resources requested for download that are not requested from within the context of a click event handler, which in this case means a JavaScript click event handler. Using Link.Download will issue a server-side initiated request for a download, so IE will decide it is an insecure resource being downloaded, so it's blocked by default. You need to realize here that if you have a Visual WebGui Button for download, and within that Button's Click event handler you issue the Link.Download, then this is a server-side code that will execute and initiate the Link.Download, not a JavaScript one... hope you understand the difference here.

The only way to make a "secure" download happen, is to make it execute in JavaScript within an event handling JavaScript method, as mentioned above. One way to make it work is to use a LinkLabel and set the Url, plus set the LinkLabel.ClientMode = True, which makes the handling of the click execute in JavaScript on the client.

To demonstrate, consider the following code:

 

Public Class DLForm
    Private Sub DLForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LinkLabel1.Url = "/Resources/Test.docx"
        LinkLabel2.Url = "/Resources/Test.docx"
        LinkLabel2.ClientMode = True
    End Sub
 
End Class

In this case a click to LinkLabel1 will be blocked, while a click to LinkLabel2 will show you the SaveAs dialog in IE right away.

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  Announce It! ( ...  Easy downloading API was added to 6.4 and will be released with the next version.
Assessment Bottom
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS