發送請求時出現400錯誤,錯誤代碼為:webResponse = (HttpWebResponse)webRequest.GetResponse(); 解決辦法:拋出異常 HttpWebResponse webResponse; try { webResponse = (HttpWebRespons ...
發送請求時出現400錯誤,錯誤代碼為:webResponse = (HttpWebResponse)webRequest.GetResponse();
解決辦法:拋出異常
HttpWebResponse webResponse; try { webResponse = (HttpWebResponse)webRequest.GetResponse(); //請求頁面信息 } catch (WebException ex) { webResponse = (HttpWebResponse)ex.Response; //獲得錯誤發生時候伺服器段錯誤頁面的源代碼 }