Fix empty userName when running WebRazorPages by adding default username. (#80)
This commit is contained in:
@@ -4,5 +4,6 @@
|
|||||||
{
|
{
|
||||||
public const string BASKET_COOKIENAME = "eShop";
|
public const string BASKET_COOKIENAME = "eShop";
|
||||||
public const int ITEMS_PER_PAGE = 10;
|
public const int ITEMS_PER_PAGE = 10;
|
||||||
|
public const string DEFAULT_USERNAME = "Guest";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Microsoft.eShopWeb.RazorPages.ViewComponents
|
|||||||
{
|
{
|
||||||
return User.Identity.Name;
|
return User.Identity.Name;
|
||||||
}
|
}
|
||||||
return GetBasketIdFromCookie();
|
return GetBasketIdFromCookie() ?? Constants.DEFAULT_USERNAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetBasketIdFromCookie()
|
private string GetBasketIdFromCookie()
|
||||||
|
|||||||
Reference in New Issue
Block a user