Best way to use Redmine REST API over https from .net?
protected void Page_Load(object sender, EventArgs e)
{
string host = ConfigurationManager.AppSettings["redmineHost"].ToString();
string key = ConfigurationManager.AppSettings["redmineKey"].ToString();
// var manager = new RedmineManager(host, user,pass);
var manager = new RedmineManager(host, key);
string str= ReadIssue(host, key);
Response.Write(str);
}
public string ReadIssue (string host,string key)
{
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, error) => true;
var request = (HttpWebRequest)WebRequest.Create(host+"/issues/1083.json?key="+key+"");
request.CookieContainer = new CookieContainer();
request.Method = "GET";
request.ContentType = "application/json";
using (var response = request.GetResponse()) // Hangs here
using (Stream responseStream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
return reader.ReadToEnd();
}
}
No comments:
Post a Comment