Free Support Forum -

Files being created in windows temp


we are using version 2.19 of the product. We have noticed that for some files types when we preview them, most notably with PDFs, that the a file is also created in the windows temp folder as well as the specified RootStoragePath location which something completely different. Is this expected? Fixed in a later version? Is there a property to stop in happening?

The code we are using is:-

DocURL = DocURL.Replace(""", string.Empty);
RootStoragePath = RootStoragePath.Replace(""", string.Empty);
LicensePath = LicensePath.Replace(""", string.Empty);
Height = Height.Replace(""", string.Empty);
Width = Width.Replace(""", string.Empty);
OrgName = OrgName.Replace(""", string.Empty);


        //Create a stream for the file
        System.Net.HttpWebResponse fileResp = null;
        System.Net.HttpWebRequest fileReq = null;
        NetworkCredential nc = null;
        CredentialCache cache = null;

        var username = ConfigurationManager.AppSettings["SharePointUserName"].ToString();
        var password = ConfigurationManager.AppSettings["SharePointPassword"].ToString();
        var domain = ConfigurationManager.AppSettings["SharePointDomain"].ToString();

        var configUsername = ConfigurationManager.AppSettings["SharePointUserName"].ToString();
        var configPassword = ConfigurationManager.AppSettings["SharePointPassword"].ToString();
        var configDomain = ConfigurationManager.AppSettings["SharePointDomain"].ToString();

        //Get Credentials from App Settings
        if (!string.IsNullOrEmpty(OrgName))
            PeppermintNotificationService.SharepointNotificationServiceClient snc = new PeppermintNotificationService.SharepointNotificationServiceClient();
            var spCredentials = snc.GetSharePointCredentials(new LogonInfo() { AccessKey = new Guid("{E4E01277-D41E-4F0E-9699-8F9E1619AD27}"), Organization = OrgName });

            if (spCredentials.Success)
                var res = spCredentials.Result;

                if (!string.IsNullOrEmpty(res.Username) && !string.IsNullOrEmpty(res.Password) && !string.IsNullOrEmpty(res.Domain))
                    username = res.Username;
                    password = res.Password;
                    domain = res.Domain;

        //Set Credentials
        nc = new NetworkCredential(username, password, domain);
        cache = new CredentialCache();
        cache.Add(new Uri(DocURL), "NTLM", nc);

        //Create a WebRequest to get the file
        fileReq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(DocURL);
        fileReq.Credentials = cache;

            //Create a response for this request
            fileResp = (System.Net.HttpWebResponse)fileReq.GetResponse();
            //Try the credentials from the web.config file

            nc = new NetworkCredential(configUsername, configPassword, configDomain);
            cache = new CredentialCache();
            cache.Add(new Uri(DocURL), "NTLM", nc);

            //Create a WebRequest to get the file
            fileReq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(DocURL);
            fileReq.Credentials = cache;

            //Create a response for this request
            fileResp = (System.Net.HttpWebResponse)fileReq.GetResponse();

        // Copy the stream to a memorystream so we can seek around it
        MemoryStream ms = new MemoryStream();

        string fileName;

        // Faff: Generate a hash unique to the file to use as the name
        using (MD5 md5 = MD5.Create())
            ms.Position = 0;
            var hash = md5.ComputeHash(ms);
            fileName = string.Concat(hash.Select(x => x.ToString("X2")));
            ms.Position = 0;

        return Groupdocs.Web.UI.Viewer.ClientCode()
         .Stream(ms, fileName, GetFileExtension(DocURL), GetFileName(DocURL, false))

Kind regards


Thanks for posting to our forum.

You are using a very old version of GroupDocs.Viewer which is now obsolete and not supported anymore. We recommend you to please migrate to the next generation GroupDocs.Viewer for .NET. Please note that the next generation API (starting from v3.0.0) is completely different from the older versions and front-end UI has been disintegrated from the back-end API. Now, you will have to create your own front-end application that will be used to display the HTML pages or images rendered by the back-end GroupDocs.Viewer API.

We recommend you to please have a look at the documentation of the next generation API. To explore and evaluate the features of the API please download the examples project. In case you would have any questions or queries, please feel free to let us know.

Hi - many thanks for the response. We are indeed looking at upgrading. However would it possible to confirm if storing files in c:windows\temp is expected in our current version and will it occur when we upgrade?


Thanks for coming back to us.

Except for the following document formats, the next-generation GroupDocs.Viewer for .NET does not use Windows temp folder while rendering the documents:

  • DJVU
  • DWF

Furthermore, we are also working to make sure that the API does not use the Windows temp folder for any document format. In case you would have any other question or query, please do let us know.


We are glad to inform you that starting from v18.10 of GroupDocs.Viewer for .NET, the temp files will not be created anymore in Windows’ temp folder when rendering DJVU documents. We shall notify you here as soon as v18.10 is released.