This is a migrated thread and some comments may be shown as answers.

Downloading cached file issue

1 Answer 50 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
technotes
Top achievements
Rank 1
technotes asked on 03 May 2013, 07:06 PM
I will try to explain as best as possible the issue I am finding with the File Explorer control.

So I have user Bob upload file test.txt into the website.
User Jenny downloads that Text.txt and makes changes to it and save it to My documents on the local drive.

Then Jenny uploads that file back to the website and overwrites the original with her new changes.

If Jenny decides to make more changes to that file she goes and downloads that file again from the website. (Lets just say 10 minutes later)
But.. when Jenny downloads that file again and opens it she no longer has her changes from before but has the original file uploaded by Bob. 

What I think is happening is that the file itself is cached in the temporary IE download files and IE doesn't actually download the file again it retrieves it from the previously downloaded files. 

How do I force the file to download the new file.  I know it's the new one because the timestamp of the file has changed from when Bob loaded it and when Jenny changed it.

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 07 May 2013, 04:54 PM
Hello,

My colleague Mihail has already answered your support ticket on the subject - for convenience I am pasting his answer here as well:

The experienced behavior indeed is caused because of the browser caching. I would suggest you to add a random query string to the files URL's whenever a folder is reloaded. For this purpose you will need to create an instance of the FileExplorer's built-in FileSystemContentProvider and override its ResolveDirectory() method in a similar way:
public override DirectoryItem ResolveDirectory(string path)
{
    var orgDir = base.ResolveDirectory(path);
    var random = new Random().Next();
   
    foreach (var file in orgDir.Files)
    {
        file.Url = file.Path + "?param=" + random;
    }
   
    return orgDir;
}

For your convenience I am attaching a sample project demonstrating the approach. Please, give it a try and let me know if I could be of any further assistance.


Regards,
Veselina Raykova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
FileExplorer
Asked by
technotes
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or