// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Http;
using Microsoft.AspNet.StaticFiles;
namespace Microsoft.AspNet.Builder
{
///
/// Extension methods for the DirectoryBrowserMiddleware
///
public static class DirectoryBrowserExtensions
{
///
/// Enable directory browsing on the current path for the current directory
///
///
///
public static IApplicationBuilder UseDirectoryBrowser([NotNull] this IApplicationBuilder builder)
{
return builder.UseDirectoryBrowser(new DirectoryBrowserOptions());
}
///
/// Enables directory browsing for the given request path from the directory of the same name
///
///
/// The relative request path and physical path.
///
public static IApplicationBuilder UseDirectoryBrowser([NotNull] this IApplicationBuilder builder, [NotNull] string requestPath)
{
return builder.UseDirectoryBrowser(new DirectoryBrowserOptions() { RequestPath = new PathString(requestPath) });
}
///
/// Enable directory browsing with the given options
///
///
///
///
public static IApplicationBuilder UseDirectoryBrowser([NotNull] this IApplicationBuilder builder, [NotNull] DirectoryBrowserOptions options)
{
return builder.UseMiddleware(options);
}
}
}