Category Archives: Visual Studio

Protocols in ASP .NET Core: HTTPS and HTTP/2

By Shahed C on October 28, 2018

This is the fourth of a new series of posts on ASP .NET Core. This week, we’ll be looking at the use of HTTPS in ASP .NET Core projects (using HTTP/1.1 today) and also HTTP/2 support for future ASP .NET Core projects.

ASPNETCoreLogo-300x267

HTTPS and SSL

If you’re reading this blog post, you’re probably familiar with HTTPS and the little lock symbol that appears on websites that have a valid SSL certificate. It’s actually TLS these days, and you can read more about SSL, TLS and HTTPS here:

Recently, the popular Google Chrome browser received an update that automatically displays a “Not Secure” message for any website that doesn’t use SSL. To address this, I updated this blog site to ensure that all embedded content use HTTPS when the site is loaded with HTTPS. I took it one step further and always enabled SSL so that site visitors going to WakeUpAndCode.com (with just HTTP) will be redirected to https://WakeUpAndCode.com.

This site is a WordPress site, so I was able to make the last change by installing a free plugin called Really Simple SSL.

If you’re not convinced you need SSL, just read this thread on Twitter:

EDIT: If you need another nudge in the right direction, here’s a gentle reminder from Troy Hunt, a well-known influential computer security expert in the Microsoft world. Troy highlights an anti-HTTPS debate that illustrates why it doesn’t make sense to be against it.

HTTPS in ASP .NET Core

For years, it has been too easy for ASP .NET developers to build Web Apps and Web APIs without any HTTPS during development. It wasn’t uncommon for web application developers to make excuses about not running their web apps with SSL on their local development environments, even if the application needed to be deployed to production with SSL (which production app doesn’t?).

Continue reading

Pages in ASP .NET Core: Razor, Blazor and MVC Views

By Shahed C on October 21, 2018

This is the third of a new series of posts on ASP .NET Core. This week, we’ll be looking at various types of Pages you may encounter in an ASP .NET Core web app:

  1. Razor Pages (new as of v2.0)
  2. the experimental Blazor (C# in the browser!)
  3. the more familiar MVC Views (aka Razor Views)

If you already know how to create each type of project, feel free to jump past section 3B below.

ASPNETCoreLogo-300x267

Before you begin

Before you begin, make sure you download an IDE or code editor to open and run the code samples. My recommendations are below:

A. Visual Studio Code: https://code.visualstudio.com

B. Visual Studio 2017 (v15.8 or later): https://visualstudio.microsoft.com/vs/

vs-logos

To get the latest SDK, download .NET Core v2.1 or higher:

Web .NET Core Download: https://www.microsoft.com/net/download

To use Blazor in Visual Studio 2017, you must install the ASP .NET Core Blazor Language Services extension from the Visual Studio Marketplace:

Web Blazor extension: https://marketplace.visualstudio.com/items?itemName=aspnet.blazor

The instructions below will cover both Command Line Interface (CLI) commands and IDE/editor steps to create, build and run the code samples.

Web Sample code: https://github.com/shahedc/PagesDemo

Continue reading

Azure Blob Storage from ASP .NET Core File Upload

By Shahed C on October 13, 2018

This is the second of a new series of posts on ASP .NET Core. In the past week, I had the opportunity to participate in a hackfest with several colleagues from across the globe, to work on real-life customer projects. I took a break from my primary project to help a colleague with a simple problem: upload a file from a web browser and save it into Azure Blob Storage within an ASP .NET Core web application!

ASPNETCoreLogo-300x267

Before you begin

Before you begin, make sure you sign in to Azure, create a storage account and make a note of the storage connection information.

Refer to:

“Show me the code!”

Fortunately, I packaged everything nicely as a simple web app project, uploaded into Github and added instructions on how you can use it right away.

Web Get it here: https://github.com/shahedc/SimpleUpload

I tested it in Visual Studio 2017 v15.8.6 and Visual Studio Code, so either should work for you.

simple-upload-ui

Continue reading

Hello ASP .NET Core!

By Shahed C on October 6, 2018

It’s been a while since I wrote a new blog post besides event announcements and posting slides so here’s the first of a new series of posts. The topic: ASP .NET Core!

ASPNETCoreLogo-300x267

Why ASP .NET Core?

With all the things I’ve been working with lately, I’ve still kept up to date on what’s new with ASP .NET Core for building Web Apps, Web APIs and even full-stack C# web applications with Blazor!

With the release of ASP .NET Core 2.1, and the upcoming releases of 2.2 (late 2018) and 3.0 (2019), now is a great time to be an ASP .NET Core developer. But where should you begin? You have many options.

Dev Tools for ASP .NET Core

  1. Visual Studio for Windows: a full-fledged IDE that runs on Windows (or even on Windows on your Mac via Parallels/Bootcamp. Get the latest version to try out new stable ASP .NET features and get the Preview versions to try cool new features. Install just the pieces you need. Start with the free Community edition for students, individuals and open-source projects.
  2. Visual Studio for Mac: build ASP .NET Core applications on a Mac in a full-fledged IDE. VS for Mac can also be used for macOS apps, Xamarin mobile apps for iOS/Android, cloud apps and more!
  3. Visual Studio Code: super light-weight code editor available on Windows, MacOS and Linux. Use the dotnet CLI tools in the integrated Terminal to quickly build ASP .NET Core web apps and more!

vs-logos

Continue reading

ASP.NET Core 2.1 at CMAP August 2018

By Shahed C on August 8, 2018

I presented ASP.NET Core 2.1 at CMAP 2018.1 on Tue August 7, 2018. Here is the presentation material with the slides, links and my contact information. I’ve also included some links to more information to help answer some questions from the audience.

asp-net-logo

Download PPTX or view slideshow below

SlideShare: https://www.slideshare.net/shahedC3000/aspnet-core-21-the-future-of-web-apps-109106486

The new and improved ASP .NET Core 2.1 introduces some great new capabilities, the ability to host on multiple server platforms, and a number of new tools that you will want to get familiar with. Learn about the future of ASP.NET Core MVC, Web API, Razor Web Pages, SignalR, .NET Core Tools and Visual Studio 2017!!

Here are some links that mention information that may be useful to attendees who asked questions about the following:

Daniel Roth’s summary of what’s new in ASP .NET Core 2.1

OWIN in ASP .NET Core

Oracle with EF Core in ASP .NET Core

  • Excerpt: “The Oracle .NET team has announced they are planning to release a first-party provider for EF Core 2.0 approximately in the third quarter of 2018. See their statement of direction for .NET Core and Entity Framework Core for more information. Please direct any questions about this provider, including the release timeline, to the Oracle Community Site.”
  • From Article: Database Providers – EF Core | Microsoft Docs
  • Link: https://docs.microsoft.com/en-us/ef/core/providers/#future-providers

Using IdentityServer (via a Nuget package) in ASP .NET Core web app with Angular:

Video course on ASP .NET Core app with Angular using Identity, via Lynda

p.s. when creating a new Angular web project from VS2017, it appears that the Authentication option is not available, so we’re not able to add Identity support during file creation in an Angular app, the way we do it with ASP .NET MVC/Razor web apps. 

I also ran the following command in the command line, to attempt to create an Angular web app with the –auth flag for Individual authentication, but this is not a valid option.

>dotnet new angular --auth Individual -o AngWebWithAuth

Compare with a regular ASP .NET MVC web app with the — auth flag, which works with no issues.

>dotnet new mvc --auth Individual -o MvcWebWithAuth

The “New Project” dialog in VS2017 has a link to the following page for more info on Identity options for OSS web projects:

ang-auth-options

The list mentions the following options: