Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have a few tips.</p> <p>First, don't name your routes. Pass null to that first argument. There are several RedirectToRoute overloads that take a route name, and RedirectToAction returns a RedirectToRouteResult.</p> <p>Second, don't give defaults to your required parameters. If you want to have a default, give a default only to the last parameter.</p> <pre><code>routes.MapRoute(null, // don't name the route "{controller}/{action}/{projectId}/{machineName}/{companyId}", new { controller = "Project", action = "Directives", //projectId = 0, //machineName = "", //companyId = 0, } ); </code></pre> <p>Third, when in doubt, try returning a RedirectToRoute instead. Pass the controller, action, and area (if applicable) along with your other parameters:</p> <pre><code>return RedirectToRoute(new { controller = "Project", action = "Directives", // area = "SomeAreaName", // if the action is in an area projectId = projectId, machineName = project.MachineName, companyId = user.Company_Id, }); </code></pre> <p>Last tip is use T4MVC to get rid of those magic strings.</p> <pre><code>routes.MapRoute(null, // don't name the route "{controller}/{action}/{projectId}/{machineName}/{companyId}", new { controller = MVC.Project.Name, action = MVC.Project.ActionNames.Directives, } ); </code></pre> <p>You can use those same strong types in RedirectToRoute, or you can use the T4MVC partials for returning to actions:</p> <pre><code>return RedirectToAction(MVC.Project.Directives (projectId, project.MachineName, user.Company_Id)); </code></pre>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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