Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
I Think I solved it!
Changed the LoginPage dynamic property to the full URL to the login page and
protected string GetLoginUrl()
{
string LoginPage = CurrentPage["LoginPage"].ToString();
return LoginPage;
}
it works! However mayby there is some better solution available?
Hello!
I am new to EpiServer.
I am trying to write a login/logout button in the page header area template.
here is the header template
<asp:LoginView ID="LoginView" runat="server">
<AnonymousTemplate>
<a href="<%= GetLoginUrl() %>"><asp:Literal ID="Literal1" runat="server" Text="Logga in" /></a>
</AnonymousTemplate>
<LoggedInTemplate>
<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutText="Logga ut" />
</LoggedInTemplate>
</asp:LoginView>
I have added dynamic properties to my start page in the episerver admin CMS, "StartPage" = the start page and "LoginPage" = util/login.aspx
I get the correct printout (7 and util/login.aspx)when I write
<%= CurrentPage["LoginPage"] %></br>
<%= CurrentPage["StartPage"] %></br>
in the default page.
however I cant get the GetLoginUrl() function in the page header template background class to function as I wamt. I want to get the URL to the login page as a dynamic property.
for example something like this (this wont work)
/// <summary>
/// Gets the link to the login page
/// </summary>
protected string GetLoginUrl()
{
PageReference loginPageRef = CurrentPage["LoginPage"] as PageReference;
return loginPageRef.ToString();
}
any ideas? :)
Thanks!