web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Download file from https

(0) ShareShare
ReportReport
Posted on by 4,075

I am trying to download some html from a homepage, and it works when i try to get the data from the http:// link, but if i try with the https:// link then it fails.
With the https link my files contains some string saying that i need to clear my cache and try again. (The string i get is in danish so posting it here is probably not helpful)

I am using this code.

static void TestDownloadHttpsArgs _args)
{
System.Net.WebClient myWebClient;
str content;
FileName outFile = @"C:\Temp\Result.fil";
str url = "somwdomain/somefile.htm";

;
new InteropPermission(InteropKind::ClrInterop).assert();

myWebClient = new System.Net.WebClient();
myWebClient.DownloadFile(url,outFile);
}

Does anyone have any idea how to fix the cashing problem?

I have tried changing caching settings in my internet explorer, but that seems to make no difference.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Can you open the URL in browser?

  • Rudi Hansen Profile Picture
    4,075 on at

    Yes, (Knew i should have put that in the original post)

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    The exact error message would help, as well as information about the web server response (e.g. HTTP status code). Fiddler might help to collect more information.

  • Rudi Hansen Profile Picture
    4,075 on at

    Well i do not really get any error messages, the file i get just contains this string.

    "Beklager - Ryd venligst din browsers cache, og prøv igen. Test evt. med incognito mode (in private mode).<br>Aktiveres med CTRL+SHIFT+N eller CTRL+SHIFT+P. I denne tilstand er alle personlige browser-data fjernet midlertidigt."

    Translation, please clear your browser cache.

    I don't know what Fiddler is.

  • Jonathan  Halland Profile Picture
    11,310 on at

    Hi Rudi.

    I'm not sure if I can help you in this specific instance, but I have come across issues when accessing "secure" content via either C# or X++ where you need to accept the certificate being issued by the site before you can access the content. You can try accomplish this by accessing the content in Internet explorer, viewing the sites certificate and adding it manually to your certificate store.

    To do this automatically in code is a bit more complex and depending on your scenario may not be entirely necessary.

    This may not solve your issue, but we did struggle with unexplained errors because of this.

  • Rudi Hansen Profile Picture
    4,075 on at

    Hi Jonathan, i tried accepting the certificate, and that did not help.

    But i learned one thing from it, actually when i try to open the link in the IE browser i get the same error as with AX, (I am using Chrome on the machine, and with that it works perfectly)

    So the problem is properly more related to IE than my code, so perhaps that will help me finding the problem.

  • Rudi Hansen Profile Picture
    4,075 on at

    And now i also got the link to work in IE, but still i get the same problem in AX.

    Even if i run AX as the same user as where IE works.

    And i also tried restarting the server, AOS and all, it still does not work :-(

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Fiddler is an HTTP proxy used for debugging, traffic recording and so on.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans