Sunday 15 June 2014

asp.net mvc - How to escape to use page's names like string "Index" -



asp.net mvc - How to escape to use page's names like string "Index" -

i wondering there approach escape of using

return redirecttoaction("index")

and utilize

return redirecttoaction(apppages.index.tostring())

so thought rid of possible errors

return redirecttoaction("indexx")

have utilize enumeration or static class that?

thank you!

p.s.

i found great article http://dotnetslackers.com/articles/aspnet/kill-magic-strings-with-t4mvc.aspx

there's project called t4mvc can use.

it provides strong typing views , actions.

it has nuget bundle well.

the advantage of using don't have manage process. automatically generates required classes add together views/actions or other applicable resources.

instead of using string literal "index" can utilize below.

return redirecttoaction(mvc.home.index); //assuming in homecontroller

asp.net-mvc

No comments:

Post a Comment