当前位置: 首页>>代码示例>>C#>>正文


C# IAppBuilder.UseDirectoryBrowser方法代码示例

本文整理汇总了C#中IAppBuilder.UseDirectoryBrowser方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseDirectoryBrowser方法的具体用法?C# IAppBuilder.UseDirectoryBrowser怎么用?C# IAppBuilder.UseDirectoryBrowser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAppBuilder的用法示例。


在下文中一共展示了IAppBuilder.UseDirectoryBrowser方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configuration

        public void Configuration(IAppBuilder app)
        {
#if DEBUG
            app.UseErrorPage();
#endif
            // Remap '/' to '.\defaults\'.
            // Turns on static files and default files.
            app.UseFileServer(new FileServerOptions()
            {
                RequestPath = PathString.Empty,
                FileSystem = new PhysicalFileSystem(@".\defaults"),
            });

            // Only serve files requested by name.
            app.UseStaticFiles("/files");

            // Turns on static files, directory browsing, and default files.
            app.UseFileServer(new FileServerOptions()
            {
                RequestPath = new PathString("/public"),
                EnableDirectoryBrowsing = true,
            });

            // Browse the root of your application (but do not serve the files).
            // NOTE: Avoid serving static files from the root of your application or bin folder,
            // it allows people to download your application binaries, config files, etc..
            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                RequestPath = new PathString("/src"),
                FileSystem = new PhysicalFileSystem(@""),
            });

            // Anything not handled will land at the welcome page.
            app.UseWelcomePage();
        }
开发者ID:andreychizhov,项目名称:microsoft-aspnet-samples,代码行数:35,代码来源:Startup.cs

示例2: Configuration

        public void Configuration(IAppBuilder app)
        {
            /* // Note: Enable only for debugging. This slows down the perf tests.
            app.Use((context, next) =>
            {
                var req = context.Request;
                context.TraceOutput.WriteLine("{0} {1}{2} {3}", req.Method, req.PathBase, req.Path, req.QueryString);
                return next();
            });*/

            app.UseErrorPage(new ErrorPageOptions { SourceCodeLineCount = 20 });
            // app.Use(typeof(AutoTuneMiddleware), app.Properties["Microsoft.Owin.Host.HttpListener.OwinHttpListener"]);
            app.UseSendFileFallback();
            app.Use<CanonicalRequestPatterns>();

            app.UseStaticFiles(new StaticFileOptions()
            {
                RequestPath = new PathString("/static"),
                FileSystem = new PhysicalFileSystem("public")
            });
            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                RequestPath = new PathString("/static"),
                FileSystem = new PhysicalFileSystem("public")
            });
            app.UseStageMarker(PipelineStage.MapHandler);

            FileServerOptions options = new FileServerOptions();
            options.EnableDirectoryBrowsing = true;
            options.StaticFileOptions.ServeUnknownFileTypes = true;

            app.UseWelcomePage("/Welcome");
        }
开发者ID:Xamarui,项目名称:Katana,代码行数:33,代码来源:Startup.cs

示例3: Configuration

        public void Configuration(IAppBuilder app)
        {
            var fileSystem = new PhysicalFileSystem(this.serverConfig.RootFolder);

            if (this.serverConfig.AllowDirectoryBrowsing)
            {
                app.UseDirectoryBrowser(new DirectoryBrowserOptions()
                    {
                        FileSystem = fileSystem
                    });
            }

            app.UseStaticFiles(new StaticFileOptions()
                {
                    FileSystem = fileSystem,
                    ServeUnknownFileTypes = true
                });
        }
开发者ID:wgraham17,项目名称:run-webserver-here,代码行数:18,代码来源:OwinStartup.cs

示例4: ConfigureUserSpace

        private void ConfigureUserSpace(IAppBuilder appBuilder)
        {
            var appConfig = ObjectFactory.GetProvider<IAppConfigProvider>().AppConfig;
            var fileSystem = new PhysicalFileSystem(appConfig.WebRoot);

            appBuilder.Use(typeof(RedirectUrl));
            appBuilder.UseDirectoryBrowser(new DirectoryBrowserOptions
            {
                RequestPath = new PathString(""),
                FileSystem = fileSystem
            });

            appBuilder.UseStaticFiles(new StaticFileOptions
            {
                RequestPath = new PathString(""),
                FileSystem = fileSystem,
                ServeUnknownFileTypes = true
            });
        }
开发者ID:samiy-xx,项目名称:keysndr,代码行数:19,代码来源:Startup.cs

示例5: EmbeddedDirectoryBrowserFileSystemConfiguration

 public void EmbeddedDirectoryBrowserFileSystemConfiguration(IAppBuilder app)
 {
     app.UseDirectoryBrowser(new DirectoryBrowserOptions() { FileSystem = new EmbeddedResourceFileSystem(Assembly.GetExecutingAssembly().GetName().Name) });
 }
开发者ID:Xamarui,项目名称:Katana,代码行数:4,代码来源:EmbeddedDirectoryBrowser.cs

示例6: ConfigureStaticFileServer

        private static void ConfigureStaticFileServer(IAppBuilder app)
        {
            #if DEBUG
            app.UseErrorPage();
            #endif
            // Remap '/' to '.\defaults\'.
            // Turns on static files and default files.
            var integrityUiPath = @"..\..\..\Integrity";

            string currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            integrityUiPath = Path.Combine(currentDirectory, integrityUiPath);
            integrityUiPath = Path.GetFullPath((new Uri(integrityUiPath)).LocalPath);
            if (!Directory.Exists(integrityUiPath))
            {
                throw new Exception(String.Format("Directory {0} does not exist", integrityUiPath));
            }
            var options = new FileServerOptions()
            {
                RequestPath = PathString.Empty,
                FileSystem = new PhysicalFileSystem(integrityUiPath)
            };
            //options.StaticFileOptions.ContentTypeProvider = new CustomContentTypeProvider();
            app.UseFileServer(options);

            //var hubConfiguration = new HubConfiguration();
            //hubConfiguration.EnableDetailedErrors = true;
            //app.MapSignalR(hubConfiguration);

            // Browse the root of your application (but do not serve the files).
            // NOTE: Avoid serving static files from the root of your application or bin folder,
            // it allows people to download your application binaries, config files, etc..
            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                RequestPath = new PathString("/src"),
                FileSystem = new PhysicalFileSystem(@""),
            });
        }
开发者ID:DaveWelling,项目名称:IntegrityKatana,代码行数:37,代码来源:Program.cs

示例7: DirectoryBrowser

 public void DirectoryBrowser(IAppBuilder app)
 {
     app.Use((context, next) => { context.Response.Headers["PassedThroughOWIN"] = "True"; return next(); });
     app.UseDirectoryBrowser();
     app.Run(context => { context.Response.StatusCode = 402; return context.Response.WriteAsync("Fell Through"); });
 }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:6,代码来源:StaticFilesTests.cs

示例8: DirectoryBrowserCustomFormatterConfiguration

 public void DirectoryBrowserCustomFormatterConfiguration(IAppBuilder app)
 {
     app.UseDirectoryBrowser(new DirectoryBrowserOptions() { Formatter = new MyDirectoryInfoFormatter() });
 }
开发者ID:Xamarui,项目名称:Katana,代码行数:4,代码来源:DirectoryBrowserExtensibility.cs

示例9: Configuration

 public void Configuration(IAppBuilder builder)
 {
     builder.UseDirectoryBrowser(@"c:\");
 }
开发者ID:Eugene1982,项目名称:NancySignalrOwin,代码行数:4,代码来源:_05_StaticFiles.cs

示例10: CustomFileSystemConfiguration

 public void CustomFileSystemConfiguration(IAppBuilder app)
 {
     app.UseDirectoryBrowser(new DirectoryBrowserOptions() { FileSystem = new MyFileSystem() });
 }
开发者ID:Xamarui,项目名称:Katana,代码行数:4,代码来源:FileServerExtensibility.cs

示例11: DirectoryMiddlewareMappedToDifferentDirectoryConfiguration

 public void DirectoryMiddlewareMappedToDifferentDirectoryConfiguration(IAppBuilder app)
 {
     app.UseDirectoryBrowser(new DirectoryBrowserOptions() { FileSystem = new PhysicalFileSystem(@"RequirementFiles\Dir1") });
 }
开发者ID:Xamarui,项目名称:Katana,代码行数:4,代码来源:DirectoryBrowser.cs

示例12: DirectoryBrowserDefaultsConfiguration

 public void DirectoryBrowserDefaultsConfiguration(IAppBuilder app)
 {
     app.UseDirectoryBrowser();
 }
开发者ID:Xamarui,项目名称:Katana,代码行数:4,代码来源:DirectoryBrowser.cs

示例13: DirectoryCustomRequestPathToPhysicalPathMappingConfiguration

        public void DirectoryCustomRequestPathToPhysicalPathMappingConfiguration(IAppBuilder app)
        {
            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                RequestPath = new PathString("/customrequestPath"),
                FileSystem = new PhysicalFileSystem(@"RequirementFiles\Dir1")
            });

            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                RequestPath = new PathString("/customrequestFullPath"),
                FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, @"RequirementFiles\Dir2"))
            });

            var localAbsolutePath = Path.Combine(Environment.CurrentDirectory, @"RequirementFiles\Dir3");
            var uncPath = Path.Combine("\\\\", Environment.MachineName, localAbsolutePath.Replace(':', '$'));
            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                RequestPath = new PathString("/customrequestUNCPath"),
                FileSystem = new PhysicalFileSystem(uncPath)
            });
        }
开发者ID:Xamarui,项目名称:Katana,代码行数:22,代码来源:DirectoryBrowser.cs


注:本文中的IAppBuilder.UseDirectoryBrowser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。