Free Support Forum - groupdocs.com

.NET Loading a URL that contains ~


#1

Hi,



When loading a URL to the viewer that contains a “~”

i.e. - https://www.infoportal4.com/demoserver/docs/~D14716



the file name that gets saved in the temp directory is:

https___www.infoportal4.PDF



This cause the issue of loading the same file from the cache.



Is it possible to add a new parameter to the .URL call?

i.e.

viewer.URL (,)



You can use the URL above for testing.



Thanks.

Antonio


#2

Hello Antonio,

We are sorry to hear that you have such issue.

The best choice in your situation is not to use Url method at all. The best way is to use Stream method - it has additional parameters, where you can specify your own filename along with caching policy. Here is a example:
/Instead of/
.Url(“https://www.infoportal4.com/demoserver/docs/~D14716”)
/use something like this/
.Stream(HttpWebRequest.Create(“https://www.infoportal4.com/demoserver/docs/~D14716”).GetResponse().GetResponseStream(), “Faktura.pdf”, “pdf”, “Faktura.pdf”, false)


The last Boolean parameter “tells” the GroupDocs.Viewer not to use public cached stream contents if possible.

If you will have more questions please feel free to contact us.


#3

Thanks. It works great like that :slight_smile: