本文整理汇总了C#中System.Web.HttpWorkerRequest类的典型用法代码示例。如果您正苦于以下问题:C# HttpWorkerRequest类的具体用法?C# HttpWorkerRequest怎么用?C# HttpWorkerRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpWorkerRequest类属于System.Web命名空间,在下文中一共展示了HttpWorkerRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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;
}
示例5:
void IHttpResponseElement.Send(HttpWorkerRequest wr)
{
int length = base._size - base._free;
if (length > 0)
{
wr.SendResponseFromMemory(this._data, length);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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 );
}
示例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);
}
示例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);
}
示例14: Send
internal void Send(HttpWorkerRequest wr)
{
if (this._knownHeaderIndex >= 0)
{
wr.SendKnownResponseHeader(this._knownHeaderIndex, this._value);
}
else
{
wr.SendUnknownResponseHeader(this._unknownHeader, this._value);
}
}
示例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;
}
}