Exemple #1
0
        public override Task Invoke(IOwinContext context)
        {
            Trace.WriteLine("Invoke DefaultMiddleware");

            var path = FileSystem.MapPath(_options.BasePath, context.Request.Path.Value);

            context.Response.StatusCode  = 200;
            context.Response.ContentType = MimeTypeService.GetMimeType(Path.GetExtension(path));

            using (var inputStream = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                StreamHandler.CopyStream(context.Response.Body, inputStream);
            }

            return(Globals.CompletedTask);
        }