Downloading cached file issue

2 posts, 0 answers
  1. technotes
    technotes avatar
    9 posts
    Member since:
    Jan 2013

    Posted 03 May 2013 Link to this post

    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.
  2. Vessy
    Vessy avatar
    2093 posts

    Posted 07 May 2013 Link to this post


    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.

    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.
Back to Top