2011-09-17 103 views
1

這段代碼會發出一個http請求嗎?還是隻是僞造它?以下代碼是否會向服務器發出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

它僞裝一個HttpRequest的存在。執行此代碼時沒有任何東西穿過網線。

相關問題