Note that there are some explanatory texts on larger screens.

plurals
  1. POSet RedirectUrl in JsonResult Action method
    primarykey
    data
    text
    <p>I am trying to implement demo application to learn ASP.NET MVC. Application have three views and corresponding actions and also have login feature. </p> <p><strong>Views:</strong></p> <ol> <li>Index.cshtml - contains person information grid</li> <li>PersonInfoView.cshtml - display person information in view mode</li> <li>PersonInfoEdit.cshtml - allow user to edit person information</li> </ol> <p><strong>Default Route:</strong></p> <pre><code> routes.MapRouteWithName( "Default", // Route name "", // URL with parameters new { controller = "Person", action = "Index" } // Parameter defaults ); </code></pre> <p><strong>For Person view and Edit I created following routes:</strong></p> <pre><code> routes.MapRoute( "ViewPerson", // Route name "View/{PersonId}", // URL with parameters new { controller = "Person", action = "PersonInfoView", PersonId= "" } // Parameter defaults ); routes.MapRoute( "EditPerson", // Route name "{PersonId}", // URL with parameters new { controller = "Person", action = "PersonInfoEdit", PersonId= "" } // Parameter defaults ); </code></pre> <p>So, url for edit person will be "localhost/1" &amp; for view "localhost/view/1"</p> <p>User can view or edit person information. The option edit(in Index) available in case user status is logged in. I have login button (which open Jquery Dialog) in PersonInfoView.cshtml (if user is not logged) which allows user to login in application. </p> <p>I want to redirect user to edit page if user logins to application via PersonInfoView.cshtml page.</p> <p><strong>Login user action returns JsonResult:</strong></p> <pre><code>return Json(new { res = 1, RedirectUrl = "" }, JsonRequestBehavior.AllowGet); </code></pre> <p>How can I set RedirectUrl equals to person edit view if user login to application via PersonInfoView.cshtml.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload