Search code examples
c#asp.netyetanotherforum

Yetanotherforum basic integration onto website


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!


Solution

  • YAF.NET uses well documented ASP.NET membership.

    Try:

    var user = Membership.GetUser();
    
    if (user != null)
    {
       // user is logged in...
       Response.Write(user.UserName);
    }