views:

564

answers:

1

I just swiched to a new ASP.NET host and it seems it is behaving differently. In the code for the master page it is attempting too do some different logic for authenticated users by this.

if (Context.User.IsAuthenticated) {
}

But the Context.User object is null. But it's only null on the master page. If I use it on the regular page it works.

if (User.IsAuthenticated) {
}

Does anyone have any idea what the problem might be? I might not have much control over the hosting environment but is there a different way I can get this information in the master page?

ADDITIONAL INFORMATION:

It seems that the Context.User or Page.User object is null in both

  • Dashboard.aspx (which users the master page Page.master) AND
  • Page.master

But it is not null in

  • TestUser.aspx (which does not use any master page)
+2  A: 

Why don't you use:

Page.User.IsAuthenticated

on the master page?

Keltex
I tried this but the same result.
Nathan Palmer
I have since moved away from this application and finished the MVC version of the site so this problem is no longer an issue. I didn't realize you could use Page.User.IsAuthenticated so this did help me out.
Nathan Palmer