本文整理汇总了C#中System.Web.HttpWorkerRequest.SendKnownResponseHeader方法的典型用法代码示例。如果您正苦于以下问题:C# HttpWorkerRequest.SendKnownResponseHeader方法的具体用法?C# HttpWorkerRequest.SendKnownResponseHeader怎么用?C# HttpWorkerRequest.SendKnownResponseHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpWorkerRequest
的用法示例。
在下文中一共展示了HttpWorkerRequest.SendKnownResponseHeader方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
internal void Send(HttpWorkerRequest wr)
{
if (this._knownHeaderIndex >= 0)
{
wr.SendKnownResponseHeader(this._knownHeaderIndex, this._value);
}
else
{
wr.SendUnknownResponseHeader(this._unknownHeader, this._value);
}
}
示例2: SendContent
internal void SendContent (HttpWorkerRequest WorkerRequest)
{
// use URL encoding on the value (see bug #75392)
// but only for CR and LF. Other characters are left untouched.
string actual_val = val;
if (actual_val != null) {
int crlf = actual_val.IndexOfAny (CRLF);
if (crlf >= 0) {
actual_val = actual_val.Replace ("\r", "%0d");
actual_val = actual_val.Replace ("\n", "%0a");
}
}
if (null != header) {
WorkerRequest.SendUnknownResponseHeader (header, actual_val);
} else {
WorkerRequest.SendKnownResponseHeader (header_id, actual_val);
}
}
示例3: SendContent
internal override void SendContent (HttpWorkerRequest wr)
{
wr.SendKnownResponseHeader (ID, Value);
}
示例4: Send
internal void Send(HttpWorkerRequest wr) {
if (_knownHeaderIndex >= 0)
wr.SendKnownResponseHeader(_knownHeaderIndex, _value);
else
wr.SendUnknownResponseHeader(_unknownHeader, _value);
}
示例5: ProcessRequestInternal
private void ProcessRequestInternal(HttpWorkerRequest wr)
{
Interlocked.Increment(ref this._activeRequestCount);
if (this._disposingHttpRuntime)
{
try
{
wr.SendStatus(503, "Server Too Busy");
wr.SendKnownResponseHeader(12, "text/html; charset=utf-8");
byte[] bytes = Encoding.ASCII.GetBytes("<html><body>Server Too Busy</body></html>");
wr.SendResponseFromMemory(bytes, bytes.Length);
wr.FlushResponse(true);
wr.EndOfRequest();
}
finally
{
Interlocked.Decrement(ref this._activeRequestCount);
}
}
else
{
HttpContext context;
try
{
context = new HttpContext(wr, false);
}
catch
{
try
{
wr.SendStatus(400, "Bad Request");
wr.SendKnownResponseHeader(12, "text/html; charset=utf-8");
byte[] bytes = Encoding.ASCII.GetBytes("<html><body>Bad Request</body></html>");
wr.SendResponseFromMemory(bytes, bytes.Length);
wr.FlushResponse(true);
wr.EndOfRequest();
return;
}
finally
{
Interlocked.Decrement(ref this._activeRequestCount);
}
}
wr.SetEndOfSendNotification(this._asyncEndOfSendCallback, (object) context);
HostingEnvironment.IncrementBusyCount();
try
{
try
{
this.EnsureFirstRequestInit(context);
}
catch
{
if (!context.Request.IsDebuggingRequest)
throw;
}
context.Response.InitResponseWriter();
IHttpHandler applicationInstance = HttpApplicationFactory.GetApplicationInstance(context);
if (applicationInstance == null)
throw new HttpException(System.Web.SR.GetString("Unable_create_app_object"));
if (EtwTrace.IsTraceEnabled(5, 1))
EtwTrace.Trace(EtwTraceType.ETW_TYPE_START_HANDLER, context.WorkerRequest, applicationInstance.GetType().FullName, "Start");
if (applicationInstance is IHttpAsyncHandler)
{
IHttpAsyncHandler httpAsyncHandler = (IHttpAsyncHandler) applicationInstance;
context.AsyncAppHandler = httpAsyncHandler;
httpAsyncHandler.BeginProcessRequest(context, this._handlerCompletionCallback, (object) context);
}
else
{
applicationInstance.ProcessRequest(context);
this.FinishRequest(context.WorkerRequest, context, (Exception) null);
}
}
catch (Exception ex)
{
context.Response.InitResponseWriter();
this.FinishRequest(wr, context, ex);
}
}
}