私はasp.net MVC 3アプリケーションを開発中です。アプリケーションの1つのホームページ、次のようにログインページにリダイレクトするいくつかのリンクがあります。私はこのような部分的なビューを持つログインビュー上ログイン後にURLが返ってこない
public ActionResult Login()
{
return view();
}
:
<a href="Home/Login?returnUrl=/Disputes/Index"> Disputes </a>
ログインアクションメソッドは、このようなものです:それはこのようなものです上部に
:
@Html.Partial("_LogOn", new LogOnModel { Type = LogOnTypeEnum.Obligor })
と_LogOn部分はこのようなものです:
@{
string retUrl = "";
if (ViewContext.HttpContext.Request.UrlReferrer != null)
{
retUrl =
ViewContext.HttpContext.Request.UrlReferrer.PathAndQuery;
}
}
とフォームのようになります。私は(それは私のように部分図を使用していない。この例を以下の午前
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
// I want to redirect to localhost:2304//myapp/returnurl but returnurl is empty
}
:
@using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { autocomplete = "off", id = "frmLogin", Type = 2, model = this.Model, returnUrl = Request.QueryString["ReturnUrl"] }))
、最終的には、アカウントコントローラの方法をログオン使用中)
の可能複製(http://stackoverflow.com/questions/9554115/redirect-to-return-url-ログイン後) – Rafay