Posts

.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 way If 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 Code before we create the class, install the cloudinary package via nugget using System.Collections.Generic; using System.Web; using CloudinaryDotNet; using Cloudinar...

Google reCAPTCHA using HttpClient in ASP.NET

Image
Introduction reCAPTCHA   is 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";       ...

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 JwtA...