diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index c830984..2db0bef 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -62,7 +62,7 @@ namespace MusicStore services.ConfigureCookieAuthentication(options => { - options.AccessDeniedPath = new PathString("/Home/AccessDenied"); + options.AccessDeniedPath = new PathString("~/Home/AccessDenied"); }); services.ConfigureFacebookAuthentication(options => diff --git a/test/E2ETests/Implementation/Validator.cs b/test/E2ETests/Implementation/Validator.cs index 6a62959..e3ea01d 100644 --- a/test/E2ETests/Implementation/Validator.cs +++ b/test/E2ETests/Implementation/Validator.cs @@ -142,13 +142,12 @@ namespace E2ETests { _logger.LogInformation("Trying to access StoreManager that needs ManageStore claim with the current user : {email}", email ?? "Anonymous"); var response = await _httpClient.GetAsync("Admin/StoreManager/"); + await ThrowIfResponseStatusNotOk(response); + var responseContent = await response.Content.ReadAsStringAsync(); + ValidateLayoutPage(responseContent); if (email == null) { - await ThrowIfResponseStatusNotOk(response); - var responseContent = await response.Content.ReadAsStringAsync(); - ValidateLayoutPage(responseContent); - Assert.Contains("Log in – ASP.NET MVC Music Store", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains("

Use a local account to log in.

", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Equal(_deploymentResult.ApplicationBaseUri + PrefixBaseAddress("Account/Login?ReturnUrl=%2F{0}%2FAdmin%2FStoreManager%2F"), response.RequestMessage.RequestUri.AbsoluteUri); @@ -156,10 +155,6 @@ namespace E2ETests } else { - await ThrowIfResponseStatusNotOk(response); - var responseContent = await response.Content.ReadAsStringAsync(); - ValidateLayoutPage(responseContent); - Assert.Contains("Access denied due to insufficient permissions – ASP.NET MVC Music Store", responseContent, StringComparison.OrdinalIgnoreCase); } }