c# login to IBM CLM exception
http://blog.boriskuschel.com/2012/02/c-with-visual-studio-and-rational-team.html?showComment=1399373273027#c2233627067206926337
I am stuck at the part where the code throws an exception at the last instruction:
if ((header != null) && header.Equals("authrequired"))
{
documentResponse.GetResponseStream().Flush();
documentResponse.Close();
// The server requires an authentication: Create the login form
HttpWebRequest formPost = (HttpWebRequest)WebRequest.Create(serverURI + "/j_security_check");
formPost.Method = "POST";
formPost.Timeout = 30000;
formPost.CookieContainer = request.CookieContainer;
formPost.ContentType = "application/x-www-form-urlencoded";
String output = "j_username=" + login + "&j_password=" + password;
Byte[] outputBuffer = Encoding.UTF8.GetBytes(output);
formPost.ContentLength = outputBuffer.Length;
Stream stream = formPost.GetRequestStream();
stream.Write(outputBuffer, 0, outputBuffer.Length);
stream.Close();
// Step (2): The client submits the login form
if (DEBUG) Console.WriteLine(">> POST " + formPost.RequestUri);
HttpWebResponse formResponse = (HttpWebResponse)formPost.GetResponse();
..
}
Error: The remote server returned an error: (408) Request Timeout.
I wonder whats wrong ...
Best regards
Can you please help ?
2 answers
Comments
Hi,
The code fails with an exception -_-''
System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at JazzConsoleApplication.Program.SendRequest(String repository, String service, SecurityContext context) in C:\Users\timo\Desktop\JazzConsoleApplication_VS2010\JazzConsoleApplication\Program.cs:li
ne 128
at JazzConsoleApplication.Program.Main(String[] args) in C:\Users\timo\Desktop\JazzConsoleApplication_VS2010\JazzConsoleApplication\Program.cs:line 39
I put
string repository = "https://timo-pcvirtual:9443/jazz/";
and the proxy stuff i didnt changed.
I have modified to
"https://timo-pcvirtual:9443/jts/";
Now the code does something untill
Console.WriteLine("Getting Project Areas...");
SendRequest(repository, "secure/service/com.ibm.team.process.internal.common.service.IProcessRestService/allProjectAreas?", context);
Here fails with error
System.Net.WebException: The remote server returned an error: (500) Internal Server Error.