txtbody.text=result; } 4、字***.aspx的html代碼中加入一條代碼 在第一行代碼<%@ page=.............................%> 中加入validaterequest=false 總結:整個代碼不過才幾行,而且還不用操心亂碼的事情,我是昨天自己在幫助文檔里偶然看見的,其實webclient類有很多下載資源和上載資源的方法,有興趣的朋友可以看看下面有關webclient類的幫助文檔: webclient 類請參見 webclient 成員 | system.net 命名空間 | webrequest | webresponse | httpwebrequest | httpwebresponse | webclient 成員(visual j# 語法) | c++ 托管擴展編程 要求 命名空間: system.net 平臺: windows 98, windows nt 4.0, windows me, windows 2000, windows xp home edition, windows xp professional, windows server 2003 系列 程序集: system (在 system.dll 中) .net framework 安全性: webpermission,用于訪問所請求的 uri 或請求被重定向到的任何 uri。關聯的枚舉:connect。 語言 c# c++ jscript visual basic 全部顯示 提供向 uri 標識的資源發送數據和從 uri 標識的資源接收數據的公共方法。不能繼承此類。 有關此類型所有成員的列表,請參閱 webclient 成員。 system.object system.marshalbyrefobject system.componentmodel.component system.net.webclient [visual basic] <comvisible(true)> notinheritable public class webclient inherits component [c#] [comvisible(true)] public sealed class webclient : component [c++] [comvisible(true)] public __gc __sealed class webclient : public component [jscript] public comvisible(true) class webclient extends component 線程安全 此類型的所有公共靜態(visual basic 中為 shared)成員對多線程操作而言都是安全的。但不保證任何實例 成員是線程安全的。 備注 webclient 類提供向 uri 標識的任何本地、intranet 或 internet 資源發送數據以及從這些資源接收數據的 公共方法。 webclient 類使用 webrequest 類提供對 internet 資源的訪問。webclient 實例可以通過任何已向 webrequest.registerprefix 方法注冊的 webrequest 子代訪問數據。 注意 默認情況下,.net framework 支持以 http:、https: 和 file: 方案標識符開頭的 uri。 webclient 類提供四種將數據上載到資源的方法: openwrite 返回一個用于將數據發送到資源的 stream。 uploaddata 將字節數組發送到資源并返回包含任何響應的字節數組。 uploadfile 將本地文件發送到資源并返回包含任何響應的字節數組。 uploadvalues 將 namevaluecollection 發送到資源并返回包含任何響應的字節數組。 webclient 類還提供三種從資源下載數據的方法: downloaddata 從資源下載數據并返回字節數組。 downloadfile 從資源將數據下載到本地文件。 openread 從資源以 stream 的形式返回數據。 要求 命名空間: system.net 平臺: windows 98, windows nt 4.0, windows me, windows 2000, windows xp home edition, windows xp professional, windows server 2003 系列 程序集: system (在 system.dll 中) .net framework 安全性: webpermission,用于訪問所請求的 uri 或請求被重定向到的任何 uri。關聯的枚舉:connect。