本文整理汇总了C#中System.Web.UI.Page.ProcessRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Page.ProcessRequest方法的具体用法?C# Page.ProcessRequest怎么用?C# Page.ProcessRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.Page
的用法示例。
在下文中一共展示了Page.ProcessRequest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFormatter
public static IStateFormatter CreateFormatter()
{
HttpResponse response = new HttpResponse(TextWriter.Null);
HttpRequest request = new HttpRequest("__token__.aspx",
HttpContext.Current.Request.Url.ToString(), "__EVENTTARGET=true&__VIEWSTATEENCRYPTED=true");
HttpContext context = new HttpContext(request, response);
Page page = new Page();
page.EnableViewStateMac = true;
page.ViewStateEncryptionMode = ViewStateEncryptionMode.Always;
page.ProcessRequest(context);
return new TokenPersister(page).StateFormatter;
}
示例2: CreateFormatterGenerator
public static Func<IStateFormatter> CreateFormatterGenerator(bool encrypt, bool sign)
{
TextWriter writer = TextWriter.Null;
HttpResponse response = new HttpResponse(writer);
HttpRequest request = new HttpRequest("wahha.aspx", HttpContext.Current.Request.Url.ToString(),
"__EVENTTARGET=true" + ((encrypt) ? "&__VIEWSTATEENCRYPTED=true" : null));
HttpContext context = new HttpContext(request, response);
Page page = new Page() {
EnableViewStateMac = sign,
ViewStateEncryptionMode = (encrypt)
? ViewStateEncryptionMode.Always
: ViewStateEncryptionMode.Never
};
page.ProcessRequest(context);
return () => new TokenPersister(page).StateFormatter;
}
示例3: page_lifecycle_test
private void page_lifecycle_test()
{
Page page = new Page();
MockObject<HttpBrowserCapabilities> mockBrowser = MockManager.MockObject<HttpBrowserCapabilities>(Constructor.NotMocked);
mockBrowser.ExpectGetAlways("PreferredRenderingMime", "text/html");
mockBrowser.ExpectGetAlways("PreferredResponseEncoding", "UTF-8");
mockBrowser.ExpectGetAlways("PreferredRequestEncoding", "UTF-8");
mockBrowser.ExpectGetAlways("SupportsMaintainScrollPositionOnPostback", false);
MockObject<HttpRequest> mockRequest = MockManager.MockObject<HttpRequest>(Constructor.Mocked);
mockRequest.ExpectGetAlways("FilePath", "/default.aspx");
mockRequest.ExpectGetAlways("HttpMethod", "GET");
mockRequest.ExpectGetAlways("Browser", mockBrowser.Object);
MockObject<HttpResponse> mockResponse = MockManager.MockObject<HttpResponse>(Constructor.Mocked);
HttpContext mockContext = new HttpContext(mockRequest.Object, mockResponse.Object);
using (StringWriter stringWriter = new StringWriter())
using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter))
{
mockBrowser.AlwaysReturn("CreateHtmlTextWriter", htmlWriter);
page.PreInit +=
delegate(object sender, EventArgs e)
{
// Perform some action
};
page.Load +=
delegate(object sender, EventArgs e)
{
// Check/Assert the results of your action
};
page.ProcessRequest(mockContext);
}
}
示例4: CheckOnlyRenderSelf
/// <summary>
///
/// </summary>
/// <param name="ctr"></param>
/// <param name="renderMode"></param>
public static void CheckOnlyRenderSelf(Control ctr, ControlRenderMode renderMode)
{
if (renderMode.OnlyRenderSelf && renderMode.UseNewPage && ctr.Page.Items[PageExtension.PageRenderControlItemKey] != ctr)
{
Page currentPage = ctr.Page;
ctr.Parent.Controls.GetType().GetMethod("SetCollectionReadOnly", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(ctr.Parent.Controls, new object[1] { null });
Page page = new Page();
PageRenderModePageCache currentPageCache = PageRenderModeHelper.GetPageRenderModeCache(currentPage);
PageRenderModePageCache pageCache = PageRenderModeHelper.GetPageRenderModeCache(page);
SetPageLevel(pageCache, GetPageLevel(currentPageCache) + 1);
string currentPageUniqueID = GetPageUniqueID(currentPageCache);
if (currentPageUniqueID != string.Empty)
currentPageUniqueID += ",";
SetPageUniqueID(pageCache, string.Format("{0}{1}", GetPageUniqueID(currentPageCache), ctr.UniqueID));
page.AppRelativeVirtualPath = ctr.Page.AppRelativeVirtualPath;
page.EnableEventValidation = false;
InitNewPageContent(page, ctr);
page.AttachPageModules();
page.ProcessRequest(HttpContext.Current);
HttpContext.Current.Response.End();
}
}
示例5: CreateFormatterGenerator
public static Func<IStateFormatter> CreateFormatterGenerator()
{
// This code instantiates a page and tricks it into thinking that it's servicing
// a postback scenario with encrypted ViewState, which is required to make the
// StateFormatter properly decrypt data. Specifically, this code sets the
// internal Page.ContainsEncryptedViewState flag.
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);
return () => new TokenPersister(page).StateFormatter;
}
示例6: Load
/// <summary>
/// Loads the specific page.
/// </summary>
/// <param name="page">The page which to load.</param>
public static void Load(Page page)
{
HttpContext context = Http.Context;
Http.ManuallyLoadedPage = page;
page.ProcessRequest(Http.Context);
}