Nizamuddin Siddiqui has Published 2307 Articles

What is ViewData in ASP .Net MVC C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:35:20

2K+ Views

ViewData is a dictionary of objects that are stored and retrieved using strings as keys. It is used to transfer data from Controller to View. Since ViewData is a dictionary, it contains key-value pairs where each key must be a string. ViewData only transfers data from controller to view, not ... Read More

How can we test C# Asp.Net WebAPI?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:33:21

1K+ Views

Testing WebApi involves sending a request and receiving the response. There are several ways to test the WebApi. Here we will test the WebApi using postman and swagger. Let us create a StudentController like below.Student Modelnamespace DemoWebApplication.Models{    public class Student{       public int Id { get; set; ... Read More

How to consume Asp.Net WebAPI endpoints from other applications using C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:28:34

281 Views

HttpClient class provides a base class for sending/receiving the HTTP requests/responses from a URL. It is a supported async feature of .NET framework. HttpClient is able to process multiple concurrent requests. It is a layer over HttpWebRequest and HttpWebResponse. All methods with HttpClient are asynchronous. HttpClient is available in System.Net.Http ... Read More

What is the use of Authorize Attribute in C# Asp.Net webAPI?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:24:42

6K+ Views

Authorization is the process of deciding whether the authenticated user is allowed to perform an action on a specific resource (Web API Resource) or not. For example, having the permission to get data and post data is a part of authorization. The Authorization Process happens before executing the Controller Action ... Read More

What is Content Negotiation in Asp.Net webAPI C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:23:03

2K+ Views

Content negotiation is the process of selecting the best representation for a given response when there are multiple representations available. Means, depending on the Accept header value in the request, the server sends the response. The primary mechanism for content negotiation in HTTP are these request headers −Accept − Which ... Read More

What is the use of ChildActionOnly attribute in ASP .Net MVC C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:20:26

856 Views

Child Action is only accessible by a child request. It will not respond to the URL requests. If an attempt is made, a runtime error will be thrown stating - Child action is accessible only by a child request. Child action methods can be invoked by making child request from ... Read More

What are the levels at which filters can be applied in ASP .Net MVC C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:17:38

376 Views

In an ASP .Net MVC application filters can be applied in three levels.Action Method LevelController LevelGlobal LevelAction Method LevelFilters that are applied at the Action Method level will work only particularly for that action method.using System.Web.Mvc; namespace DemoMvcApplication.Controllers{    public class HomeController : Controller{       [Authorize] //Action Method ... Read More

What are the three segments of the default route, that is present in ASP .Net MVCC#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:15:18

793 Views

The ASP.Net MVC Routing module is responsible for mapping incoming browser requests to particular MVC controller actions. When the ASP.NET MVC application launches then the application registers one or more patterns with the framework's route table to tell the routing engine what to do with any requests that matches those ... Read More

What is the significance of NonActionAttribute in ASP .Net MVC C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:10:35

3K+ Views

The NonAction attribute is used when we want a public method in a controller but do not want to treat it as an action method. An action method is a public method in a controller that can be invoked using a URL. So, by default, if we have any public ... Read More

How to use ViewBag in ASP .Net MVC C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Sep-2020 11:07:44

3K+ Views

ViewBag uses the dynamic feature that was introduced in to C# 4.0. It allows an object to have properties dynamically added to it. Internally, it is a dynamic type property of the ControllerBase class which is the base class of the Controller class.ViewBag only transfers data from controller to view, ... Read More

Advertisements