Posts

Showing posts from 2017

Coingate in .Net

Image
Accepting payment in Bitcoin C#

Accepting payment on your e-commerce site, online stores and your custom website have never been easy, but with the Bitcoin Payment Gateway, it is a relief. There is a lot of BTC payment gateway on the internet which provides means for merchants to receive payment, Buy and Sell BTC, receive BTC in their local currency and also create digital wallets.



The few providers out there are:
http://www.BitPay.com
http://coinbase.com
http://coingate.com
http://Gourl.io
And lots more…

BTC payment using Coingate
Coingate allows you to buy and sell Bitcoin, accept Bitcoin using the merchant API. For Java/PHP developers, visit the developer section https://developer.coingate.com/ for implementation guide or you can download one of the examples listed.  In this tutorial, I am going to show you how to use C# to accept payment in BTC with Coingate. Before you can become a merchant you have to sign up and verify your account. For testing, you can sign up here https://sandbox.coin…

Sending Notification Message with Firebase with JavaScript and .Net client

Image
Sending Notification Message with Firebase with JavaScript and ASP.Net client
Introduction to Firebase
Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably deliver messages at no cost.
FCM server has two components for sending and receiving messages which are: The trusted environment (app server)FCM serversIt is the job of the app server to send the message to the FCM server which then sends the message to the client device.
The trusted environment can be an app server for sending messages; you can also use the Admin SDK or HTTP and XMPP APIs. The work of the server is to forward the message to the FCM server which then sends to the client.
Find out more about how it works here: https://firebase.google.com/docs/cloud-messaging/ In this tutorial, I will show you how to use firebase using JavaScript client to send token and notification messages to the FCM Legacy server.
Setting up Firebase Cloud Messaging Client App with JavaScript
The FCM JavaScript API…

c# - Self referencing loop detected (Solved 2-Ways)

Getting around C# self-referencing loop exception Sometimes we come across this kind of error when building web apps. This kind of error occurs when we have multiple navigational properties in the model and EF cannot parse the relational objects. The best way to overcome this is to use the Newtonsoft library to parse it to a string, use a DTO object or anonymous types to pass the data required or set this in the Global.asax file to ignore reference loop handling GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Re‌​ferenceLoopHandling = ReferenceLoopHandling.Ignore;
The Model class If you have a product model class that has a navigational property Category, it would be hard for EF to parse the results of both properties to the view. Take a product class for example: public class Product{
   public int Id { get; set; }
   public string Name{ get; set; }
   public decimal Price{ get; set; }
   public virtual Category Category { get; set; }
} The product class ha…

Visual Studio 2017 Live Share

Image
Visual Studio Introduces Live Sharing
Collaboration is key when it comes to working on a project with teams. Visual studio has improved drastically over the years. Visual studio 2017 allows developers to collaborate on projects at real-time.

This is not like GIT of TFS, it is something that would eventually be an improvement and would make work easier and faster for developers. Imagine when working on a project and you share a portion of your code to a fellow developer to monitor, track your progress and even correct your mistakes at real-time. Cool right? Yeah!!! Hail Visual Studio.


Check out this video to know more about Visual Studio Live Sharing




More Features Visual Studio 2017 also has more new great features that enhances the productivity of developers around the globe. The features are:
You can now navigate, write, and fix your code fastQuickly find and fix bugsUse version control to collaborate efficiently And lots more...
Visit visual studio website to find out more features 

.Net Image Upload in Cloudinary

Image
Cloudinary In C#Cloudinary is the market leader in providing a comprehensive cloud-based image management solution. Cloudinary is being used by tens of thousands of web and mobile application developers all around the world, from small startups to large enterprises. We are here to cover your every image-related need.


Cloud storage is the wayIf you still write code to save files or images in a folder in your production/development server or even in the database, you are in trouble. I just hope you are aware of the consequences of doing that.

I built a class that allows you to upload, remove and download images from cloudinary which can be used in your web projects too. But, before you dive into coding, you have to register on cloudinary website and get an API key for development.
The Codebefore we create the class, install the cloudinary package via nugget




using System.Collections.Generic; using System.Web; using CloudinaryDotNet;
using CloudinaryDotNet.Actions;
public class CloudinaryServ…

Google reCAPTCHA using HttpClient in ASP.NET

Image
Introduction
reCAPTCHAis a free service that protects your site from spam and abuse. It uses advanced risk analysis techniques to tell humans and bots apart. With the new API, a significant number of your valid human users will pass the reCAPTCHA challenge without having to solve a CAPTCHA.


Building The Code

Before you start, visit this link https://www.google.com/recaptcha/intro/index.html and click on the Get reCAPTCHA button and follow the steps.


























Let's Get started 

Step 1: Create a class or a method in your controller and add the code below.


        public async Task<string> GetRecaptcha()         {             var response = HttpContext.Current.Request["g-recaptcha-response"];             const string secretKey = "your secret key";             var apiConsumer = new ApiConsumer();             const string url = "https://www.google.com/recaptcha/";             apiConsumer.BaseUri = new Uri(url);             apiConsumer.ContentType = ApiConsumer.A…

Solved: Jwt Authentication in Asp.Net Web Api And Mvc

Jwt in Asp.Net Web API And MVC
Introduction
Token based security is trending everywhere in today’s security architecture. There are different token providers out there, but the one people are more familiar with is the JWT token.

The token identifies a user. For example, your ID card could be used as a token. It identifies who you claim to be. The Id card would contain information like: ·Firstname·Lastname·Age·Title
The JSON Web Token
The JSON Web Token contains some header information, a signature, and the token’s claims. In plain
text, the claims might look like this:
{
"Name":"John doe",
"UserId":5,
"Email":"johndoe@gmail.com",
"Role":"Boss"
}
The token header is used to specify some other things like signature algorithm, expiration date, the name of the issuer, and a few other attributes.

Using Jwt In Asp.Net Web API

The JwtAuthHandler class is a custom class that inherits the DelegatingHandler class which handles the processin…