当前位置: 首页>>代码示例>>C#>>正文


C# HttpWorkerRequest.FlushResponse方法代码示例

本文整理汇总了C#中System.Web.HttpWorkerRequest.FlushResponse方法的典型用法代码示例。如果您正苦于以下问题:C# HttpWorkerRequest.FlushResponse方法的具体用法?C# HttpWorkerRequest.FlushResponse怎么用?C# HttpWorkerRequest.FlushResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.HttpWorkerRequest的用法示例。


在下文中一共展示了HttpWorkerRequest.FlushResponse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ();
		}
开发者ID:louislatreille,项目名称:xsp,代码行数:16,代码来源:ApplicationHost.cs

示例2: 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 ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:18,代码来源:HttpRuntime.cs

示例3: 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 ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:15,代码来源:HttpRuntime.cs

示例4: Flush

		internal void Flush (HttpWorkerRequest wr, bool final_flush)
		{
			if (total == 0 && !final_flush)
				return;

			if (response.use_chunked) 
				SendChunkSize (total, false);

			for (Bucket b = first_bucket; b != null; b = b.Next) {
				b.Send (wr);
			}

			if (response.use_chunked) {
				SendChunkSize (-1, false);
				if (final_flush)
					SendChunkSize (0, true);
			}

			wr.FlushResponse (final_flush);

			Clear ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:22,代码来源:HttpResponseStream.cs

示例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);
     }
   }
 }
开发者ID:consumentor,项目名称:Server,代码行数:81,代码来源:HttpRuntime.cs

示例6: Flush

		internal void Flush (HttpWorkerRequest wr, bool final_flush)
		{
			if (!dirty && !final_flush)
				return;

			for (Bucket b = first_bucket; b != null; b = b.Next) {
				b.Send (wr);
			}

			wr.FlushResponse (final_flush);
			Clear ();
		}
开发者ID:carrie901,项目名称:mono,代码行数:12,代码来源:HttpResponseStream.jvm.cs


注:本文中的System.Web.HttpWorkerRequest.FlushResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。