예제 #1
0
 public void Configuration(IAppBuilder app)
 {
     //app.Use(typeof (MiComponente));
     //app.Use(ManageRequest);
     var options = new WelcomePageOptions() { Path = new PathString("/home") };
     app.Use<WelcomePageMiddleware>(options);
 }
예제 #2
0
        /// <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;
        }
예제 #4
0
        /// <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;
        }
예제 #5
0
        /// <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;
        }
예제 #6
0
        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");
            });
        }
예제 #7
0
 public WelcomePageMiddleware(AppFunc next, WelcomePageOptions options)
 {
     _next    = next;
     _options = options;
 }
예제 #8
0
 public WelcomePageMiddleware(AppFunc next, WelcomePageOptions options)
 {
     _next = next;
     _options = options;
 }