/// <summary> /// API Spam Checking /// </summary> /// <param name="ipAddress"></param> /// <param name="accountId"></param> /// <returns></returns> private bool SpamIPApiCheck(string ipAddress, int accountId, out string remarks) { bool isSpam = false; remarks = string.Empty; string ipAdd = ipAddress; string newIP = ipAddress; if (ipAdd == "::1") { newIP = "127.0.0.1"; } bool spam = formRepository.CheckForIPExclusion(newIP, accountId); if (!spam) { RestClient client = new RestClient(); client.BaseUrl = new Uri("http://www.stopforumspam.com/api?ip="); RestRequest Request = new RestRequest(); Request.AddParameter("ip", newIP); var response = client.Execute(Request); ApiResponse apiResponse = new ApiResponse(); xmlse.XmlSerializer deserializer = new xmlse.XmlSerializer(typeof(ApiResponse)); StringReader reader = new StringReader(response.Content); apiResponse = (ApiResponse)deserializer.Deserialize(reader); if (apiResponse.Apprears == "yes") { isSpam = false;//isSpam = true; temporary commented this flag need to revert change after days 'line commented by kiran on 11/05/2018 for process form submission' } if (isSpam) { remarks = "Spam IP Check Failed"; } } return(isSpam); }