以下代码是否会向服务器发出http请求?

时间:2011-09-17 22:13:16

标签: c# .net httprequest

此代码是否会发出http请求,或者只是伪造它?

var writer = TextWriter.Null;
var response = new HttpResponse(writer);
var request = new HttpRequest("DummyFile.aspx", HttpContext.Current.Request.Url.ToString(),
                              "__EVENTTARGET=true&__VIEWSTATEENCRYPTED=true");
var context = new HttpContext(request, response);

var page = new Page
               {
                   EnableViewStateMac = true,
                   ViewStateEncryptionMode = ViewStateEncryptionMode.Always
               };
page.ProcessRequest(context);

1 个答案:

答案 0 :(得分:1)

假装存在HttpRequest。执行此代码时,没有任何内容可以通过网络。