I have this if statement in the cshtml of a page. For some reason or another it keeps giving me that the User.Identity.IsAuthenticated is dereference of possible null reference and when the program starts it doesn't consider the statement.How can it be fixed?
this is after implementing your solution
Addition: the error occurs on post