tags:

views:

31

answers:

1

I have a small quick and dirty app that needs to post data to asp form. I'm not a developer by trade so please don't hammer me.

I have an array thats returned with two values:

static public string[] get_status(string local_fname)
{
    var dts_doc = new HtmlAgilityPack.HtmlDocument();
    dts_doc.Load(local_fname);

    //Pull the values
    var ViewState = dts_doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/div[1]/input[4]/@value[1]");
    var EventValidation = dts_doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/div[2]/input[1]/@value[1]");

    string ViewState2 = ViewState.Attributes[3].Value;
    string EventValidation2 = EventValidation.Attributes[3].Value;    

    //Display the values

    //System.Console.WriteLine(ViewState.Attributes[3].Value);
    //System.Console.WriteLine(EventValidation.Attributes[3].Value);
    //System.Console.ReadKey();
    return new string[] { ViewState2, EventValidation2 };
}

These two values need to get posted to the ASP page and results returned in the browser (ie, firefox, chrome, safari, opera, ect...)

I found this link and this, however, I'm not sure if that does what I need. Any help is greatly appreciated. I'm using C# Express 2010.

A: 

Another quick and dirty fix:

 new WebClient().UploadData("htp://mycoolsite.com", Encoding.UTF8.GetBytes(ViewState2));
Aliostad
WebClient comes up as could not be found. Am I missing something?
shaiss
new System.Net.WebClient() should do the trick.
Aliostad
Also System.Text.Encoding....
Aliostad
That worked, however an exception is thrown.
shaiss