I need to display a piece of text through a widget template for users who are not logged in. The widget template serves the dynamic Sitefinity module, the module is partially accessible for users without registration. I want non-registered users to receive a message that they must be logged in to read the full content.
I set permissions for the fields, and everything works as it should, but the only missing item displays a message for users without registration.
I tested this in a simple web form test file, and it works:
<p>You are <asp:Literal ID="UserStatus" runat="server" />.</p>
and the code is behind:
public string Name { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (Page.Request.IsAuthenticated)
{
UserStatus.Text = "Logged in";
}
else
{
UserStatus.Text = "Not logged in";
}
}
, Code-behind Sitefinity, , :
Object reference not set to an instance of an object.
:
UserStatus.Text = "Logged in";
Code-behind widget ?