Fix empty userName when running WebRazorPages by adding default username. (#80)

This commit is contained in:
Nud authored and Steve Smith committed 2018-04-03 10:35:11 -04:00
1 parent 2c20807487
commit 0caba1a8e7
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -4,5 +4,6 @@
{
public const string BASKET_COOKIENAME = "eShop";
public const int ITEMS_PER_PAGE = 10;
public const string DEFAULT_USERNAME = "Guest";
}
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace Microsoft.eShopWeb.RazorPages.ViewComponents
{
return User.Identity.Name;
}
return GetBasketIdFromCookie();
return GetBasketIdFromCookie() ?? Constants.DEFAULT_USERNAME;
}
private string GetBasketIdFromCookie()