Xpode.com        Click here to Print this article.

C# and ASP.NET MVC (Model view controller) interview questions and answers: - 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 a error.

[HttpGet]

        public ViewResult DisplayCustomer(int id)

        {

            Customer objCustomer = Customers[id];

 

            return View("DisplayCustomer",objCustomer);

        }

  Below is an important c# interview question and answers video 







http://
http://

Contributed by:
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site http://www.questpond.com for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers

Resourse address on xpode.com
http://xpode.com/xpodehost/Print.aspx?Articleid=647

Click here to go on website