本文整理汇总了C#中System.Web.HttpApplication.CompleteRequest方法的典型用法代码示例。如果您正苦于以下问题:C# HttpApplication.CompleteRequest方法的具体用法?C# HttpApplication.CompleteRequest怎么用?C# HttpApplication.CompleteRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpApplication
的用法示例。
在下文中一共展示了HttpApplication.CompleteRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginRequest
public void BeginRequest(HttpApplication context)
{
if (_host == null)
return;
if (context.Request.ContentType == ContentType.RTMPT)
{
context.Response.Clear();
context.Response.ContentType = ContentType.RTMPT;
ThreadContext.Properties["ClientIP"] = HttpContext.Current.Request.UserHostAddress;
if (Log.IsDebugEnabled)
Log.Debug(__Res.GetString(__Res.Rtmpt_Begin));
try
{
FluorineWebContext.Initialize();
if (context.Request.Headers["RTMPT-command"] != null)
{
Log.Debug(string.Format("ISAPI rewrite, original URL {0}", context.Request.Headers["RTMPT-command"]));
}
if (_host.MessageServer != null)
_host.MessageServer.ServiceRtmpt();
else
{
if (Log.IsFatalEnabled)
Log.Fatal(__Res.GetString(__Res.MessageServer_AccessFail));
}
if (Log.IsDebugEnabled)
Log.Debug(__Res.GetString(__Res.Rtmpt_End));
// Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event
context.CompleteRequest();
}
catch (Exception ex)
{
Log.Fatal(__Res.GetString(__Res.Rtmpt_Fatal), ex);
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.Status = __Res.GetString(__Res.Rtmpt_Fatal404) + " " + ex.Message;
// Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event
context.CompleteRequest();
}
}
}
示例2: Respond
public override void Respond(HttpApplication application, GlimpseConfiguration configuration)
{
var response = application.Response;
var mode = application.GetGlimpseMode();
response.Write(
string.Format(
"<html><head><title>Glimpse Config</title><script>function toggleCookie(){{var mode = document.getElementById('glimpseState'); if (mode.innerHTML==='On'){{mode.innerHTML='Off';document.cookie='glimpseState=Off; path=/;'}}else{{mode.innerHTML='On';document.cookie='glimpseState=On; path=/;'}}}}</script><head><body><h1>Glimpse Config Settings:</h1><ul><li>On = {0}</li><li>Allowed IP's = <ol>",
configuration.On));
foreach (IpAddress ipAddress in configuration.IpAddresses)
{
response.Write(string.Format("<li>{0}</li>", ipAddress.Address));
}
response.Write("</ol></li><li>Allowed ContentType's = <ol>");
foreach (ContentType contentType in configuration.ContentTypes)
{
response.Write(string.Format("<li>{0}</li>", contentType.Content));
}
response.Write(
string.Format(
"</ol></li></ul><h1>Your Settings:</h1><ol><li>IP = {0}</li><li>glimpseState = <input type='checkbox' id='gChk' onclick='toggleCookie();'{2}/> <label for='gChk' id='glimpseState'>{1}</lable></li></ol>",
application.Request.ServerVariables["REMOTE_ADDR"], mode,
mode == GlimpseMode.On ? " checked" : ""));
response.Write("<h1>Bookmarklets:</h1><p>Drag the following bookmarklets to your favorites bar for quick and easy access to Glimpse.</p><ul><li><a href=\"javascript:(function(){document.cookie='glimpseState=On; path=/; expires=Sat, 01 Jan 2050 12:00:00 GMT;'; window.location.reload();})();\">Glimpse</a> - Used to turn Glimpse on.</li><li><a href=\"javascript:(function(){document.cookie='glimpseClientName='+ prompt('Client Name?') +'; path=/; expires=Sat, 01 Jan 2050 12:00:00 GMT;'; window.location.reload();})();\">Glimpse Name</a> - Used to set the client name in Glimpse requests.</li></ul></body></html>");
application.CompleteRequest();
}
示例3: RequestAuthentication
private void RequestAuthentication(HttpApplication app)
{
ApplicationServices appServices = new ApplicationServices();
app.Response.AppendHeader("WWW-Authenticate", String.Format("Basic realm=\"{0}\"", appServices.Realm));
app.Response.StatusCode = 401;
app.CompleteRequest();
}
示例4: AccessDenied
protected static void AccessDenied(HttpApplication app)
{
app.Response.StatusCode = ACCESS_DENIED_STATUS_CODE;
app.Response.StatusDescription = ACCESS_DENIED_STATUS_TEXT;
app.Response.Write(ACCESS_DENIED_STATUS_TEXT);
app.CompleteRequest();
}
示例5: Respond
public override void Respond(HttpApplication application, GlimpseConfiguration configuration)
{
var response = application.Response;
var mode = application.GetGlimpseMode();
response.Write("<!DOCTYPE html><html><head><style>body { text-align:center; font-family:\"avante garde\", \"Century Gothic\", Serif; font-size:0.8em; line-height:1.4em; } .content { position:absolute; left:50%; margin-left:-450px; text-align:left; width:900px; } h1, h2, h3, h4 { line-height:1.2em; font-weight:normal; } h1 { font-size:4em; } h2 { font-size:2.5em; } h3 { font-size:2em; } .logo { font-family: \"TitilliumMaps\", helvetica, sans-serif; margin:100px 0 40px; position:relative; background: url(http://getglimpse.com/Content/glimpseLogo.png) -10px -15px no-repeat; padding: 0 0 0 140px; } .logo h1 { color:transparent; } .logo div { font-size:1.5em; margin: 25px 0 0 -10px; } .logo blockquote { width:350px; position:absolute; right:0; top:10px; } blockquote { font: 1.2em/1.6em \"avante garde\", \"Century Gothic\", Serif; width: 400px; background: url(http://getglimpse.com/Content/close-quote.gif) no-repeat right bottom; padding-left: 18px; text-indent: -18px; } blockquote:first-letter { background: url(http://getglimpse.com/Content/open-quote.gif) no-repeat left top; padding-left: 18px; font: italic 1.4em \"avante garde\", \"Century Gothic\", Serif; } .myButton{width:175px; line-height: 1.2em; margin:0.25em 0; text-align:center; -moz-box-shadow:inset 0 1px 0 0 #fff;-webkit-box-shadow:inset 0 1px 0 0 #fff;box-shadow:inset 0 1px 0 0 #fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#ededed),color-stop(1,#dfdfdf));background:-moz-linear-gradient(center top,#ededed 5%,#dfdfdf 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed',endColorstr='#dfdfdf');background-color:#ededed;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:1px solid #dcdcdc;display:inline-block;color:#777;font-family:arial;font-size:24px;padding:10px 41px;text-decoration:none;text-shadow:1px 1px 0 #fff}.myButton:hover{background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#dfdfdf),color-stop(1,#ededed));background:-moz-linear-gradient(center top,#dfdfdf 5%,#ededed 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf',endColorstr='#ededed');background-color:#dfdfdf}.myButton:active{position:relative;top:1px}</style><title>Glimpse Config</title><script>function toggleCookie(){var mode = document.getElementById('glimpseState'); if (mode.innerHTML==='On'){mode.innerHTML='Off';document.cookie='glimpseState=Off; path=/;';}else{mode.innerHTML='On';document.cookie='glimpseState=On; path=/;';}}</script><head><body><div class='content'><div class=\"logo\"><blockquote>What Firebug is for the client, Glimpse does for the server... in other words, a client side Glimpse into whats going on in your server.</blockquote><h1>Glimpse</h1><div>A client side Glimpse to your server</div></div><table width=\"100%\"><tr align=\"center\"><td width=\"50%\"><a class=\"myButton\" href=\"javascript:(function(){document.cookie='glimpseState=On; path=/; expires=Sat, 01 Jan 2050 12:00:00 GMT;'; window.location.reload();})();\">Turn Glimpse On</a></td><td><a class=\"myButton\" href=\"javascript:(function(){document.cookie='glimpseClientName='+ prompt('Client Name?') +'; path=/; expires=Sat, 01 Jan 2050 12:00:00 GMT;'; window.location.reload();})();\">Set Glimpse Session Name</a></td></tr></table><p style=\"text-align:center\">Drag the above button to your favorites bar for quick and easy access to Glimpse.</p>");
response.Write(string.Format("<h2>Glimpse Config Settings:</h2><p>This section details the Glimpse settings in your web.config file.</p><ul><li>On = {0}</li><li>Allowed IP's = <ol>", configuration.On));
foreach (IpAddress ipAddress in configuration.IpAddresses)
{
response.Write(string.Format("<li>{0}</li>", ipAddress.Address));
}
response.Write("</ol></li><li>Allowed ContentType's = <ol>");
foreach (ContentType contentType in configuration.ContentTypes)
{
response.Write(string.Format("<li>{0}</li>", contentType.Content));
}
response.Write(
string.Format(
"</ol></li></ul><h2>Your Settings:</h2><p>This section tells you how Glimpse sees your requests.</p><ul><li>IP = {0}</li><li>glimpseState = <label for='gChk' id='glimpseState'>{1}</label></li></ul>",
application.Request.ServerVariables["REMOTE_ADDR"], mode));
response.Write("<h2>Loaded Plugins:</h2><p>This is the list of Glimpse plugins loaded for this web application. Glimpse plugins show up as individual tabs in the Glimpse client.</p><ul>");
foreach (var plugin in Module.Plugins)
{
response.Write("<li>" + plugin.Value.GetType() + "</li>");
}
response.Write("</ul><h2>More Info:</h2><p><em>For more info see <a href='http://getGlimpse.com'/>getGlimpse.com</a> or follow <a href='http://twitter.com/#!/search/%23glimpse'/>#glimpse</a> on Twitter</em></p></body></html>");
application.CompleteRequest();
}
示例6: JsonResponse
protected static void JsonResponse(HttpApplication httpApplication, string data)
{
var response = httpApplication.Response;
response.Write(data);
response.AddHeader("Content-Type", "application/json");
httpApplication.CompleteRequest();
}
示例7: Respond
public override void Respond(HttpApplication application, GlimpseConfiguration configuration)
{
var response = application.Response;
var mode = application.GetGlimpseMode();
response.Write(
string.Format(
"<html><head><title>Glimpse Config</title><script>function toggleCookie(){{var mode = document.getElementById('glimpseMode'); if (mode.innerHTML==='On'){{mode.innerHTML='Off';document.cookie='glimpseMode=Off; path=/;'}}else{{mode.innerHTML='On';document.cookie='glimpseMode=On; path=/;'}}}}</script><head><body><h1>Glimpse Config Settings:</h1><ul><li>On = {0}</li><li>Allowed IP's = <ol>",
configuration.On));
foreach (IpAddress ipAddress in configuration.IpAddresses)
{
response.Write(string.Format("<li>{0}</li>", ipAddress.Address));
}
response.Write("</ol></li><li>Allowed ContentType's = <ol>");
foreach (ContentType contentType in configuration.ContentTypes)
{
response.Write(string.Format("<li>{0}</li>", contentType.Content));
}
response.Write(
string.Format(
"</ol></li></ul><h1>Your Settings:</h1><ol><li>IP = {0}</li><li>GlimpseMode = <input type='checkbox' id='gChk' onclick='toggleCookie();'{2}/> <label for='gChk' id='glimpseMode'>{1}</lable></li></ol></body></html>",
application.Request.ServerVariables["REMOTE_ADDR"], mode,
mode == GlimpseMode.On ? " checked" : ""));
application.CompleteRequest();
}
示例8: Init
/// <summary>
/// Initializes a module and prepares it to handle requests.
/// </summary>
/// <param name="app">An <see cref="T:System.Web.HttpApplication" /> that provides
/// access to the methods, properties, and events common to all application objects
/// within an ASP.NET application</param>
public void Init(HttpApplication app)
{
app.BeginRequest += (src, args) =>
{
lock (lockObject)
{
if (app.Request.RawUrl == "/Stats")
{
app.Response.Write(string.Format("<div>There have been {0} requests</div>",
requestUrls.Count));
app.Response.Write("<table><tr><th>ID</th><th>URL</th></tr>");
for (int i = 0; i < requestUrls.Count; i++)
{
app.Response.Write(
string.Format("<tr><td>{0}</td><td>{1}</td></tr>",
i, requestUrls[i]));
}
app.Response.Write("</table>");
app.CompleteRequest();
}
else
{
requestUrls.Add(app.Request.RawUrl);
}
}
};
}
示例9: DoPrerender
private void DoPrerender(HttpApplication context)
{
var httpContext = context.Context;
var request = httpContext.Request;
var response = httpContext.Response;
if (ShouldShowPrerenderedPage(request))
{
var result = GetPrerenderedPageResponse(request);
response.StatusCode = (int)result.StatusCode;
// The WebHeaderCollection is horrible, so we enumerate like this!
// We are adding the received headers from the prerender service
for (var i = 0; i < result.Headers.Count; ++i)
{
var header = result.Headers.GetKey(i);
var values = result.Headers.GetValues(i);
if (values == null) continue;
foreach (var value in values)
{
response.Headers.Add(header, value);
}
}
response.Write(result.ResponseBody);
response.Flush();
context.CompleteRequest();
}
}
示例10: Init
public void Init(HttpApplication app) {
app.BeginRequest += (src, args) => {
if (app.Request.RawUrl.ToLower().StartsWith("/home")) {
app.Response.StatusCode = 500;
app.CompleteRequest();
}
};
}
示例11: ProcessRequest
/// <summary>
/// Performs single sign out processing of the received HttpRequest.
/// <remarks>
/// See interface class for details.
/// </remarks>
public override bool ProcessRequest(HttpApplication application)
{
bool logoutRequestProcessed = base.ProcessRequest(application);
if (logoutRequestProcessed) {
application.CompleteRequest();
}
return logoutRequestProcessed;
}
示例12: createNotAuthorizedResponse
protected static void createNotAuthorizedResponse(HttpApplication context, int code, int subCode, string description, bool completeRequest = true)
{
HttpResponse response = context.Context.Response;
response.StatusCode = code;
response.StatusDescription = description;
if (completeRequest)
context.CompleteRequest();
}
示例13: CompleteRequest
public void CompleteRequest(HttpApplication app)
{
var resp = app.Response;
resp.ContentType = "application/json; charset=utf-8";
resp.StatusCode = this.HttpStatus;
resp.Write(this.Json);
resp.Flush();
app.CompleteRequest();
}
示例14: Respond
public override void Respond(HttpApplication application, GlimpseConfiguration configuration)
{
var response = application.Response;
////<style>.glimpse-open { display:none; } </style>
response.Write("<!DOCTYPE html><html><head><title>Glimpse - Popup</title><style type='text/css'>html{color:#000;background:#FFF;} body{margin:0;padding:0;} .glimpse-holder { position:relative !important; display: block !important; } .glimpse-buttons, .glimpse-open { display:none !important; } .glimpse-panel { overflow:visible !important; }</style></head><body><script src='/Scripts/jquery-1.4.4.min.js' type='text/javascript'></script><script type='text/javascript' id='glimpseClient' src='/Glimpse/glimpseClient.js'></script>");
application.CompleteRequest();
}
示例15: Init
public void Init(HttpApplication app)
{
app.BeginRequest += (sender, e) =>
{
if (app.Context.Request.IsLocal)
{
app.Response.StatusCode = 403;
app.CompleteRequest();
}
};
}