を返すASP.NET MVCビューを決定する私のMVCサイトはモバイルブラウザと非モバイルブラウザでうまく動作します。私が持っている問題はこれです。私はいくつかのアクションがある(ログの理由のために)return RedirectToAction(...);
を代わりに使用したくないので、return View("OtherView", model);
モバイルで試してみるまで、これはうまく動作し、OtherView.Mobile.cshtmlが見つかりませんでした。この仕事をする方法はありますか?返されたビュー(モデル)を使用せずに返されたView( "viewName"、model)
Thiseは図で
Views/Account/Create.cshtml
Views/Account/Create.Mobile.cshtml
Views/Account/CreateSuccess.cshtml
Views/Account/CreateSuccess.Mobile.cshtml
これは
public ActionResult Create(FormCollection form)
{
TryUpdateModel(model);
if(!ModelState.IsValid) { return View(); } // this works correctly
var model = new Account();
var results = database.CreateAccount(model);
if(results) return View("CreateSuccess", model); // trying to make this dynamic
return View(model); // this works correctly
}
は、通常、私はちょうど、アカウントの詳細ページへreturn RedirectToAction(...);
どうなるアクションであるが、これは、このユーザーのための追加のログエントリを(生成されます。読み取り中)、詳細ページにはパスワードへのアクセス権がありません。 ActionResult Create
はもともとはパスワードを持っていたので、確認のためにユーザに表示することはできません。私はちょうど彼らの最初の使用上のセッション変数を設定します
Views/Account/Create.cshtml
Views/Account/Create.Mobile.cshtml
Views/Account/Create.iPad.cshtml
Views/Account/CreateSuccess.cshtml
Views/Account/CreateSuccess.Mobile.cshtml
Views/Account/CreateSuccess.iPad.cshtml