I have to download some files from a server which has 2 stage authentication for a PowerPoint Addin I am trying to develop.
First, I log into the workspace through a browser...
In that browser I can call a .txt file and the contents are displayed in the browser - Great!
In my PowerPoint Addin I then have the following code for download a PP file and open it...
Globals.ThisAddIn.Application.Presentations.Open(@"https://workspace2.blahblah.com/group/corenarratives/Shared%20Documents/corenarratives/BlankPresentationTemplate.pptx");
This downloads the pptx file and opens it perfect! - Great!
I then try and download a .txt file with this code:
WebClient wc = new WebClient();
wc.DownloadFile("https://workspace2.blahblah.com/group/corenarratives/Shared%20Documents/corenarratives/rts.txt", @"C:\trev\trev.txt");
And the contents of the file contains a html error page...
When I save the .txt file as a .html file and open it in a browser it redirects me to the workspace login page...
I don't understand why the PowerPoint file opens and the .txt file doesn't?
And, how, if possible, to download the .txt file?
Can anyone help please?
Thanks