以下是来自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
这是我的代码
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);
通常情况下,我试图弄乱数据,看看是否有什么不喜欢的东西,但这都浪费时间。
除非我真的花了太多时间试图解决这个问题,否则我不会发布这样的问题。如果有人看到我看不到的东西,请告诉我。
否则没有错误,最后用于调试的文件输出显示重新加载的相同页面没有任何更改。
使用Cookie Jar - 不缺少Cookie
答案 0 :(得分:0)
最终发现某些东西没有正确传递。