Membership.GetUser() is returning null when app starts

DjMaster

New Member
I've implemented my own AccountProfile class is ASP.net MVC and it works but now I'm running into a strange problem. First off, I'm calling AccountProfile.MyProperty in the Views/Shared/_LoginPartial.cshtml. AccountProfile.MyProperty makes a call to Membership.GetUser().UserName to work. Now, when I "signup" for an account, after I'm logged in, AccountProfile.MyProperty works and renders info into the html page. However when I stop running, change some code, and launch again, Membership.GetUser() returns null, even though I'm still logged in according to membership. After the page fails to load, if I navigate to the /Account/Login page, Membership.GetUser() works. After it works, I can then navigate to the index page that didn't work at start, and it works. My question is why does Membership.GetUser() return null when my page first loads up? Thanks.
 
Back
Top