先前介紹過 用WebClient存取網站內容 的技巧,在實務上有個狀況: 當存取對象的ASPX發生程式錯誤,呼叫端只會得知是HTTP 500應用程式出錯,但錯誤細節無從得知。 例如以下範例: protected void Page_Load( object sender, EventArgs e) { //加入故意產生錯誤邏輯 if (Request[ "err" ] != null ) throw new NotImplementedException(); WebClient wc2 = new WebClient(); string s = wc2.DownloadString...