當前位置: 首頁>>代碼示例>>C#>>正文


C# HttpWorkerRequest.SendResponseFromMemory方法代碼示例

本文整理匯總了C#中System.Web.HttpWorkerRequest.SendResponseFromMemory方法的典型用法代碼示例。如果您正苦於以下問題:C# HttpWorkerRequest.SendResponseFromMemory方法的具體用法?C# HttpWorkerRequest.SendResponseFromMemory怎麽用?C# HttpWorkerRequest.SendResponseFromMemory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Web.HttpWorkerRequest的用法示例。


在下文中一共展示了HttpWorkerRequest.SendResponseFromMemory方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IntPtr

 void IHttpResponseElement.Send(HttpWorkerRequest wr)
 {
     if (this._size > 0)
     {
         bool isBufferFromUnmanagedPool = false;
         wr.SendResponseFromMemory(new IntPtr(this._data.ToInt64() + this._offset), this._size, isBufferFromUnmanagedPool);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:8,代碼來源:HttpResourceResponseElement.cs

示例2:

 void IHttpResponseElement.Send(HttpWorkerRequest wr)
 {
     int length = base._size - base._free;
     if (length > 0)
     {
         wr.SendResponseFromMemory(this._data, length);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:8,代碼來源:HttpResponseBufferElement.cs

示例3: 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

示例4: IntPtr

 /*
  * Write HttpWorkerRequest
  */
 void IHttpResponseElement.Send(HttpWorkerRequest wr) {
     if (_size > 0) {
         wr.SendResponseFromMemory(new IntPtr(_data.ToInt64()+_offset), _size, isBufferFromUnmanagedPool: false);
     }
 }
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:8,代碼來源:HttpWriter.cs

示例5:

        /*
         * Write HttpWorkerRequest
         */
        void IHttpResponseElement.Send(HttpWorkerRequest wr) {
            int n = _size - _free;

            if (n > 0) {
                wr.SendResponseFromMemory(_data, n, true);
            }

#if DBG
            Debug.Trace("UnmanagedBuffers", "Sending data, byteCount=" + n + ", freeBytes=" + _free);
#endif
        }
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:14,代碼來源:HttpWriter.cs

示例6: SendContent

        internal void SendContent (HttpWorkerRequest Handler)
        {
            FlushBuffers();

            int l = (int)_OutputStream.Length;
            if (l > 0) {
                byte [] arrContent = _OutputStream.GetInternalBuffer ();
                Handler.SendResponseFromMemory (arrContent, l);
            }
        }
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:10,代碼來源:HttpWriter.cs

示例7: 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

示例8: 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

示例9: UnsafeWrite

        unsafe void UnsafeWrite (HttpWorkerRequest wr, byte [] buffer, int offset, int count)
        {
            fixed (byte *ptr = buffer) {
                wr.SendResponseFromMemory ((IntPtr) (ptr + offset), count);
            }
        }
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:6,代碼來源:HttpResponseStream.cs

示例10: Send

            public void Send (HttpWorkerRequest wr, int start, int end) {
                int length = end - start;
                if (length <= 0)
                    return;

                if (length > buffer.Length - start)
                    length = buffer.Length - start;

                if (start > 0) {
                    byte[] temp = new byte[length];
                    Array.Copy(buffer, start, temp, 0, length);
                    buffer = temp;
                }
                wr.SendResponseFromMemory(buffer, length);
            }
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:15,代碼來源:HttpResponseStream.cs

示例11: 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

示例12: Send

            public override void Send (HttpWorkerRequest wr)
            {
                if (_position == 0)
                    return;

                wr.SendResponseFromMemory (buffer, 0, _position, _encoding);
            }
開發者ID:carrie901,項目名稱:mono,代碼行數:7,代碼來源:HttpResponseStream.jvm.cs

示例13: Send

            public void Send (HttpWorkerRequest wr, int start, int end)
            {
                if (end - start <= 0)
                    return;

                wr.SendResponseFromMemory ((IntPtr) (data + start), end - start);
            }
開發者ID:nlhepler,項目名稱:mono,代碼行數:7,代碼來源:HttpResponseStream.cs


注:本文中的System.Web.HttpWorkerRequest.SendResponseFromMemory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。