开发者

Would the following code make an http request to the server?

开发者 https://www.devze.com 2023-04-05 09:28 出处:网络
Would this code make a http request or 开发者_开发知识库is it just faking it? var writer = TextWriter.Null;

Would this code make a http request or 开发者_开发知识库is it just faking it?

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);


It is faking the presence of a HttpRequest. Nothing goes across the wire when executing this code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号