asp.net mvc - Why is Hardcoding URL strings into an MVC app is a bad idea? (Or is it?) -
asp.net mvc - Why is Hardcoding URL strings into an MVC app is a bad idea? (Or is it?) -
in comment on question, phil mentions
hardcoding url strings mvc app bad idea. helpers there reason
is so? if so, why?
url generation result of route configuration in application's global.asax. when utilize helpers actionlink, inspect route configuration , generate routes accordingly.
if alter route configuration later, or install application virtual directory, urls generated helpers in whole application changed dynamically, don't have inspect , alter every hardcoded url string hand, , application less break.
if want markup anchors, can utilize urlhelper.action method. internally of helpers depend on url generation, utilize method.
<a href="@url.action("logon", "account")">logon<a> asp.net-mvc model-view-controller
Comments
Post a Comment