Adding an external Microsoft login to IdentityServer4

Microsoft Authenticator Identity

This article shows how to implement a Microsoft Account as an external provider in an IdentityServer4 project using ASP.NET Core Identity with a SQLite database. Setting up the App Platform for the Microsoft Account To setup the app, login using your Microsoft account and open the My Applications link https://apps.dev.microsoft.com/?mkt=en-gb#/appList Click the Add an app button. Give the application a name and add your email. This app is called microsoft_id4_enrico. After you clicked the create button, you need to generate a new password. Save this somewhere for the application configuration.…

Microsoft has reportedly acquired GitHub

Microsoft has reportedly acquired GitHub, and could announce the deal as early as Monday. Bloomberg reports that the software giant has agreed to acquire GitHub, and that the company chose Microsoft partly because of CEO Satya Nadella. Business Insider first reported that Microsoft had been in talks with GitHub recently. GitHub is a vast code repository that has become popular with developers and companies hosting their projects, documentation, and code. Apple, Amazon, Google, and many other big tech companies use GitHub. Microsoft is the top contributor to the site, and…

How do I extract text that lies between two strings?

My initial problem was to extract from a SQL string generated by MySql, all fields. I had a string like 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 INSERT INTO `inventoryapp`.`inventory_keys` (`Id`, `PropertyId`, `AppointmentId`, `SectionType`, `KeysDescription`, `FobsWorking`, `EntryCodes`, `AlarmCodes`, `Notes`, `Version`, `CreatedDate`, `CreatedBy`, `UpdatedDate`, `UpdatedBy`, `IsDeleted`) VALUES (<{Id: }>, <{PropertyId: }>, <{AppointmentId: }>, <{SectionType: }>, <{KeysDescription: }>, <{FobsWorking: }>, <{EntryCodes: }>, <{AlarmCodes: }>, <{Notes: }>, <{Version:…

Data and data access technologies

In my previous post I spoke about key layers of distributed applications. Now we will go through the most crucial layer of any distributed application, the data layer. In this part, you will be introduced to various database technologies, along with .NET-related technologies. Data can be stored in a wide range of data sources such as relational databases, files on the local filesystems, on the distributed filesystems, in a caching system, in storage located on the cloud, and in memory. Relational databases (SQL server): This is the traditional data source…

Microsoft has released a Debian Linux switch OS

Put down your coffee gently. Microsoft has today released a homegrown open-source operating system, based on Debian GNU/Linux, that runs on network switches. The software is dubbed SONiC, aka Software for Open Networking in the Cloud. It’s a toolkit of code and kernel patches to bend switch hardware to your will, so you can dictate how it works and what it can do, rather than relying on proprietary firmware from a traditional networking vendor. It also pits Redmond against white-box network operating systems from the likes of HP, Dell, and…

Creating a URL shortener using ASP.NET WepAPI and MVC

In this tutorial, I use several techniques and tools. I use Microsoft Visual Studio 2015 and the latest version of all components. ASP.NET MVC: Microsoft’s modern web application framework. As the name says, it pushes you to use the MVC (model view controller) software design principle. ASP.NET Web API: Web API and MVC are used together in many applications. With MVC, the HTML of the web pages are rendered on the server, and with Web API you can, like the name says, create an API. Web API also uses the…

Delete all Stored Procedures at once

If this is a one- time task, just open Object Explorer, expand your database > programmability and highlight the Stored Procedures node. Then turn on Object Explorer Details. On the right you should see your list, and here you can multi-select – so you can sort by name, choose all procedures that start with aspnet_, and delete them all with one keystroke. If you are doing this repeatedly, then (assuming your procedures are all in the dbo schema): DECLARE @sql NVARCHAR(MAX) = N”; SELECT @sql += N’DROP PROCEDURE dbo.’ +…

Reading and Writing XML in C#

In this article, you will see how to read and write XML documents in Microsoft .NET using C# language.  First, I will discuss XML .NET Framework Library namespace and classes. Then, you will see how to read and write XML documents. In the end of this article, I will show you how to take advantage of ADO.NET and XML .NET model to read and write XML documents from relational databases and vice versa. Introduction to Microsoft .NET XML Namespaces and Classes Before start working with XML document in .NET Framework, It…

Web.config: encryption and decryption

Introduction In this article I will explain how to encrypt or decrypt connection Strings in web.config file using asp.net. Description In Previous posts I explained lot of articles regarding Asp.net, Gridview, SQL Server, Ajax, JavaScript etc. In many of articles I used connection Strings section in web.config file to store database connection. The connection Strings section contains sensitive information of database connections including username and password of database. Is it secured to store the sensitive information of database connections in plain text files called web.config and machine.config files? If we…

Why Visual Studio Code?

Visual Studio Code provides developers with a new choice of developer tool that combines the simplicity and streamlined experience of a code editor with the best of what developers need for their core code-edit-debug cycle. Visual Studio Code is the first code editor, and first cross-platform development tool – supporting OSX, Linux, and Windows – in the Visual Studio family. At its heart, Visual Studio Code features a powerful, fast code editor great for day-to-day use. The Preview release of Code already has many of the features developers need in…

Microsoft announces Microsoft Edge

Today at Build 2015 in San Francisco, Microsoft announced its new Web browser called Microsoft Edge. This is the browser formerly known as Project Spartan. Microsoft Edge, the new default browser will ship on all Windows 10 devices including PCs, tablets, smartphones, and Microsoft’s own tablet, Surface. Microsoft Edge is the all-new Windows 10 browser built to give you a better web experience. Write directly on webpages and share your mark-ups with others. Read online articles free of distraction or use the offline reading feature for greater convenience. Microsoft Edge…

Chart.js Asp.net : Create Pie chart with database jQuery Ajax C#

This article explains using Chart.js in Asp.net C# Web Application we can create a pie chart with database MS SQL server connectivity via jQuery ajax call.  You can also have a look on related article, . Now in this post here we create a pie chart by using chart.js library and bind data from our database MS Sqlserver, with jQuery ajax calling. Here we are creating a pie chart, which shows data from the database (Ms SQL server).  In my database, I have a table which stores data (website traffic…

PSC.Search: a new implementation of Levenshtein distance algorithm

This article describes a simple implementation of the string search. It can be used for approximate string matching (for more information, see https://en.wikipedia.org/wiki/Fuzzy_string_searching). Other algorithms for approximate string searching exist (e.g., Soundex), but those aren’t as easy to implement. The algorithm in this article is easy to implement, and can be used for tasks where approximate string searching is used in an easy way. The algorithm used the Levenshtein-distance for determining how exact a string from a word list matches the word to be found. Information about the Levenshtein-distance can…

Developing a REST Web Service using C# – A walkthrough

REST stands for Representational State Transfer. The term was introduced by Roy Fielding in his doctorial dissertation. REST is an architectural style for designing networked applications. It is an alternate to using complex mechanisms like COBRA, RPC, and SOAP to connect between client and server. REST makes communication between remote computers easy by using the simple HTTP protocol which support for CRUD (Create, Read, Update, and Delete) operations on the server. In a way, our World Wide Web is also based on the REST architecture. In a nutshell, REST is…

How to Enable XP_CMDSHELL using SP_CONFIGURE

In this tip we will take a look at the step to follow to enable or disable XP_CMDSHELL using SP_CONFIGURE system stored procedure. In order to use XP_CMDSHELL you need to be a system administrator. Read the following article which explains how to allow non-administrators to use XP_CMDSHELL. Error Message Received when XP_CMDSHELL is disabled You would end up getting the below mentioned error message when XP_CMDSHELL is disabled. Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1 SQL Server blocked access to procedure ‘sys.xp_cmdshell’ of component ‘xp_cmdshell’ because…

Create DataTable

Data is read from a database. It is generated in memory from input. DataTable is ideal for storing data from any source. With it we take objects from memory and display the results in controls such as DataGridView. The DataTable type is a powerful way to store data in memory. You may have fetched this data from a database, or dynamically generated it. We get a DataTable with four columns of type int, string and DateTime. This DataTable could be persisted or displayed, stored in memory as any other object,…

ASP.NET Menu and SiteMap Security Trimming

With ASP.NET 2005 Microsoft introduced a pretty solid menu which is integrated with a configuration driven sitemap. The cool part is that the menu can be hooked in with your security roles, so you don’t have to worry about hiding or showing menu options based on the user – the menu options are automatically kept in sync with what the user is allowed to see.   Step one – Define the Sitemap I’m using a static sitemap defined in a Web.sitemap file, and it’s especially simple since there’s no is…

Synchronization Essentials

So far, we’ve described how to start a task on a thread, configure a thread, and pass data in both directions. We’ve also described how local variables are private to a thread and how references can be shared among threads, allowing them to communicate via common fields. The next step is synchronization: coordinating the actions of threads for a predictable outcome. Synchronization is particularly important when threads access the same data; it’s surprisingly easy to run aground in this area. Synchronization constructs can be divided into four categories: Simple blocking…

Building of an organizational chart for AdventureWorks & AdventureWorks2008

— SQL recursive CTE to find subordinates of executive, manager & supervisor– Tree processing – find all descendants – find children – self-referencing tableDECLARE @EmployeeID INT SET @EmployeeID = 109 USE AdventureWorks; WITH cteEmployeeName AS (SELECT FullName = FirstName + ‘ ‘ + LastName, EmployeeID FROM HumanResources.Employee e INNER JOIN Person.Contact c ON e.ContactID = c.ContactID), cteSubordinates AS (SELECT EmployeeID, LEVEL = 0 FROM HumanResources.Employee WHERE EmployeeID = @EmployeeID UNION ALL SELECT e.EmployeeID, LEVEL + 1 FROM cteSubordinates cte INNER JOIN HumanResources.Employee e ON cte.EmployeeID = e.ManagerID) SELECT FullName, s.EmployeeID,…