Archives for MVC
Understanding Produces and Consumes Attribute in MVC 6
Produces and Consumes Attributes are newly introduced in MVC 6 ( Core) to control the content negotiation. What is Content Negotiation? The process of picking the correct output format is known as Content Negotiation. Generally, Frameworks will…
How to configure C# WebApi2 to display data in JSON format directly in browser?[Solved]
Recently I was asked a question "How to configure C# WebApi2 to display data in JSON format directly in browser?" by one of my colleague. This is a simple solution…
Downloading PDF File from Server to Client using ASP.NET & MVC C#
Problem Statement This is a very regular requirement especially for online education or E-commerce applications, a user will be given an option to download the payment receipts or certificates on demand. Solution In this article…
Different ways to rendering a Partial View in ASP.NET MVC
A partial view is like as user control in Web forms that is used for code re-usability. Partial views helps us to reduce code duplication. Below are four methods for rendering a…
How to secure your entire MVC application with “Authorize” attribute ?
Scenario: If you would like to secure your admin pages, you would add “Authorize” attribute for all your admin controllers. However, you might get a situation like; you need to…
Issue: The length of the string exceeds the value set on the maxJsonLength property
Problem Statement Many people had faced with their MVC Applications with the following issue. Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the…
Use of AllowAnonymous Attribute in ASP.Net MVC ?
AllowAnonymous Attribute that helps you secure an entire MVC 4 Website or Controller while providing a convenient means of allowing anonymous users access to certain controller action. using ; namespace…
Routing in ASP.NET MVC
Routing is a pattern matching system that monitor the incoming request and figure out what to do with that request. At run time, Routing engine use the Route table for…
ASP.Net MVC Entity Framework
Entity Framework is an Object/Relational Mapping (ORM) framework that enables developers to work with various relational databases like SQL Server, Oracle, DB2, MYSQL etc. It enables developers to deal with…