Ok, take this example below,
public ActionResult ViewProfile() { //Load the profile for the currently logged in user if (Membership.GetUser() != null) { //Do some stuff get some data. return View(ReturnViewModel); } return RedirectToAction("MainLogon","Logon"); }
In any case, to avoid the "magic lines" when redirecting to the login page?
In this case, I will not approach MVC Futures.
I would recommend using T4MVC
David Ebbo talks about it here: http://blogs.msdn.com/davidebb/archive/2009/06/17/a-new-and-improved-asp-net-mvc-t4-template.aspx
With the updated version, it also includes refactoring support for action methods:
http://blogs.msdn.com/davidebb/archive/2009/06/26/the-mvc-t4-template-is-now-up-on-codeplex-and-it-does-change-your-code- a-bit.aspx
, :
<% Html.RenderPartial("DinnerForm"); %>
intellisense :
<% Html.RenderPartial(MVC.Dinners.Views.DinnerForm); %>
:
http://www.hanselman.com/blog/TheWeeklySourceCode43ASPNETMVCAndT4AndNerdDinner.aspx
(1). . - ASP.NET MVC, MVC Futures
- :
Html.ActionLink<HomeController>(c => c.Index(), "Home")
(2). .
Source: https://habr.com/ru/post/1722666/More articles:How to determine if an object can be converted to a meaningful string in C # - stringFuzzy text search: a regular expression lookup generator? - phpWhy not resize and clear jobs in the GotW 54? - c ++CakePHP application on the server? - cakephpIs there a problem with the sandcastle created .chm help file? - c # -2.0Is there a Firefox plug-in that can display insecure assets that cause a “Warning: contains failed content” - securityHow to hide a value in the registry (for example, RegSide sysinternals tool) - delphiКак реализовать CRUD-операции в UML - analysisMultipage Email - javaImport / export format to VCard format programmatically using API level 5 for Android OS 2.0 - androidAll Articles