diff --git a/samples/SocialSample/Startup.cs b/samples/SocialSample/Startup.cs index 62d9c8380..65ab36f08 100644 --- a/samples/SocialSample/Startup.cs +++ b/samples/SocialSample/Startup.cs @@ -178,9 +178,9 @@ dnx . web }); // Choose an authentication type - app.Map("/login", signoutApp => + app.Use(next => async context => { - signoutApp.Run(async context => + if (context.Request.Path.StartsWithSegments(new PathString("/login"))) { var authType = context.Request.Query["authscheme"]; if (!string.IsNullOrEmpty(authType)) @@ -199,13 +199,10 @@ dnx . web await context.Response.WriteAsync("" + (type.Caption ?? "(suppressed)") + "
"); } await context.Response.WriteAsync(""); - }); - }); - - // Sign-out to remove the user cookie. - app.Map("/logout", signoutApp => - { - signoutApp.Run(async context => + return; + } + // Sign-out to remove the user cookie. + else if (context.Request.Path.StartsWithSegments(new PathString("/logout"))) { await context.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); context.Response.ContentType = "text/html"; @@ -213,7 +210,10 @@ dnx . web await context.Response.WriteAsync("You have been logged out. Goodbye " + context.User.Identity.Name + "
"); await context.Response.WriteAsync("Home"); await context.Response.WriteAsync(""); - }); + return; + } + + await next(context); }); // Deny anonymous request beyond this point.