Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
You need to have a URL Epi can route to a page data object that you've added to the page tree.
If LoginPage is a Epi page type you need to use a URL of such a page.
Something like http://localhost:53067/my-cool-login-page/
I'm having the same problem. I'm a complete epi newbie except for an intensive boot camp training.
I've created a login page, viewmodel, controller and view according to this article
https://support.episerver.com/hc/en-us/articles/115002559451
Can you explain what you mean in the first sentence of your answer? How do I add my page to the page tree? And how do I know what my page is called? Isn't is just login?
Here's the definition of my login page:
[ContentType(DisplayName = "LoginPage", GUID = "a1c77b97-95a6-447d-af9a-4b79b8770040", Description = "Login Page")]
[AvailableContentTypes(Availability = Availability.Specific,
IncludeOn = new[] { typeof(StartPage) },
ExcludeOn = new[] { typeof(ContainerPage), typeof(ProductPage), typeof(StandardPage), typeof(ISearchPage), typeof(LandingPage) })]
public class LoginPage : StandardPage
{
}
Thanks for your help.
This setup has some drawbacks since you need to set public access for that page you added, it not you will cause a redirect loop. Use /util/login.aspx as a backdoor if this has happend.
The above solution assumes that your login page has a specific name-in-url set. To avoid that dependency you can do something like this.
In Global.asax.cs:
protected override void RegisterRoutes(RouteCollection routes)
{
// login page route
routes.MapRoute("Login", "login", new { Controller = "SignIn", action = "Index" });
base.RegisterRoutes(routes);
}
In SignInPageController:
public override ActionResult Index(SignInPage currentPage)
{
// if you come here from custom route and are missing currentPage
if (currentPage == null)
currentPage = PageHelper.SiteSettingsPage.SignInPage.Get<SignInPage>();
var model _signInPageFactory.Service.Create(currentPage);
return View("Index", model);
}
However, you will need to have some kind of global site config where you reference your Login page so you can fetch it programatically.
So I am trying to create a custom login page instead of the EPi Server. Right now I have created a custom controller and model and page using this tutoiral
https://world.episerver.com/blogs/Daniel-Ovaska/Dates/2016/6/creating-a-custom-login-page/
The thing is when I type http://localhost:53067/LoginPage/Index in the browser window I get null for the currenPage in the below code
Does anyone know what am I missing here?