1

I'm making an app in unity and I need to download a file. I'm using the following code to get header values:

    HttpWebRequest request =   (HttpWebRequest)System.Net.WebRequest.Create(remoteFile);
    request.Method = "HEAD"; 

    HttpWebResponse resp = null;

        try {
            resp = request.GetResponse() as HttpWebResponse;
      }catch (System.Exception e) { 
        Debug.LogWarning("ERROR: " + e);
        return;
      }

This code worked for some files, but I'm hosting a file on ge.tt, and it doesn't work on it. The link I gave it starts the download immediately in chrome.

The error is:

ERROR: System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result)

Does anyone know why is this happening?

Thank you!

Yuval3210
  • 193
  • 4
  • 14

1 Answers1

0

The link was https, and when I changed it to http it game me an authentication error, so I followd this link and fixed it.

Community
  • 1
  • 1
Yuval3210
  • 193
  • 4
  • 14