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
I fixed the error. I called onGet method inside the onPost method before returning the page example:
public void onGet()
{
//code
}
public void onPost()
{
//code
onGet();
return Page();
}