Thursday, 27 October 2016

Http get with authenticaion using C# dot net

 protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://jira.company.com/rest/api/latest/issue/REL-461.json";
            WebClient client = new WebClient();
            String userName = "email@Comp.com";
            String passWord = "PWD";

            client.Credentials = new System.Net.NetworkCredential(userName, passWord);

            var result = client.DownloadString(url);

            Response.Write(result);
        }