示例#1
0
		private static ServerContext CreateContext(Dictionary<string, Route> scanResult, Http404Behavior http404Behavior, string rootRequestPath)
		{
			var context = new ServerContext
			{
				Http404Behavior = http404Behavior,
				RootRequestPath = rootRequestPath
			};

			var http404 = scanResult.Keys.FirstOrDefault(x => x.EndsWith("/_error/404"));

			if (http404 != null)
			{
				context.Custom404Page = scanResult[http404].Resource;
				scanResult.Remove(http404);
			}

			var http500 = scanResult.Keys.FirstOrDefault(x => x.EndsWith("/_error/500"));

			if (http500 != null)
			{
				context.Custom500Page = scanResult[http500].Resource;
				scanResult.Remove(http500);
			}

			context.Routes = scanResult;

			return context;
		}
示例#2
0
        private static ServerContext CreateContext(Dictionary <string, Route> scanResult, Http404Behavior http404Behavior, string rootRequestPath)
        {
            var context = new ServerContext
            {
                Http404Behavior = http404Behavior,
                RootRequestPath = rootRequestPath
            };

            var http404 = scanResult.Keys.FirstOrDefault(x => x.EndsWith("/_error/404"));

            if (http404 != null)
            {
                context.Custom404Page = scanResult[http404].Resource;
                scanResult.Remove(http404);
            }

            var http500 = scanResult.Keys.FirstOrDefault(x => x.EndsWith("/_error/500"));

            if (http500 != null)
            {
                context.Custom500Page = scanResult[http500].Resource;
                scanResult.Remove(http500);
            }

            context.Routes = scanResult;

            return(context);
        }