1

I've got the forum setup on my ASP.net website fine, works great!

I want to use their membership system as my central user system on my site though.

I basically want to be able to tell if a user is logged in or not. IE, best case scenario, on my custom Master page I just have a:

if(UserIsLoggedIn){
    Response.Write(LoggedInUserName);
}

Don't really know how to go about getting that though!

Tom Gullen
  • 61,249
  • 84
  • 283
  • 456

2 Answers2

1

YAF.NET uses well documented ASP.NET membership.

Try:

var user = Membership.GetUser();

if (user != null)
{
   // user is logged in...
   Response.Write(user.UserName);
}
Jaben
  • 426
  • 3
  • 9
  • Hi Jaben, sorry if it came off as aggressive, I did actually ask in your forum first but only one user was helping me and he couldn't really answer me. – Tom Gullen Mar 07 '11 at 09:12
  • Sorry about that, Tom. If I had seen your post, I would have responded to it. – Jaben Mar 07 '11 at 15:05
  • no worries, I love the initial impression of YAF by the way, it's miles ahead of any other .net forum and I look forward to running it on my site! I've edited original question so my misunderstanding wont reflect badly on you. – Tom Gullen Mar 07 '11 at 15:09
0

What's the error?

P.S. It's Response.Write(), capitalized.

Marko
  • 71,361
  • 28
  • 124
  • 158