I am fetching WEB.API from xamarin forms application.Web API created in .Net Web API. But i am getting error
{StatusCode: 403, ReasonPhrase: 'ModSecurity Action', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET
X-Powered-By-Plesk: PleskWin
Date: Sat, 02 Sep 2017 07:59:38 GMT
Content-Type: text/html
Content-Length: 2684
}}
Same URL is giving proper output from Browser and postman also. I am using below code to fetch web api. I am not getting exactly what happening.
string RestUrl = "http://msystemtest.msystem.co/api/Users?userId={0}&pass={1}";
var uri = new Uri(string.Format(RestUrl, uid, pass));
string resp = string.Empty;
var response = await client.GetAsync(uri);
string statHold = string.Empty;
if(response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
resp = JsonConvert.DeserializeObject<string>(content);
}
If "http://msystemtest.msystem.co/api/Users?userId=test&pass=1" this URL directly run from browser and from postman its giving proper output.
uriresult? Maybe the format has wrong input parameters