• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Web.HttpWorkerRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



HttpWorkerRequest类属于System.Web命名空间,在下文中一共展示了HttpWorkerRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ProgressWorkerRequest

 public ProgressWorkerRequest(HttpWorkerRequest wr, HttpRequest request)
 {
     this._originalWorkerRequest = wr;
     this._request = request;
     this._boundary = this.GetBoundary(this._request);
     this._requestStateStore = new Areas.Lib.UploadProgress.Upload.RequestStateStore(this._request.ContentEncoding);
 }
开发者ID:asifashraf,项目名称:Radmade-Portable-Framework,代码行数:7,代码来源:ProgressWorkerRequest.cs


示例2: GetNextRequest

		public HttpWorkerRequest GetNextRequest (HttpWorkerRequest req)
		{
			if (!CanExecuteRequest (req)) {
				if (req != null) {
					lock (queue) {
						Queue (req);
					}
				}

				return null;
			}

			HttpWorkerRequest result;
			lock (queue) {
				result = Dequeue ();
				if (result != null) {
					if (req != null)
						Queue (req);
				} else {
					result = req;
				}
			}

			return result;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:25,代码来源:QueueManager.cs


示例3: TestWebContext

        public TestWebContext(string virtualPath, string page)
        {
            _out = new StringWriter();
            HttpWorkerRequest wr;
            AppDomain domain = Thread.GetDomain();

            // are we running within a valid AspNet AppDomain?
            string appPath = (string) domain.GetData(".appPath");
            if (appPath != null)
            {
                wr = new SimpleWorkerRequest(page, string.Empty, _out);
            }
            else
            {
                appPath = domain.BaseDirectory + "\\";
                wr = new SimpleWorkerRequest(virtualPath, appPath, page, string.Empty, _out);
            }
            HttpContext ctx = new HttpContext(wr);
            HttpContext.Current = ctx;
            HttpBrowserCapabilities browser = new HttpBrowserCapabilities();
            browser.Capabilities = new CaseInsensitiveHashtable(); //CollectionsUtil.CreateCaseInsensitiveHashtable();
            browser.Capabilities[string.Empty] = "Test User Agent"; // string.Empty is the key for "user agent"

            // avoids NullReferenceException when accessing HttpRequest.FilePath
            object virtualPathObject = ExpressionEvaluator.GetValue(null, "T(System.Web.VirtualPath).Create('/')");
            object cachedPathData = ExpressionEvaluator.GetValue(null, "T(System.Web.CachedPathData).GetRootWebPathData()");
            ExpressionEvaluator.SetValue(cachedPathData, "_virtualPath", virtualPathObject);
            ExpressionEvaluator.SetValue(cachedPathData, "_physicalPath", appPath);

            ctx.Request.Browser = browser;
            string filePath = ctx.Request.FilePath;
            _wr = wr;
        }
开发者ID:spring-projects,项目名称:spring-net,代码行数:33,代码来源:TestWebContext.cs


示例4: DecoratedWorkerRequest

 protected DecoratedWorkerRequest(HttpWorkerRequest origWorker)
 {
     if (log.IsDebugEnabled) log.Debug("origWorker=" + origWorker);
     OrigWorker = origWorker;
     // Remember the original HttpContext so that it can be used by UploadHttpModule.AppendToLog().
     OrigContext = HttpContext.Current;
 }
开发者ID:abdul-baten,项目名称:hbcms,代码行数:7,代码来源:DecoratedWorkerRequest.cs


示例5:

 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


示例6: HttpHeaderCollection

        // This constructor creates the header collection for response headers.
        // Try to preallocate the base collection with a size that should be sufficient
        // to store the headers for most requests.
        internal HttpHeaderCollection(HttpWorkerRequest wr, HttpResponse response, int capacity) : base(capacity) {

            // if this is an IIS7WorkerRequest, then the collection will be writeable and we will
            // call into IIS7 to update the header blocks when changes are made.
            _iis7WorkerRequest = wr as IIS7WorkerRequest;

            _response = response;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:HttpHeaderCollection.cs


示例7: GetContext

 public static KeyValuePair<HttpContext, HttpApplication> GetContext(HttpWorkerRequest wr, params IHttpModule[] modules) {
     var ctx = new HttpContext(wr);
     var app = new MyApp(modules);
     SetHttpApplicationFactoryCustomApplication(app);
     InitInternal(app, ctx);
     AssignContext(app, ctx);
     return new KeyValuePair<HttpContext, HttpApplication>(ctx, app);
 }
开发者ID:nhsevidence,项目名称:Windsor.LifeStyles,代码行数:8,代码来源:HttpModuleRunner.cs


示例8: CreateStream

        public static RequestBufferlessStream CreateStream(HttpWorkerRequest workerRequest)
        {
            if (workerRequest == null)
                throw new ArgumentNullException("workerRequest");

            long totalBytes = (long)workerRequest.GetTotalEntityBodyLength();
            return new RequestBufferlessStream(workerRequest, totalBytes);
        }
开发者ID:cloudguy,项目名称:Storage-Monster,代码行数:8,代码来源:RequestBufferlessStream.cs


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


示例10: CheckClientConnected

 private bool CheckClientConnected(HttpWorkerRequest wr)
 {
     if ((DateTime.UtcNow - wr.GetStartTime()) > this._clientConnectedTime)
     {
         return wr.IsClientConnected();
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:RequestQueue.cs


示例11: HttpServerVarsCollection

        // We preallocate the base collection with a size that should be sufficient
        // to store all server variables w/o having to expand
        internal HttpServerVarsCollection(HttpWorkerRequest wr, HttpRequest request) : base(59) {
            // if this is an IIS7WorkerRequest, then the collection will be writeable and we will
            // call into IIS7 to update the server var block when changes are made.
            _iis7workerRequest = wr as IIS7WorkerRequest;
            _request = request;
            _populated = false;

            Debug.Assert( _request != null );
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:11,代码来源:HttpServerVarsCollection.cs


示例12: CanExecuteRequest

		bool CanExecuteRequest (HttpWorkerRequest req)
		{
			if (disposing)
				return false;
				
			int threads, cports;
			ThreadPool.GetAvailableThreads (out threads, out cports);
			bool local = (req != null && req.GetLocalAddress () == "127.0.0.1");
			return (threads > minFree) || (local && threads > minLocalFree);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:10,代码来源:QueueManager.cs


示例13: HttpContext

		public HttpContext (HttpWorkerRequest WorkerRequest)
		{
			Context = this;

			_oTimestamp = DateTime.Now;
			_oRequest = new HttpRequest (WorkerRequest, this);
			_oResponse = new HttpResponse (WorkerRequest, this);
			_oWorkerRequest = WorkerRequest;
			_oTrace = new TraceContext (this);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:10,代码来源:HttpContext.cs


示例14: Send

 internal void Send(HttpWorkerRequest wr)
 {
     if (this._knownHeaderIndex >= 0)
     {
         wr.SendKnownResponseHeader(this._knownHeaderIndex, this._value);
     }
     else
     {
         wr.SendUnknownResponseHeader(this._unknownHeader, this._value);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:HttpResponseHeader.cs


示例15: RequestStream

		public RequestStream(HttpWorkerRequest request)
		{
			this.request = request;

			tempBuff = request.GetPreloadedEntityBody();

            _contentLength = long.Parse(request.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength));
            
            // Handle the case where GetPreloadedEntityBody is null -- e.g. Mono
			if (tempBuff == null || tempBuff.Length == 0)
			{
				isInPreloaded = false;
			}
    	}
开发者ID:codingbat,项目名称:BandCamp,代码行数:14,代码来源:RequestStream.cs


示例16: AsyncUpload

        public AsyncUpload(HttpWorkerRequest wRquest)
        {
            if (wRquest == null) throw new ArgumentNullException("wRquest");
            this.uploadProcess = new UploadProcess(delegate(float f) { });
            workerRequest = wRquest;

            //当前读到的流长度
            this.preLen = workerRequest.GetPreloadedEntityBodyLength();
            //请求流的总长度
            this.totLen = workerRequest.GetTotalEntityBodyLength();
            //内容分隔符 如: -----------------------------152733254716788
            if (preLen == 0 && workerRequest.IsClientConnected() && workerRequest.HasEntityBody())
            {
                byte[] buffer = new byte[8192];
                preLen = workerRequest.ReadEntityBody(buffer, buffer.Length);
                byte[] buf = new byte[preLen];
                for (int i = 0; i < buf.Length; i++) buf[i] = buffer[i];
                this.perBodyBytes = buf;
            }
            else
                this.perBodyBytes = workerRequest.GetPreloadedEntityBody();

            this.headerBytes = this.GetBoundaryBytes(Encoding.UTF8.GetBytes(workerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentType)));
            //请求流尾部分隔符 如: -----------------------------152733254716788--
            this.contentEnd = new byte[this.headerBytes.Length + 2];
            this.headerBytes.CopyTo(this.contentEnd, 0);
            this.contentEnd[this.headerBytes.Length] = 45;
            this.contentEnd[this.headerBytes.Length + 1] = 45;

            //当前流中第一个文件分隔符的位置
            int fHeaderPosition = perBodyBytes.Indexof(fileNameHeader);
            //尝试在已读取到的流中找文件尾位置
            this.fEndPosition = perBodyBytes.Indexof(contentEnd);
            if (fHeaderPosition > -1)
            {
                //先找到文件名
                IList<byte> bufList = new List<byte>();
                int i = fHeaderPosition + fileNameHeader.Length;
                while (i < perBodyBytes.Length)
                {
                    if (perBodyBytes[i] == 34) break;
                    bufList.Add(perBodyBytes[i]);
                    i++;
                }

                this.FileName = Encoding.UTF8.GetString(bufList.ToArray());//file name
                this.fPosition = perBodyBytes.Indexof(wrapBytes, i) + 4;//当前流中此文件的开始位置
                this.FileLength = this.totLen - this.fPosition;
            }
        }
开发者ID:hanwest00,项目名称:MYTestWeb,代码行数:50,代码来源:AsyncUpload.cs


示例17: HttpClientCertificate

		internal HttpClientCertificate (HttpWorkerRequest hwr)
		{
			// we don't check hwr for null so we end up throwing a 
			// NullReferenceException just like MS implementation
			// if the public ctor for HttpRequest is used
			this.hwr = hwr;
			flags = GetIntNoPresense ("CERT_FLAGS");
			if (IsPresent) {
				from = hwr.GetClientCertificateValidFrom ();
				until = hwr.GetClientCertificateValidUntil ();
			} else {
				from = DateTime.Now;
				until = from;
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:HttpClientCertificate.cs


示例18: GetResponse

    /// <summary>
    /// Gets the response.
    /// </summary>
    /// <param name="workerRequest">The worker request.</param>
    /// <returns>The <see cref="Response"/>.</returns>
    protected virtual Response GetResponse(HttpWorkerRequest workerRequest)
    {
      if (workerRequest == null)
      {
        throw new ArgumentNullException("workerRequest");
      }

      WorkerRequest workerRequestCandidate = workerRequest as WorkerRequest;

      if (workerRequestCandidate == null)
      {
        throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "workerRequest is of improper type. It should be based on {0}", typeof(WorkerRequest).AssemblyQualifiedName));
      }

      return workerRequestCandidate.Response;
    }
开发者ID:sergeyshushlyapin,项目名称:Sitecore.LiveTesting,代码行数:21,代码来源:RequestManager.cs


示例19: IsUploadStatusRequest

        internal static bool IsUploadStatusRequest(HttpWorkerRequest request, out string id)
        {
            id = string.Empty;

            if (request.GetHttpVerbName() != GetVerbName)
                return false;

            Match m = _getUploadId.Match(request.GetRawUrl());

            if (!m.Success)
                return false;

            id = m.Value;

            return true;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:16,代码来源:UploadProgressUtils.cs


示例20: QueueRequest

        private void QueueRequest(HttpWorkerRequest wr, bool isLocal) {
            lock (this) {
                if (isLocal) {
                    _localQueue.Enqueue(wr);
                }
                else  {
                    _externQueue.Enqueue(wr);
                }

                _count++;
            }

            PerfCounters.IncrementGlobalCounter(GlobalPerfCounter.REQUESTS_QUEUED);
            PerfCounters.IncrementCounter(AppPerfCounter.REQUESTS_IN_APPLICATION_QUEUE);
            if (EtwTrace.IsTraceEnabled(EtwTraceLevel.Information, EtwTraceFlags.Infrastructure)) EtwTrace.Trace(EtwTraceType.ETW_TYPE_REQ_QUEUED, wr);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:16,代码来源:RequestQueue.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Serialization.JavaScriptSerializer类代码示例发布时间:2022-05-26
下一篇:
C# Web.HttpSessionStateBase类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap