HttpClient GetAsync, PostAsync, SendAsync in C#

HttpClient is a library in the Microsoft .NET framework 4+ that is used for GET and POST requests. Let’s go through a simple example of using HttpClient to GET and POST JSON from a web application. First, we will create our client application. We will create a new console app in Visual Studio: Add the System.Net.Http namespace. We will pull down JSON data from a REST service: Now, to read this, we … Continue reading HttpClient GetAsync, PostAsync, SendAsync in C#

Creating a WCF REST Service with Entity Framework

In this post, we will go through how to use WCF to create a REST service, also using the Entity Framework to connect to a database. We have a SQL database that holds customer information. We would like to expose this as through a REST service. In the database, we have a table called Customers that we will build our service for: Open Visual Studio and create a new WCF Service … Continue reading Creating a WCF REST Service with Entity Framework

Using Browser Network Trace with Fiddler

When analyzing and troubleshooting network traces in browsers such as Edge, Chome, Firefox, and IE, you can export these and import them into Fiddler for further analysis. For example, let’s say you are working in Edge and are analyzing a REST API. You send a request through your browser to the API, that returns a list of customers: If you click F12 to open Developer Tools, you can see the request … Continue reading Using Browser Network Trace with Fiddler

OData Connected Service in Visual Studio 2017

Here we will use the OData Connected Service to connect to an OData feed from Visual Studio 2017. First, install the extension. Select Tools->Extensions and Updates: Select Online and search for OData Connected Service: Restart Visual Studio to complete the install. Create a new Visual Studio console app: Right Click and select Add->Connected Service: Select OData Connected Service: We will connect to:  https://services.odata.org/V4/Northwind/Northwind.svc/. The service looks like: Enter the service … Continue reading OData Connected Service in Visual Studio 2017

OData Client Code Generator

The OData v4 Client Code Generator is an extension that can be used to generate OData code for use in applications. To install it, open Visual Studio 2015 and under Visual Studio Gallery, search for OData Client Code Generator: Click to Install: The extension is now installed: To use the extension, we will create a new Windows Console project: Add a new item and under Code select OData Client: Files … Continue reading OData Client Code Generator

Create a WCF Windows Service

Here we will create a WCF web service hosted as a windows service. We will go through step by step how to do this. First, create a new WCF Service Application: This will create the project: If we select the Service1.svc page and press F5 to run this, it will open the WCF Test Client. From here, we can select the GetData() method and enter a value. Invoking the method will … Continue reading Create a WCF Windows Service

ASP.NET Web API

ASP.NET Web API allows us to build HTTP services. It can be used with ASP.NET MVC, Web Forms, WCF HttpBinding. The framework is built on ASP.NET. We will go through an example of building a Web API with MVC using Entity Framework. To create a new project, open Visual Studio and create a new ASP.NET Web Application: Now select the type of project. Here we will select Web API: The … Continue reading ASP.NET Web API

Dynamics CRM Web API Sample

You can connect to Dynamics CRM from outside the application using OAuth 2.0 authentication. From there, you can use the Web API to call Dynamics CRM functionality. Here we will go through an example of how to do this. This is based on the sample code located here. Firstly, we will need to configure an application in Azure to help with the OAuth piece. Configure the app using these instructions. These samples … Continue reading Dynamics CRM Web API Sample

Register an App with Windows Azure

The following steps show how to register an application with Microsoft Azure. This app can then be used for OAuth 2.0 authentication outside of Dynamics CRM. Log into portal.azure.com as your Dynamics CRM administrator. Select Azure Active Directory from the menu on the left: Select App Registrations: Select Add: Enter the name of the app, e.g. Test Basic App. Select the application type as Native: Click Create to create the app. … Continue reading Register an App with Windows Azure

Fiddler Install

Fiddler is a web debugging proxy tool written by Eric Lawrence and owned by Telerik. To download it, go to: https://www.telerik.com/fiddler and select Free Download: Click Download: This will download: Click I Agree: Click Install: Click Close: You will see: Run Fiddler: Fiddler will load: You have the option to capture and not capture traffic: You will notice in your Internet Explorer options, a Proxy will be enabled. This will start and stop … Continue reading Fiddler Install