en
Feedback
.Net Interview Questions

.Net Interview Questions

Open in Telegram

.Net Interview Questions

Show more
The country is not specifiedTechnologies & Applications40 773
1 794
Subscribers
+124 hours
+207 days
+4930 days
Posts Archive
🚩2️⃣4️⃣8️⃣ What is WCF?

〰〰 WCF Questions 〰〰

Content negotiation is basically a process of selecting the best representation from multiple representations that are available for a given response. It simply allows one to choose rather than negotiate content that one wants to get in response. It is performed at the server-side. In simple words, it chooses the best media type for matters to return a response to an incoming request.

❇2⃣4⃣7⃣ What is content negotiation in ASP.Net Web API?

No, we cannot return the view from the ASP.NET Web API method. ASP.NET web API develops HTTP services that provide raw data or information. ApiController in ASP.NET MVC application only renders data that is serialized and sent to the client. One can use a controller to provide normal views.

❇2⃣4⃣6⃣ Can we return View from ASP.NET Web API method?

Routing is the most important part of ASP.NET Web API. Routing is a way how Web API matches a URI to an action. It is basically a process that decides which action and controller should be called. The controller is basically a class that handles all HTTP requests. All public methods of controllers are basically known as action methods or just actions. Whenever a Web API framework receives any type of request, it routes that request to action. There are basically two ways to implement routing in Web API as given below: Convention-based routing: Web API supports convention-based routing. In this type of routing, Web API uses route templates to select which controller and action method to execute. Attribute-based routing: Web API 2 generally supports a new type of routing known as attribute routing. As the name suggests, it uses attributes to define routes. It is the ability to add routes to the route table via attributes.

❇2⃣4⃣5⃣ What is ASP.NET Web API routing?

Web API generally provides greater flexibility in terms of handling errors. Exception handling is a technique that is used to handle run-time errors in application code. One can use HttpResponseException, HttpError, Exception filters, register exception filters, Exception handlers to handle errors. Exception filter can be used to identify unhandled exceptions on actions or controllers, exception handlers can be used to identify any type of unhandled exception application-wide, and HttpResponseException can be used when there is the possibility of an exception.

❇2⃣4⃣4⃣ How to handle errors in Web API?

photo content

Filters are basically used to add extra logic at different levels of Web API framework request processing. Different types of Web API filters are available as given below: • Authentication Filter: It handles authentication and authenticates HTTP requests. It also helps to authenticate user detail. It checks the identity of the user. • Authorization Filter: It handles authorization. It runs before controller action. This filter is used to check whether or not a user is authenticated. If the user is not authenticated, then it returns an HTTP status code 401 without invoking the action. • AuthorizeAttribute is a built-in authorization filter provided by Web API. • Action Filter: It is attributing that one can apply to controller action or entire controller. It is used to add extra logic before or after controller action executes. It is simply a way to add extra functionality to Web API services. • Exception Filter: It is used to handle exceptions that are unhandled in Web API. It is used whenever controller actions throw an unhandled exception that is not HttpResponseException. It will implement an “IExceptionFilter” interface. • Override Filter: It is used to exclude specific action methods or controllers from the global filter or controller level filter. It is simply used to modify the behavior of other filters for individual action methods.

❇2⃣4⃣3⃣ What are Web API filters?

• Some of the advantages of web services are: • Interoperability: Web services are accessible over network and runs on HTTP/SOAP protocol and uses XML/JSON to transport data, hence it can be developed in any programming language. Web service can be written in java programming and client can be PHP and vice versa. • Reusability: One web service can be used by many client applications at the same time. • Loose Coupling: Web services client code is totally independent with server code, so we have achieved loose coupling in our application. • Easy to deploy and integrate, just like web applications. • Multiple service versions can be running at same time.

❇2⃣4⃣2⃣ What are the advantages of Web Services?

There are two types of web services: • SOAP Web Services: Runs on SOAP protocol and uses XML technology for sending data. • Restful Web Services: It’s an architectural style and runs on HTTP/HTTPS protocol almost all the time. REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services.

❇2⃣4⃣1⃣ What are different types of Web Services?

Some of the advantages of REST web services are: • Learning curve is easy since it works on HTTP protocol • Supports multiple technologies for data transfer such as text, xml, json, image etc. • No contract defined between server and client, so loosely coupled implementation. • REST is a lightweight protocol • REST methods can be tested easily over browser

❇2⃣4⃣0⃣ What are advantages of REST web services?

REST architecture treats every content as a resource. These resources can be text files, html pages, images, videos or dynamic business data. REST Server simply provides access to resources and REST client accesses and modifies the resources. Here each resource is identified by URIs/ global IDs.