Allow Cleartext Non-HTTPS Internet Connections in Xamarin Forms and MAUI

If you ever need to access data or other content such as images, video, audio or other files that are NOT on an SSL secured (http://) website or web service, this guide will help you.

This is how I allow an iOS mobile app to connect to a non-https web api web service. (This is NOT SAFE and should only do this in development scenarios).

  1. In your Xamarin.Forms iOS project RIGHT CLICK  and open the Info.plist file in an XML editor of choice. I use the XML (Text) Editor choice in Visual Studio for Windows.
  2. Towards the bottom of the .plist file BEFORE the ending tags
    </dict></plist>

    add the following code snippet.

    <key>NSAppTransportSecurity</key>
    <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    </dict>
  3. Save and close the info.plist file

 

This is how I allow an Android 9+ mobile app to connect to a non-https web api web service. (This is NOT SAFE and should only do this in development scenarios).

  1. In your Xamarin.Forms Android project open the Properties/AssemblyInfo.cs file
  2. Add the following code at the bottom of the file after the UserPermission code
    [assembly: Application(UsesCleartextTraffic = true)]
  3. Save and close the file.