When building web application in Microsoft platform stack, you will have many choices starting from web pages, ASP.NET web forms, ASP.NET MVC, and ASP.NET core. The problem happens when you want to upgrade from one library to the others. This article will discuss about how to upgrade from ASP.NET to the others.
Upgrade Path
From ASP.NET web forms to ASP.NET Core, you should recreate the project and recreate the codes. You should recreate the entire codes. If you want, you can create the hybrid method as mentioned in this article https://docs.microsoft.com/en-us/aspnet/visual-studio/overview/2013/one-aspnet-integrating-aspnet-web-forms-mvc-and-web-api
From ASP.NET web forms to ASP.NET MVC, you should recreate the project and recreate the codes. You should recreate the entire codes. You can read this document https://docs.microsoft.com/en-us/archive/msdn-magazine/2013/march/asp-net-migrating-asp-net-web-forms-to-the-mvc-pattern-with-the-asp-net-web-api
From ASP.NET MVC to ASP.NET Core, you can upgrade by recreate the project and modift the codes. You should modefy some codes. You read the guide to upgrade https://docs.microsoft.com/en-us/aspnet/core/migration/proper-to-2x/?view=aspnetcore-6.0
Some Tips before upgrade
if you are using asp.net web form, consider to keep the asp.net in the latest version. You dont need to migrate to MVC, except you need the performance of the ASp.nET mvc core
If you are using asp.net mvc, consider to upgrade into the asp.net core. You might need consider to upgrade
If you are using asp.net web pages, consider to do hybrid approaches.
Please make sure you have all the codes, including the dependencies, references, and nuget.
Please make sure you use nuget for dependency library. you can restore later.
After restore the nuget, please make sure your application is built successfully. Never upgrade the library before the codes running well
If you have difficulty in build the codes. Edit the csproj to remove the prebuild nuget, you can find in the bottom of the codes
Put your codes in GITHUB or DEVOPS
When you first time learn ASP.NET you should learn ASP.NET syntax (ASMX), HTML, C#, and JavaScript on Windows Platform. When you learn ASP.NET MVC you should learn HTML, C# and JavaScript on Windows Platform. When you learn ASP.NET Core you should learn HTML, C#, and JavaScript on any platform. Blazor is a ASP.NET feature that give you a power to build dynamic web app with HTML and C# on any platform. You do not need JavaScript although it can communicate flawlessly with JavaScript.
Blazor Template
You have two templates. Blazor Server App that run just like traditional server-side application. Blazor WebAssembly App that work just like client-side application that can work just like JavaScript, Progressive Web App, and ASP.NET hosted. You can see the difference here.
//
What should I Use?
Use Blazor Web App if you want to create web application that run on the client side. Building web app for your customer, blogs, or might be an information system without real time communication. Use Blazor WebAssembly App if you want the web application that can run in the server and doing real time communication such as IM platform, High performance web app, and complex information system such as E-learning, E-commerce, etc.
Blazor Server App.
Blazor faster enough if you compare it with ASP.NET MVC and ASP.NET Webforms.
It quite simple in term of structure.
The shared folder consists of main layout (master page) and navigation. The pages consist of the page of each function of sample. It uses the razor syntax on asp.net pages.
Communicating with the services or data quite simple. They just need a entity class just like ASP.NET core and service call model.
And you just need to call like
Is it worthen?
If you come from asp.net MVC. Blazor will give you so much simplicity and better performance.
If you come from asp.net Web Forms. Blazor will give you short learning curve and best performance.
//
Problem
You want to develop web application that use data from Microsoft Graph especially data from Office 365. You already follow the tutorial from Microsoft Docs, but you need to find a better and quick integration with Visual Studio 2019 by minimizing the codes development
medianet_width = "600";
medianet_height = "250";
medianet_crid = "858385152";
medianet_versionId = "3111299";
Before we start
We need to make sure you have this before we get started
Office 365 subscription. If you need the sandbox environment my recommendation is to register to Microsoft 365 Developer Program
Visual Studio 2019 Community or Better
Azure Active Directory that already activated by default when you have Office 365 Subscription
This tutorial assumes that you use your own Azure AD.
Let's Get Started
Step 1 – Login with your Account in Visual Studio
Open your Visual Studio
Select Continue without Code
Click File – Account Settings
Click Add an Account
Add you Office 365 Account that has an access to the Azure AD
Step 2 – Creating a Visual Studio Project
File, New, Project (Ctrl + Shift + N)
Choose ASP.NET Web Application
Create your project, I recommend you follow this naming
Please follow the animation below
Step 3 – Add Additional API Permission in Azure AD
Visit the azure AD portal by login with Your Azure AD owner account. In this case, I use my Office 365 developer program account
Configure the API permission by selecting Azure Active Directory, Your Application, and API Permission. Please follow this animation
On this example, we want to read the Calendar and Basic Profile of Office 365 Account
Step 4 – Adding Microsoft Graph Codes Functionality
Please add Graph client library for ASP.net MVC, by Right Click of Package and select Nuget Package Manager, click browse and search for Microsoft Graph
We are ready to go here are the brief what we will do in this step: (1) changing the codes from Azure AD endpoint (graph.windows.net) to Microsoft 365 endpoint (graph.microsoft.com); (2) creating codes helpers to consume the Graph API
We will discuss the codes in the video tutorial (please see below)
Step 5 – Creating Controller, View, and Model for Calendar function
This is routine step to create controller, view, and model. This step is described in video tutorial (please see below)
You can download the codes in the OneDrive
medianet_width = "600";
medianet_height = "250";
medianet_crid = "858385152";
medianet_versionId = "3111299";