我将以下第一种方法包含在 dll 中。我决定扩展它,以便我可以控制重定向到哪个页面。在我通过 returnUrl 的那一刻,没有任何反应。页面只是返回到我输入值的视图。
? 我希望能够重定向到位于此路径 /Views/Rental/Index 中的页面我该如何实现?
[HttpPost]
public virtual ActionResult CreateAccount(CreateNewAccountInfo createNewAccountInfo, WebSite webSite, string returnUrl)
{
if (this._accountManager.UserNameAlreadyExists(createNewAccountInfo.UserName))
this.ModelState.AddModelError("CreateNewAccountInfo", ErrorMessageProvider.CreateNewAccountInfo_UserName_AlreadyExists);
if (this.ModelState.IsValid)
{
this._accountManager.CreateNewAccount(createNewAccountInfo);
return this.RedirectToReturnUrl(returnUrl);
}
else
{
SignIn1ViewModel signIn1ViewModel = this.CreateSignIn1ViewModel(webSite, returnUrl);
this.SetupGuestCheckout(webSite, returnUrl, signIn1ViewModel);
return (ActionResult) this.View(signIn1ViewModel.WebPage.ViewName, (object) signIn1ViewModel);
}
}
public override ActionResult CreateAccount(CreateNewAccountInfo createNewAccountInfo, WebSite webSite, string returnUrl)
{
returnUrl = "../Views/Rental/Index";
base.CreateAccount(createNewAccountInfo,webSite,returnUrl);
return base.CreateAccount(createNewAccountInfo, webSite, returnUrl);
}