I have a C# application to access data from a third party website. I'm using WebClient and I call DownloadData and process the bytes(DownloadFile would yield similar results).
This worked fine until recently. Now, more often than not, instead of the desired XML file, I get an html page similar to:
<!-- _localBinding -->
<!-- _lcid="1033" _version="" -->
<html>
    <head>
        <meta HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" />
        <meta HTTP-EQUIV="Expires" content="0" />
        <noscript>
            <meta http-equiv="refresh" content="0; url=/_layouts/spsredirect.aspx?noscript=1" />
        </noscript>
        <script language="javascript" src="/_layouts/1033/init.js"></script>
        <script language="javascript" src="/_layouts/1033/core.js"></script>
        <script language="javascript">
        var requestedUrl = escapeProperly(window.location.href);
        STSNavigate("/CustomErrors/ErrorPage.aspx?oldUrl=" + requestedUrl);
    </script>
    </head>
    <body></body>
</html>
I'm stumped as to why this went from consistently working to consistently giving me problems. Sometimes, I can still get the expected XML file. Do you have an idea of what this issue might be and how I can fix it?
It might be worth noting that if I were to click the download link manually in a browser, a javascript window would pop up and close before the file downloads. I'm using WebBrowser to intercept the non-static URL of that popup and pass that link (and headers/cookie information) to WebClient. The link would look something like https://foo.bar/Something.axd?Session=1234vv1234Format=XML
Thanks for your time
 
     
    