Zaky
Zaky

Reputation: 409

URLDownloadToFile and Authentication

I'm working on some old ATL OCX, that is used as "download manager". It downloads files using URLDownloadToFile API.

Previously, it was hosted as ActiveX on web page so in case the server required authentication it was done by IE. Now it is part of executable, so it should take care of authentication. Let say user provided username and password, how I can actually to do "authentication" ? I need support Simple Web Authentication and NTLM for IIS.

For Simple Web Authentication i found out that passing username/password before URL works fine. But I'm not sure that it is a proper way to so.

Please advise Thank you Zaky

Upvotes: 5

Views: 2468

Answers (1)

cprogrammer
cprogrammer

Reputation: 5675

Simple Web Authentication can be done using http://username:[email protected] and should be fine. It's a safe and simple way to do this.
If for some reason you need more than this you can re-implement this function by using InternetOpen, InternetSetOption, InternetReadFile. This should be fast and easy.

Upvotes: 3

Related Questions