Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

App displays URL images from other URLs than my own

XamarinNewbeeXamarinNewbee USMember ✭✭
edited January 2019 in Xamarin.Forms

I am unable to make the URL public, but I've pasted the full URL into my browser and can confirm the page is right - the image shows in the browser.

But... when I copy that exact URL into a Xamarin.Forms image, set as:

<Image 
    HorizontalOptions="FillAndExpand"
    VerticalOptions="FillAndExpand"
    Aspect="AspectFit">
    <Image.Source>
        <UriImageSource Uri="https://mydomain.com/images/doesntshow.jpg" 
            CacheValidity="3" 
            CachingEnabled="false"/>
    </Image.Source>
</Image>

The image simply will not show.

If I substitute the URL: "https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg" the image shows fine.

NOTE: There is 0 possibility the URL is incorrect or has an error because... I'm not typing it; I'm copying/pasting it and it's showing just fine in the browser, just not the Xamarin.Forms app.

I've not a clue as to what to look for. Does anyone else?

Tagged:

Best Answer

Answers

  • JohnHJohnH GBMember ✭✭✭✭✭

    @XamarinNewbee said:
    I am unable to make the URL public, but I've pasted the full URL into my browser and can confirm the page is right - the image shows in the browser.

    But... when I copy that exact URL into a Xamarin.Forms image, set as:


    <Image.Source>

    </Image.Source>

    The image simply will not show.

    If I substitute the URL: "https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg" the image shows fine.

    NOTE: There is 0 possibility the URL is incorrect or has an error because... I'm not typing it; I'm copying/pasting it and it's showing just fine in the browser, just not the Xamarin.Forms app.

    I've not a clue as to what to look for. Does anyone else?

    Did you type the url into the browser on the device?

  • XamarinNewbeeXamarinNewbee USMember ✭✭

    No. As I had mentioned, I have ruled-out any possible mistake on my part of a "URL typo". I'm copying/pasting the URLs in every instance.

    So... once I see the URL work and the image show in my desktop browser (FF and Chrome tested), I highlight the URL in the address bar and paste that right into the Xamarin app, of course checking for any trailing spaces, etc. Performing the exact same steps for the other URLs shows the image in both the desktop browser and Xam app.

    Could there be something on my server which would 1) serve images to a reg desktop browser, but then 2) block them for the app?

  • XamarinNewbeeXamarinNewbee USMember ✭✭

    INFO UPDATE: so I just tried a third domain of mine, on the same server as the other two. This third one, we'll call DN3, has no SSL on it. Guess what - the image came through just fine in both desktop browser AND in the Xamarin app under "http".

    Even though I had tested just "http" on the other two domains, those still have a secure certificate set in IIS. My certificates are from Comodo and are up-to-date, installed properly as far as I know as they serve secure content on my websites and other apps (CGI). So what could cause this then?

  • XamarinNewbeeXamarinNewbee USMember ✭✭

    I've discovered something and need to share. I have URL rewrites on my DN1 and DN2 which rid the "www" and force SSL (https). When I disable the rules, and access the URL with "http" from the Xamarin app, the images show!

    On DN3, there are no URL rewrite rules and no SSL and hence it worked originally. So... I still need input as I want the images and everything to come across the wire secure (SSL).

    I'm on Windows server 2016. How can I address allowing the Xamarin app to access images securely and keep my (or similar) URL rewrites to force SSL and rid the "www"?

  • XamarinNewbeeXamarinNewbee USMember ✭✭

    I've disabled the rewrite rules (both of them), but still can only see the images if I use "http". Using "https" on images from MY domain doesn't work. Using "https" on images from another server works. I do not have the "require SSL" checked in IIS. Other than this and the rewrite rules, what setting might cause this?

  • XamarinNewbeeXamarinNewbee USMember ✭✭
    Accepted Answer

    ISSUE RESOLVED - thanks for the good mental vibes :)

    I found the resolution here:

    https://forums.xamarin.com/discussion/105036/images-from-url-not-showing-on-android

    April 5

    "Just change the following options and it should work with https too.
    Android Options => Advanced
    HttpClient implementation = Set to "Managed" option value
    SSL/TLS implementation = set to "Native TLS 1.2+" option value"

    I still don't understand why prior to this setting change, I could load https images from other servers just fine (e.g. "https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg"). So... I will lose a bit of sleep wondering what is different on my server from wiki's. If you have a clue, please share.

  • Goutham_HasProblemsGoutham_HasProblems Member ✭✭✭

    @XamarinNewbee , were you able to figure out what exactly the issue was?

Sign In or Register to comment.