Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to connect to Jira Rest api from .net Web application but able to connect using console app

Anup Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 6, 2019

Hi Team,

 

I am unable to connect to JIRA Rest API using a web application , but when I use the same code inside a console application, I am able to connect. Please help me resolve this issue.

 

I am recieving the error below when trying to connect from a web application-:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

 

Please help me resolve this issue

I am using the code shown below-:

 

using (WebClient wc = new WebClient())
{
wc.Headers.Add("Authorization", "Basic " + GetEncodedCredentials());
tasks = wc.DownloadString("MyCompanyjiraURLusingJQL"));

}

string GetEncodedCredentials()
{
string mergedCredentials = string.Format("{0}:{1}", "UserName", "Password");
byte[] byteCredentials = UTF8Encoding.UTF8.GetBytes(mergedCredentials);
return Convert.ToBase64String(byteCredentials);
}

 

I think the code should work fine , as it is working for the console application and not for the web application.

 

 

 

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events