开发者

C# post to ASP and return response in the browser

开发者 https://www.devze.com 2023-01-21 16:01 出处:网络
I h开发者_C百科ave 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 h开发者_C百科ave 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.


Another quick and dirty fix:

 new WebClient().UploadData("htp://mycoolsite.com", Encoding.UTF8.GetBytes(ViewState2));
0

精彩评论

暂无评论...
验证码 换一张
取 消