I began to learn ASP.NET and C#, to get more familiar with techniques I want to make plugin for open source BugTracker.Net application. Where I am stacked is that for adding new issue application need to get HttpWebRequest on insert_bug.aspx
I did make basic thing working on code like this:
string Url = "http://localhost:8090/insert_bug.aspx";
string post_data =
"&username=admin"
+ "&password=admin"
+ "&short_desc=Description"
+ "&comment=Comment"
+ "&projectid=1"
byte[] bytes = Encoding.UTF8.GetBytes(post_data);
HttpWebResponse res = null;
try
{
HttpWebRequest req = (HttpWebRequest) System.Net.WebRequest.Create(Url);
req.Credentials = CredentialCache.DefaultCredentials;
req.PreAuthenticate =
req.Method = "POST";
req.ContentType= "application/x-www-form-urlencoded";
req.ContentLength=bytes.Length;
Stream request_stream = req.GetRequestStream();
request_stream.Write(bytes,0,bytes.Length);
request_stream.Close();
res = (HttpWebResponse) req.GetResponse();
}
catch (Exception e)
{
Console.WriteLine("HttpWebRequest error url=" + Url);
Console.WriteLine(e);
}
I want to insert also CATEGORY into my issues and reading code on insert_bug.aspx i fund part for defining category for opening issue
if (Request["$CATEGORY$"] != null && Request["$CATEGORY$"] != "") { categoryid = Convert.ToInt32(Request["$CATEGORY$"]); }
Question: What and How I can add "$CATEGORY$" to my request so the issues I added have defined category.