0

I have a web instance with some rules for blocking suspect requests and it's blocking all requests from my xamarin project. Server returns status code Forbidden and when I get the details the cause is "NoUserAgent_HEADER".

I had same problem with WebClient requests and solve that by adding webclient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); but how to solve that in requests coming from xaml?

Update

For example: <Image Source="https...." /> this is being blocked!

Éder Rocha
  • 1,538
  • 11
  • 29
  • do you mean an XF WebView control? – Jason May 20 '20 at 17:37
  • @Jason No... an image, for example: . I updated the question with this information, sorry for missing that. – Éder Rocha May 20 '20 at 17:38
  • there are many existing questions that address similar issues - I'd suggest using FFImageloading, OR simply disabling the rules for image requests. See https://github.com/luberda-molinet/FFImageLoading/wiki/Authentication-Support#custom-authentication--headers – Jason May 20 '20 at 17:41
  • @Jason I just noticed that when setting image with Binding it works, but if set xImageName.Source="..." it doesn't works. I'm migrating everything to bind. – Éder Rocha May 20 '20 at 18:01
  • @Jason it means that xamarin already sets an header, right? – Éder Rocha May 20 '20 at 18:27
  • 1
    @ÉderRochaBezerra There is one thread that you may have help:https://stackoverflow.com/questions/41301212/ffimageloading-how-to-add-authentication – Cherry Bu - MSFT May 21 '20 at 08:34

0 Answers0