Is using an API for login validation safe
<p>Ok, so i am creating a c# win forms program that has a login form that uses a basic api i host on my website for the login validation (served over HTTPS).</p>

<p>So for example here is some code</p>

<pre><code>    WebClient wb = new WebClient();
    wb.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.33 Safari/537.36");
    String response = wb.DownloadString("https://www.example.com?username="+userName+"&amp;password="+password);
    if(response == "1")
    {
        //logged in
    }
</code></pre>

<p>I was just woundering if it is secure to use an API for login validation like i did in my example.. Thanks for reading</p>