Web Api

ASP.NET Core API Versioning in Simple Words (Update 1.2.0)

Few days ago, me and my friends developed an API using ASP.NET Core where from the GET method we returned some data to our client app. We did pagination in the front end. Means that first we sent all the data to the client and then did some data.length operation on that to get the items count for applying pagination logic. Then decided that we should do the logic in the back-end (server-side pagination) because it will decrease the payload of the HTTP request. In our case it…

Keep reading

Dependency Injection to The Core (Part - III)

We came to know about the term IoC container. There are many IoC containers available and most of them do the same things somewhat differently. Let’s use one of them in our current project. Let’s pick Autofac which has a great documentation online. Here is the link where you can know all about the Autofac integration related stuff with Web API projects, http://autofac.readthedocs.io/en/latest/integration/webapi.html Since we are just beginners wondering around the world of dependency injection. We will go slow and…

Keep reading

Dependency Injection to The Core (Part - II)

Say for example, our client changed their requirements and now wants us to read and write comma separated data (CSV) from a filesystem instead of a database. Suppose I’ve searched and downloaded a cool library that can work with CSV files. So, we have a CSV library configured and ready to talk with our CSV files in the data access layer. If you are following me then you would say, now that we have a new data access layer, we also need a new repository. Right? Exactly! Since we…

Keep reading

Building Apps with Polymer and ASP.NET CORE (Part - III)

We were done with the API creation part in the previous post. Let’s finish up the app by connecting the simple-todo component with those APIs. Basically we need to call our APIs to do that. We are going to do that with a Polymer component called iron-ajax. It makes Ajax easier to work with. So, just like what we did for every third party components lets install iron-ajax with Bower. Then add it to the header section of your HTML document. Here is the command to install iron-ajax bower…

Keep reading

Building Apps with Polymer and ASP.NET CORE (Part - II)

OK! As I told you in the previous post that I will make APIs using ASP.NET CORE Web API to be able to Add, Update, Edit and Delete todo items on the server side but the good news is ASP.NET CORE documentation already has an article on that. Here is the link, https://docs.asp.net/en/latest/tutorials/first-web-api.html Wait a minute! That doesn’t mean I’m not going to do anything in this post. If you went through that article already then you may…

Keep reading

Creating Simple APIs for your AngularJs App with .NET CORE Web API

Starting from the scratch So, we are starting with the empty Asp.net Core template. I’m using Visual studio 2015 and I’ve.NET Core RC2 SDK installed in my machine. Both of them are available for download in the following links, .NET Core SDK - https://www.microsoft.com/net/core Visual Studio 2015 - https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx Adding Dependencies We basically need two dependencies, one for serving static files (Microsoft.AspNetCore.StaticFiles) and another one for creating the APIs (Microsoft.AspNetCore.Mvc)…

Keep reading

Preventing XSRF in AngularJS Apps with ASP.NET CORE Anti-Forgery Middleware

What is Cross Site Request Forgery (XSRF/CSRF) Cross Site Request Forgery (XSRF/CSRF) is a type of a security breech where a hacker can trick the user into making unwanted requests to a web application where he/she is already authenticated. When a user is authenticated, his/her authentication cookie is stored in the browser’s storage. Since the cookie stays active unless the browser is closed and reopened, an authenticated user can be forced to make requests to the application from other unsafe applications too. For example, assume…

Keep reading

AngularJS and ASP.net Core 1.0 JumpStart (Part – III)

Creating the ASP.net Core 1.0 MVC project Okay, this part of the series will be pretty much big. So take time and read all the stuffs that I’ve done here. We will create a ASP.net Core 1.0 MVC project first. If you don’t have it installed already, please visit this link and follow the instructions to install it in your favorite operating system, https://docs.asp.net/en/latest/getting-started/index.html After installing, open up your Visual Studio 2015 and create a new…

Keep reading