所以我试图创建一个自定义登录页面而不是EPi Server.现在我使用这个tutoiral创建了一个自定义控制器和模型和页面
https://world.episerver.com/blogs/Daniel-Ovaska/Dates/2016/6/creating-a-custom-login-page/
问题是当我在浏览器窗口中键入http:// localhost:53067/LoginPage/Index时,我在下面的代码中为currenPage获取null
public ActionResult Index(LoginPage currentPage, [FromUri]string ReturnUrl)
{
/* Implementation of action. You can create your own view model class that you pass to the view or
* you can pass the page type for simpler templates */
var model = new LoginModel(currentPage);
model.LoginPostbackData.ReturnUrl = ReturnUrl;
return View(model);
}
Run Code Online (Sandbox Code Playgroud)
有谁知道我在这里失踪了什么?
currentPage如果存在LoginPage映射到URL 的类型页面,则该参数将仅具有值.
看来你只是在浏览控制器路径.
如果您创建一个LoginPage名为"我的登录页面" 类型的页面,它应该获得一个类似http:// localhost:53067/my-login-page的URL .
然后,如果您浏览到该URL,Index则会调用您的方法,假设您的控制器继承PageController.