2024年4月10日发(作者:)

8 httpWebRequest = (url) as HttpWebRequest;

9 = method;

10 s = HeaderCollection;

11 Container = CookieContainer;

12 /*此属性的值存储在WebHeaderCollection中。如果设置了WebHeaderCollection,则属性值将丢失。

13 *所以放置在Headers 属性之后设置

14 */

15 tType = contentType;

16 ent = _userAgent;

17 utoRedirect = _allowAutoRedirect;

18 100Continue = false;

19

20 if (data != null)

21 {

22 riteStreamBuffering = true;

23 using (Stream requestStream = uestStream())

24 {

25 (es(data), 0, );

26 ();

27 }

28 }

29

30 HttpWebResponse httpWebResponse = ponse() as HttpWebResponse;

31 if (httpWebResponse != null)

32 {

33 GetResponse(ref httpResult, httpWebResponse);

34 ();

35 }

36 }

37 catch (WebException webException)

38 {

39 GetWebExceptionResponse(ref httpResult, webException);

40 }

41 catch (Exception ex)

42 {

43 GetExceptionResponse(ref httpResult, ex, method, contentType);

44 }

45 finally

46 {

47 if (httpWebRequest != null)

48 {

49 ();

50 }

51 }

52

53 return httpResult;

54 }