This is a website that has been running with no problems for at least 8 years now, all of the sudden it starts doing this, in some pages we call on the C# code the line: Membership.GetUser().UserName
and sometimes it will return the error:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
like if the user was not authenticated, but it is, if i refresh it happens the same but if i hold the F5 key for more than a second then it returns the data and it works just fine.
I have checked and the session cookie is there, and it works for a while then it starts doing it again. The server is performing.
Any ideas?
Here is one fragment of code that gives the error:
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
realNameLabel.Text= Membership.GetUser().UserName;
}
}
There is not much to it, simple code.