public void Configuration(IAppBuilder app) { //app.Use(typeof (MiComponente)); //app.Use(ManageRequest); var options = new WelcomePageOptions() { Path = new PathString("/home") }; app.Use<WelcomePageMiddleware>(options); }
/// <summary> /// Adds the WelcomePageMiddleware to the pipeline with the given options. /// </summary> /// <param name="builder"></param> /// <param name="options"></param> /// <returns></returns> public static IAppBuilder UseWelcomePage(this IAppBuilder builder, WelcomePageOptions options) { if (builder == null) { throw new ArgumentNullException("builder"); } return builder.Use(typeof(WelcomePageMiddleware), options); }
/// <summary> /// Creates a default web page for new applications. /// </summary> /// <param name="next"></param> /// <param name="options"></param> public WelcomePageMiddleware(OwinMiddleware next, WelcomePageOptions options) : base(next) { if (options == null) { throw new ArgumentNullException("options"); } _options = options; }
/// <summary> /// Creates a default web page for new applications. /// </summary> /// <param name="next"></param> /// <param name="options"></param> public WelcomePageMiddleware(AppFunc next, WelcomePageOptions options) { if (next == null) { throw new ArgumentNullException("next"); } if (options == null) { throw new ArgumentNullException("options"); } _next = next; _options = options; }
public void Configuration(IAppBuilder app) { UseErrorPage(app); WelcomePageOptions options = new WelcomePageOptions(); options.Path = new PathString("/welcome"); app.UseWelcomePage(options); app.Run(context => { // New code: Throw an exception for this URI path. if (context.Request.Path.Value.ToLower() == "/fail") { throw new Exception("My Error"); } context.Response.ContentType = "text/plain"; return context.Response.WriteAsync("Hello, world! Navigate to /welcome for happy blue thing navigate to /fail for katana error explosion output formatting"); }); }
public WelcomePageMiddleware(AppFunc next, WelcomePageOptions options) { _next = next; _options = options; }