none
File has been moved or deleted in Internet Explorer while downloading - server RRS feed

  • Question

  • We have a setup where in our application has its own file server for the clients to upload such documents and files. The metadata resides on our MS database 2012. Checking from our code and trying to debug, there is no problem within the code itself but the issue/error still persist.

        private HttpResponseMessage Download(StudyDocument studyDocument, string fileName)
            {
                var refId = id...;

                var filePath = C:\User....

                var res = new HttpResponseMessage();

                if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
                {
                    res.Content = new StreamContent(File.OpenRead(filePath));
                    res.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
                    res.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
                    {
                        FileName = fileName
                    };
                    res.StatusCode = HttpStatusCode.OK;
                }
                else
                    res.StatusCode = HttpStatusCode.InternalServerError;

                return res;
            }

    Is there any way to rework the code or to fix this?

    Thank you very much!
    Monday, April 2, 2018 3:37 PM

All replies

  • Hi,

    you code should work for hosts mapped to the Intranet or Trusted Sites zones where "Include local directory path in file uploads to a server." is enabled by default. localhost, by default maps to the Internet zone... it may be that your dev/test environment is not using the same host as the production environment.

    you can find out which IE security zone a host is mapped to from the File>Properties menu in IE.

    ...expected Intranet.

    A good place to ask website and code behind questions is stackoverflow.com in the forums for your development language (asp.net VB.net?).

    https://www.bing.com/search?q=fileupload+asp.net+stackoverflow+IE

    this looks like what you need. https://stackoverflow.com/questions/12116444/asp-net-fileupload-filename-returns-full-path-in-ie-when-not-needed

    Regards.

    Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions.


    Rob^_^

    Saturday, April 7, 2018 5:01 AM