예제 #1
0
        /// <summary>
        /// Process an individual request.
        /// </summary>
        /// <param name="environment"></param>
        /// <returns></returns>
        public Task Invoke(IDictionary <string, object> environment)
        {
            IOwinContext context = new OwinContext(environment);

            IOwinRequest request = context.Request;

            if (!_options.Path.HasValue || _options.Path == request.Path)
            {
                // Dynamically generated for LOC.
                var welcomePage = new WelcomePage();
                welcomePage.Execute(context);
                return(Task.FromResult(0));
            }

            return(_next(environment));
        }
        /// <summary>
        /// Process an individual request.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override Task Invoke(IOwinContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            IOwinRequest request = context.Request;

            if (!_options.Path.HasValue || _options.Path == request.Path)
            {
                // Dynamically generated for LOC.
                var welcomePage = new WelcomePage();
                welcomePage.Execute(context);
                return(TaskHelpers.Completed());
            }

            return(Next.Invoke(context));
        }