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


C# HttpWorkerRequest.GetType方法代码示例

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


在下文中一共展示了HttpWorkerRequest.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsIIS7WorkerRequest

 private static bool IsIIS7WorkerRequest(HttpWorkerRequest workerRequest)
 {
     return workerRequest.GetType().FullName == IIS7WorkerRequestTypeName;
 }
开发者ID:stevehebert,项目名称:SignalR,代码行数:4,代码来源:AspNetResponse.cs

示例2: PersistStatus

        /// <summary>
        /// Perists the status.
        /// </summary>
        /// <param name="key">The status key.</param>
        /// <param name="length">The total request length.</param>
        /// <param name="app">The application.</param>
        /// <param name="worker">The HTTP worker request.</param>
        void PersistStatus(string key, long length, HttpApplication app, HttpWorkerRequest worker)
        {
            UploadManager.Instance.SetStatus(_status, key);

            if (length / 1024 > GetMaxRequestLength(app.Context))
            {
                // End the request if the maximum request length is exceeded.
                EndRequestOnRequestLengthExceeded(app.Context.Response, worker, app.Context, worker.GetType().FullName == "System.Web.Hosting.IIS7WorkerRequest");
                return;
            }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:18,代码来源:UploadModule.cs

示例3: InjectTextParts

        /// <summary>
        /// 传入已上传完的数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="textParts"></param>
        void InjectTextParts(HttpWorkerRequest request, byte[] textParts)
        {
            BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic;

            Type type = request.GetType();

            while ((type != null) && (type.FullName != "System.Web.Hosting.ISAPIWorkerRequest"))
            {
                type = type.BaseType;
            }

            if (type != null)
            {
                type.GetField("_contentAvailLength", bindingFlags).SetValue(request, textParts.Length);
                type.GetField("_contentTotalLength", bindingFlags).SetValue(request, textParts.Length);
                type.GetField("_preloadedContent", bindingFlags).SetValue(request, textParts);
                type.GetField("_preloadedContentRead", bindingFlags).SetValue(request, true);
            }
        }
开发者ID:rongcheng,项目名称:benz,代码行数:24,代码来源:HttpUploadModule.cs

示例4: InjectTextParts

        void InjectTextParts(HttpWorkerRequest worker, byte[] textParts)
        {
            BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic;

            Type type = worker.GetType();

            while ((type != null) && !(type.FullName == "System.Web.Hosting.ISAPIWorkerRequest" ||
                type.FullName == "Microsoft.VisualStudio.WebHost.Request" ||
                type.FullName == "Cassini.Request"))
            {
                type = type.BaseType;
            }

            if (type != null)
            {
                switch (type.FullName)
                {
                    case "System.Web.Hosting.ISAPIWorkerRequest":
                        type.GetField("_contentAvailLength", bindingFlags).SetValue(worker, textParts.Length);
                        type.GetField("_contentTotalLength", bindingFlags).SetValue(worker, textParts.Length);
                        type.GetField("_preloadedContent", bindingFlags).SetValue(worker, textParts);
                        type.GetField("_preloadedContentRead", bindingFlags).SetValue(worker, true);

                        break;
                    case "Cassini.Request":
                    case "Microsoft.VisualStudio.WebHost.Request":
                        type.GetField("_contentLength", bindingFlags).SetValue(worker, textParts.Length);
                        type.GetField("_preloadedContent", bindingFlags).SetValue(worker, textParts);
                        type.GetField("_preloadedContentLength", bindingFlags).SetValue(worker, textParts.Length);

                        break;
                }
            }
        }
开发者ID:codingbat,项目名称:BandCamp,代码行数:34,代码来源:UploadHttpRequest.cs


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