本文整理汇总了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;
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
}