Here is the form data, from google chrome
ctl00$ContentPlaceHolder_Center$ScriptManager1:ctl00$ContentPlaceHolder_Center$ctl00$ContentPlaceHolder_Center$ManageGlobalExplicit$GridView_DataBoundPanel|ctl00$ContentPlaceHolder_Center$ManageGlobalExplicit$GridView_DataBound$ctl00$ctl02$ctl03$LinkButtonInsert
ctl00_ContentPlaceHolder_Center_ScriptManager1_TSM:;;System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35:en-US:88fd0407-24cf-4abd-9df5-22f81b2bc835:ea597d4b:b25378d2;Telerik.Web.UI, Version=2013.3.1114.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en-US:9d967110-0dc5-4d20-a086-c7556058bb3c:16e4e7cd:f7645509:24ee1bba:92fe8ea0:f46195d3:fa31b949:874f8ea2:19620875:490a9d4e:bd8f85e4:ed16cbdc:88144a7a:58366029;
ctl00$HiddenField_SidebarState:
ctl00$HiddenField_SiteCode:POSI
ctl00$MicrositeSetting1$DropDownList_Microsite:1001
ctl00_ContentPlaceHolder_Center_RadWindow_ProductGroup_ClientState:
ctl00_ContentPlaceHolder_Center_RadWindow1_ClientState:
ctl00_ContentPlaceHolder_Center_RadWindow_AddAction_ClientState:
ctl00_ContentPlaceHolder_Center_RadWindow_EditAction_ClientState:
ctl00_ContentPlaceHolder_Center_RadWindowManager1_ClientState:
ctl00$ContentPlaceHolder_Center$ProductNumberSearch2$TextBox_ProductSearch:
ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindow_Custom_ClientState:
ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindow_AddAction_ClientState:
ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindow_EditAction_ClientState:
ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindow_Manage_ClientState:
ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindowManager1_ClientState:
ctl00_ContentPlaceHolder_Center_ManageProductExplicit_GridView_DataBound_ClientState:
ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindow_Custom_ClientState:
ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindow_AddAction_ClientState:
ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindow_EditAction_ClientState:
ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindow_Manage_ClientState:
ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindowManager1_ClientState:
ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_GridView_DataBound_ClientState:
ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindow_Custom_ClientState:
ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindow_AddAction_ClientState:
ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindow_EditAction_ClientState:
ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindow_Manage_ClientState:
ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindowManager1_ClientState:
ctl00$ContentPlaceHolder_Center$ManageGlobalExplicit$GridView_DataBound$ctl00$ctl02$ctl03$GroupName:100000000061
ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_GridView_DataBound_ClientState:
__EVENTTARGET:ctl00$ContentPlaceHolder_Center$ManageGlobalExplicit$GridView_DataBound$ctl00$ctl02$ctl03$LinkButtonInsert
__EVENTARGUMENT:
__LASTFOCUS:
__VIEWSTATE:/wEPD....+JcOe
__VIEWSTATEGENERATOR:D86DE4A8
__SCROLLPOSITIONX:0
__SCROLLPOSITIONY:0
__ASYNCPOST:true
RadAJAXControlID:ctl00_ContentPlaceHolder_Center_RadAjaxManager1
And here is my code
vs = doc.DocumentNode.SelectSingleNode("//input[@id='__VIEWSTATE']");
vsg = doc.DocumentNode.SelectSingleNode("//input[@id='__VIEWSTATEGENERATOR']");
Console.WriteLine(vs.Attributes["value"].Value);
Console.WriteLine(vsg.Attributes["value"].Value);
content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("ctl00$ContentPlaceHolder_Center$ScriptManager1", "ctl00$ContentPlaceHolder_Center$ctl00$ContentPlaceHolder_Center$ManageGlobalExplicit$GridView_DataBoundPanel|ctl00$ContentPlaceHolder_Center$ManageGlobalExplicit$GridView_DataBound$ctl00$ctl02$ctl03$LinkButtonInsert"),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ScriptManager1_TSM", ";;System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35:en-US:88fd0407-24cf-4abd-9df5-22f81b2bc835:ea597d4b:b25378d2;Telerik.Web.UI, Version=2013.3.1114.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en-US:9d967110-0dc5-4d20-a086-c7556058bb3c:16e4e7cd:f7645509:24ee1bba:92fe8ea0:f46195d3:fa31b949:874f8ea2:19620875:490a9d4e:bd8f85e4:ed16cbdc:88144a7a:58366029;"),
new KeyValuePair<string, string>("ctl00$HiddenField_SidebarState",""),
new KeyValuePair<string, string>("ctl00$HiddenField_SiteCode", "POSI"),
new KeyValuePair<string, string>("ctl00$MicrositeSetting1$DropDownList_Microsite", "1001"),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_RadWindow_ProductGroup_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_RadWindow1_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_RadWindow_AddAction_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_RadWindow_EditAction_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_RadWindowManager1_ClientState",""),
new KeyValuePair<string, string>("ctl00$ContentPlaceHolder_Center$ProductNumberSearch2$TextBox_ProductSearch", ""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindow_Custom_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindow_AddAction_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindow_EditAction_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindow_Manage_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageProductExplicit_RadWindowManager1_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageProductExplicit_GridView_DataBound_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindow_Custom_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindow_AddAction_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindow_EditAction_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindow_Manage_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_RadWindowManager1_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageChildProductExplicit_GridView_DataBound_ClientState",""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindow_Custom_ClientState:", ""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindow_AddAction_ClientState", ""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindow_EditAction_ClientState", ""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindow_Manage_ClientState", ""),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_RadWindowManager1_ClientState", ""),
new KeyValuePair<string, string>("ctl00$ContentPlaceHolder_Center$ManageGlobalExplicit$GridView_DataBound$ctl00$ctl02$ctl03$GroupName", "100000000061"),
new KeyValuePair<string, string>("ctl00_ContentPlaceHolder_Center_ManageGlobalExplicit_GridView_DataBound_ClientState", ""),
new KeyValuePair<string, string>("__EVENTTARGET", "ctl00$ContentPlaceHolder_Center$ManageGlobalExplicit$GridView_DataBound$ctl00$ctl02$ctl03$LinkButtonInsert"),
new KeyValuePair<string, string>("__EVENTARGUMENT",""),
new KeyValuePair<string, string>("__LASTFOCUS", ""),
new KeyValuePair<string, string>("__VIEWSTATE", vs.Attributes["value"].Value),
new KeyValuePair<string, string>("__VIEWSTATEGENERATOR", vsg.Attributes["value"].Value),
new KeyValuePair<string, string>("__SCROLLPOSITIONX", "0"),
new KeyValuePair<string, string>("__SCROLLPOSITIONY", "0"),
new KeyValuePair<string, string>("__ASYNCPOST", "false"),
new KeyValuePair<string, string>("RadAJAXControlID", "ctl00_ContentPlaceHolder_Center_RadAjaxManager1")
});
getProductGroupPage = client.PostAsync(productGroupUrl, content).Result;
getProductGroupPage.EnsureSuccessStatusCode();
File.WriteAllText("out1.html", getProductGroupPage.Content.ReadAsStringAsync().Result);
Normally I've tried to mess around the data to see if there was something it wasn't liking but it has all been a waste of time.
I wouldn't post a question like this unless I really spent too much time trying to figure it out. If anyone sees something that I don't see please let me know.
Otherwise there is no errors and the file output at the end for debugging shows the same page reloaded with no changes.
Cookie Jar used - not missing cookies
最终发现有些东西没有正确通过。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.