What is the difference between String and string?

string is an alias for System.String. So technically, there is no difference. It’s like int vs. System.Int32. As far as guidelines, I think it’s generally recommended to use string any time you’re referring to an object. e.g.

Likewise, I think it’s generally recommended to use String if you need to refer specifically to the class. e.g.

Tagged

What is the difference between tempdata ,viewdata and viewbag?

Temp data : Helps to maintain data when you move from one controller to other controller or from one action to other action. In other words when you redirect,“tempdata” helps to maintain data between those redirects. It internally uses session variables. View data : Helps to maintain data when you move from controller to view. View Bag : It’s a dynamic wrapper around view data. When you use “Viewbag” type casting is not required. It uses the dynamic keyword internally. Session variables : By using session variables we can maintain data from any entity to any entity. Hidden fields and … Click here to continue…..

How can we restrict MVC actions to be invoked only by GET or POST?

We can decorate the MVC action by “HttpGet” or “HttpPost” attribute to restrict the type of HTTP calls. For instance you can see in the below code snippet the “DisplayCustomer” action can only be invoked by “HttpGet”. If we try to make Http post on “DisplayCustomer” it will throw an error.