本文整理汇总了C#中System.Web.HttpWorkerRequest.SendUnknownResponseHeader方法的典型用法代码示例。如果您正苦于以下问题:C# HttpWorkerRequest.SendUnknownResponseHeader方法的具体用法?C# HttpWorkerRequest.SendUnknownResponseHeader怎么用?C# HttpWorkerRequest.SendUnknownResponseHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpWorkerRequest
的用法示例。
在下文中一共展示了HttpWorkerRequest.SendUnknownResponseHeader方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Redirect
static void Redirect (HttpWorkerRequest wr, string location)
{
string host = wr.GetKnownRequestHeader (HttpWorkerRequest.HeaderHost);
wr.SendStatus (301, "Moved Permanently");
wr.SendUnknownResponseHeader ("Connection", "close");
wr.SendUnknownResponseHeader ("Date", DateTime.Now.ToUniversalTime ().ToString ("r"));
wr.SendUnknownResponseHeader ("Location", String.Format ("{0}://{1}{2}", wr.GetProtocol(), host, location));
Encoding enc = Encoding.ASCII;
wr.SendUnknownResponseHeader ("Content-Type", "text/html; charset=" + enc.WebName);
string content = String.Format (CONTENT301, host, location);
byte [] contentBytes = enc.GetBytes (content);
wr.SendUnknownResponseHeader ("Content-Length", contentBytes.Length.ToString ());
wr.SendResponseFromMemory (contentBytes, contentBytes.Length);
wr.FlushResponse (true);
wr.CloseConnection ();
}
示例2: Send
internal void Send(HttpWorkerRequest wr)
{
if (this._knownHeaderIndex >= 0)
{
wr.SendKnownResponseHeader(this._knownHeaderIndex, this._value);
}
else
{
wr.SendUnknownResponseHeader(this._unknownHeader, this._value);
}
}
示例3: 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);
}
}
示例4: FinishUnavailable
//
// This is called from the QueueManager if a request
// can not be processed (load, no resources, or
// appdomain unload).
//
static internal void FinishUnavailable (HttpWorkerRequest wr)
{
wr.SendStatus (503, "Service unavailable");
wr.SendUnknownResponseHeader ("Connection", "close");
Encoding enc = Encoding.ASCII;
wr.SendUnknownResponseHeader ("Content-Type", "text/html; charset=" + enc.WebName);
byte [] contentBytes = enc.GetBytes (content503);
wr.SendUnknownResponseHeader ("Content-Length", contentBytes.Length.ToString ());
wr.SendResponseFromMemory (contentBytes, contentBytes.Length);
wr.FlushResponse (true);
wr.CloseConnection ();
HttpApplication.requests_total_counter.Increment ();
}
示例5: FinishWithException
static void FinishWithException (HttpWorkerRequest wr, HttpException e)
{
int code = e.GetHttpCode ();
wr.SendStatus (code, HttpWorkerRequest.GetStatusDescription (code));
wr.SendUnknownResponseHeader ("Connection", "close");
Encoding enc = Encoding.ASCII;
wr.SendUnknownResponseHeader ("Content-Type", "text/html; charset=" + enc.WebName);
string msg = e.GetHtmlErrorMessage ();
byte [] contentBytes = enc.GetBytes (msg);
wr.SendUnknownResponseHeader ("Content-Length", contentBytes.Length.ToString ());
wr.SendResponseFromMemory (contentBytes, contentBytes.Length);
wr.FlushResponse (true);
wr.CloseConnection ();
HttpApplication.requests_total_counter.Increment ();
}
示例6: SendContent
internal override void SendContent (HttpWorkerRequest wr)
{
wr.SendUnknownResponseHeader (Name, Value);
}
示例7: Send
internal void Send(HttpWorkerRequest wr) {
if (_knownHeaderIndex >= 0)
wr.SendKnownResponseHeader(_knownHeaderIndex, _value);
else
wr.SendUnknownResponseHeader(_unknownHeader, _value);
}