public static IHttpContext ConvertHttpContext(IOwinContext context) { if (context.Environment.ContainsKey(typeof(IHttpContext).FullName)) { return((IHttpContext)context.Environment[typeof(IHttpContext).FullName]); } var httpContext = new DotvvmHttpContext(context); httpContext.Response = new DotvvmHttpResponse( context.Response, httpContext, new DotvvmHeaderCollection(context.Response.Headers) ); httpContext.Request = new DotvvmHttpRequest( context.Request, httpContext, new DotvvmHttpPathString(context.Request.Path), new DotvvmHttpPathString(context.Request.PathBase), new DotvvmQueryCollection(context.Request.Query), new DotvvmHeaderCollection(context.Request.Headers), new DotvvmCookieCollection(context.Request.Cookies) ); context.Environment[typeof(IHttpContext).FullName] = httpContext; return(httpContext); }
public static IHttpContext ConvertHttpContext(HttpContext context) { var httpContext = context.Features.Get <IHttpContext>(); if (httpContext == null) { httpContext = new DotvvmHttpContext(context) { Response = new DotvvmHttpResponse( context.Response, httpContext, new DotvvmHeaderCollection(context.Response.Headers) ), Request = new DotvvmHttpRequest( context.Request, httpContext, new DotvvmHttpPathString(context.Request.Path), new DotvvmHttpPathString(context.Request.PathBase), new DotvvmQueryCollection(context.Request.Query), new DotvvmHeaderCollection(context.Request.Headers), new DotvvmCookieCollection(context.Request.Cookies) ) }; context.Features.Set(httpContext); } return(httpContext); }
public static IHttpContext ConvertHttpContext(HttpContext context) { var httpContext = context.Features.Get <IHttpContext>(); if (httpContext == null) { httpContext = new DotvvmHttpContext(context) { Response = new DotvvmHttpResponse( context.Response, httpContext, new DotvvmHeaderCollection(context.Response.Headers) ), Request = new DotvvmHttpRequest( context.Request, httpContext ) }; context.Features.Set(httpContext); } return(httpContext); }