If you mistype the name of the controller you will get the surprise at runtime:
return RedirectToAction("Index","ProductManager", new { id=id });
Same thing in the Razor syntax, the IDE has no way to check that a class you assign to an element exists since it is a magic string instead of being a markup the IDE can validate.
@Html.TextBoxFor(m => m.Name, new {@class = "title width-7" })
They built Entity Framework to get away from string based SQL statements and when they redesigned the web stack they went all-in on string based... As a result the IDE is pretty much helpless to spot errors in an asp.net MVC project before you compile (or to provide tooling - forget about renaming a controller).
What you're actually asking for is that you want urls and html to be statically typed, neither of which it makes any sense to be.
Your first example is a bad example because you simply don't have to use that stuff, they're convenience functions for quick prototyping using the controller names. Action links are urls, that's all, and urls are strings. If it bothers you, with a tiny amount of code in a helper method you can make it all strongly typed, or use the horrific overkill that is T4MVC as suggested in another reply.
Personally I completely avoid any MVC method with 'Action' in the method name, I use [Route] attributes and use hand-crafted urls rather than the controller autogenerated stuff. These can, again, all be hidden in nice statically typed helper functions and methods. Your example of `RedirectToAction` is simply a glorified `Redirect`, but the convenience method creates the url for you.
That's the good thing, you get to choose.
As for razor, it's the equivalent of complaining about misspelling html attributes. The whole reason that they're dynamic is so we can properly add whatever attributes we want to html, just like html allows us too. If we're using angular, we can easily add ng-attributes. If we want to make up a new data-thing-whatever, it will just work. When new attributes are released, we can simply use them without having to upgrade our MVC libraries.
The whole point is that you should be able to add it arbitrarily, it's not magic strings, it's dynamic by design. It can't be statically typed.
What you're asking for would require a new update for MVC every time they released a new html spec. It would be an utter nightmare.
This might be a Resharper thing, but I'm pretty sure I see errors in my editor if I try to reference an action or a view that doesn't exist. Although I've mostly bailed on MVC in favor of Nancy, since it's a lot easier to run that through a self-hosted OWIN webservice, rather than dick around with IIS.
Last time a did a full on MVC app I ended up writing strongly typed extension methods to handle this. I don't suggest everyone do this themselves, System.Linq.Expressions is a deep dark hole, but surely there are some maintained open source packages out there.
Not a fan of Razor. Track down 'Json.net Decycle' and you can deliver your whole vm in javascript. With signalr and some effort you can then dynamically update a frontend object graph via automation (JS makes this easy). I've abstracted this all into a library which uses knockout (I like knockout!!!) for personal use that I'd like to clean up and share someday. You can do the same thing in .net, but you have to use dynamically compiled delegates to make it efficient. You can also make your own fluent style apis if you Google how. Those with dynamically compiled delegates (aka fast reflection) bridge the function to string gap. God I need people to talk to at work...
They also partially fixed that in the new version of MVC by offering a markup alternative to razor (effectively going back to webform's markup syntax!).
return RedirectToAction("Index","ProductManager", new { id=id });
Same thing in the Razor syntax, the IDE has no way to check that a class you assign to an element exists since it is a magic string instead of being a markup the IDE can validate.
@Html.TextBoxFor(m => m.Name, new {@class = "title width-7" })
They built Entity Framework to get away from string based SQL statements and when they redesigned the web stack they went all-in on string based... As a result the IDE is pretty much helpless to spot errors in an asp.net MVC project before you compile (or to provide tooling - forget about renaming a controller).