0
這裏是表單數據,從谷歌瀏覽器了HTTPClient後不工作 - 沒有錯誤
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);
通常我已經試過周圍的混亂數據看是否有什麼不喜歡的東西,但這都浪費時間。
我不會發布這樣的問題,除非我真的花了太多時間試圖弄清楚。如果有人看到我看不到的東西,請告訴我。
否則不會出現錯誤,並且調試結束時的文件輸出顯示重新加載的頁面沒有更改。
餅乾使用的JAR - 不缺餅乾
您是否嘗試過檢查您的http流量(例如Fiddler)? – ne1410s
鉻當量?我在chrome中也使用了高級客戶端。 –