public ArquivoController(WebApiUploadDownloadContext context, IHostingEnvironment env, IFileServerProvider fileServerProvider) { _context = context; _env = env; _fileServerProvider = fileServerProvider; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IFileServerProvider fileServerprovider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //else //{ // app.UseHsts(); //} //app.UseHttpsRedirection(); app.UseFileServerProvider(fileServerprovider); app.UseMvc(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IFileServerProvider fileServerprovider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); //app.UseFileServer(new FileServerOptions() //{ // FileProvider = new PhysicalFileProvider("C:\\recursos\\"), // RequestPath = new PathString("/StaticFiles"), // EnableDirectoryBrowsing = true // you make this true or false. //}); app.UseSession(); app.UseFileServerProvider(fileServerprovider); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Authentication}/{action=LogIn}/{id?}"); }); }
public static IApplicationBuilder UseFileServerProvider(this IApplicationBuilder application, IFileServerProvider fileServerprovider) { foreach (var option in fileServerprovider.FileServerOptionsCollection) { application.UseFileServer(option); } return(application); }
public HomeController(IFileServerProvider fileServerProvider) { _fileServerProvider = fileServerProvider; }