0

Now I gues this is rather easy, but I just cannot gat it to work.

We have a Mobile Iron MDM system in out company, an I have an administrtor account. What I'm tring to do ot to download the App-Icons, that are displayed on the App lable site.

I have alle the URLs of the pictures.

Now, when I oppen a broweser Windows, log in as admin, open a second tab and enter the Picture URL, it will display the picture. But when I try to do something similar in VB, I will either get an access denied, or all I download the the HTML source of the login page i'm redirected to.

When accessing Mobile Iron via it's API, it will accept Basic Authentication in most cases, but when the calls get rather complex, the API Docuentation shows curl lines that use Username / Password instead of a base64 encoded authentication.

Beacuse of the Comments below, here's some more data.

The url of the login page is

https://emm.hettich.com/mifs/login.jsp Of course I cannot state any login data here...

A sample Picture URL is https://emm.hettich.com/mifs/admin/rest/api/v2/appstore/apps/115/images/b68b1ef8-363e-4056-b4c5-7a5a0628bbf5

Here's the code I used:

Private Sub DownloadImage(url As String, saveFilename As String)
    Dim httpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
    Dim httpWebResponse = DirectCast(httpWebRequest.GetResponse(), HttpWebResponse)
    Using stream = httpWebResponse.GetResponseStream()
        Using fileStream = File.OpenWrite(saveFilename)
            Dim bytes = New Byte(4095) {}
            Dim read = 0
            Do
                If stream Is Nothing Then
                    Continue Do
                End If
                read = stream.Read(bytes, 0, bytes.Length)
                fileStream.Write(bytes, 0, read)
            Loop While read <> 0
        End Using
    End Using
End Sub

This code does work with any "unprotcted" image from the web (like something from Google picture seach or similar). But when I use the url stated above, all I will get ist the HTML of the login page, because that's where I'm redirected to.

  • Do you have a sample of the URL – Chris Berlin Jun 23 '21 at 10:42
  • "Something similar" is obviously not the same; you need to replicate the actions your browser takes, which probably involves completing a login and getting a cookie, then submitting that cookie back with every request. This "second browser window" youre opening will have an F12 develoepr tools that will show you the exact contenst of all the requests, which will give clues. If you want targeted help you're going to have to add those screenshots / details of the request/response to your question AND you should include the code you think is "similar" so we can find the a significant differences – Caius Jard Jun 23 '21 at 12:19

0 Answers0