Developer forum

Forum » CMS - Standard features » How can i test if logged in to extranet on paragraph level

How can i test if logged in to extranet on paragraph level

Hans Ravnsfjall
Hans Ravnsfjall
Reply

On pagelevel (mater.cshtml), i can do this  

@if(!String.IsNullOrEmpty(GetString("DWextranet_AccessUserUserName"))) {

Do something

}
    

But I can not do this on paragraph level. There is no value to test, and I don´t know how i eg. could set a variable on Page level that i could test on paragraph level. Unfortunately, don´t know how to use eg. viewBag.

 

Anybody who could help?

 

/Hans


Replies

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply
This post has been marked as an answer

Hi Hans,

You can use Dynamicweb API, take a look here: https://doc.dynamicweb.com/api/html/23da5c85-e460-7cc6-f5ae-73db58ff97fe.htm

BR, Mario

 

 

Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Thanx for your reply Mario :)

 

sorry for my little knowledge, but how can i utilize this? I have tried this in my razor template, but that does not give anything other than False for the reason that the boolean I am fetching does not exist.

 

@using Dynamicweb.Security.UserManagement
@GetBoolean("IsExtranetUserLoggedIn")

 

/Hans

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Solved by this :)

@{
bool isloggedin= @Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn();
}


 

 

You must be logged in to post in the forum