Tagged with ASP.NET MVC
Like other posts, I am going to list all the changes I found but there are likely more that I didn’t run into. Feel free to use the comment system to add more as you like!
Rename all the “1.0.0-rc2-final” references to just “1.0.0”
Before ASP.NET Core, our world was split between ASP.NET MVC and ASP.NET Web API. In ASP.NET Core that changes to a single model in ASP.NET MVC 6 for handling requests, whether they end up returning data or views.
There is a Web API Shim to bring over old controllers for use in ASP.NET Core. But for new projects (e.g. greenfield), I’d suggest writing your API controllers without the shim.
In case you haven’t looked at View Controllers, Let’s look at a simple example from my WilderBlog project:
A while back, I decided that this blog deserved a clean coat of paint and since I’m digging into ASP.NET Core, it was logical to re-write it. I wanted more than just to change the look, I wanted to make some real changes to the code and finally open source the code too!
Open sourcing the code required that I do a few things. First of all, I had to change any code that I would be embarrassed by (not a trivial task), but also make it so that much of normal secrets weren’t exposed by open sourcing it (e.g. connection strings, etc.). But as of now, I’ve done it. The source is available and the site is live! I am sure that there are issues with the site, but hopefully I’ll iron those out as they crop up.
My goal here wasn’t to build a blog engine. This isn’t a carefully designed and architected solution that is easily skinned for your site, but it should be a good start to understand how to build a site with ASP.NET Core and related technologies. You can see the code here:
I had a great time today talking about ASP.NET 5 on a Pluralsight webinar. Over 1,000 people were able to attend. Thank you all for tuning in!
The webinar showed the very basics of what ASP.NET 5 is and why it exists. I had fun answering all the questions and wish we had time to answer more.
Here is the source code for the project we created so you can play with the basics. This version using ASP.NET 5 RC1 so if you’re viewing this later on, the bits may not work quite right.
UPDATED: Missed fixes.
It’s that time again. ASP.NET 5 has a new release and this one has a go-live license! As announced today, the RC1 is available and a new RC2 is coming in the future.
If you’re like me, you have a couple of Beta 8 apps that you’d like to get up to speed with the RC1. In this post I’ll share with you the changes that I’ve found that impacted me. This isn’t exhaustive. Lucky for us, Beta8 to RC1 seems like a small jump (unlike earlier posts).
The course was recently updated to use the ASP.NET Beta 8 bits. I am looking forward to the next update of ASP.NET and expect to continue to update the course all the way through the RTM.
If you haven’t used Bower before, it is a package manager for client-side projects (i.e. jQuery, Bootstrap, Angular, etc.). Visual Studio makes this easy in the new incarnation and this clip shows you how it works. This video is from the third module of the course.
I had the opportunity to do three talks and two of them went well (if you were at my Bootstrap talk, you know what I’m talking about). In any case, I wanted to share the slide and code with the attendees so here it is:
If you’ve been following along, you know by now that I’m investing my time into learning ASP.NET 5. Now that the ASP.NET team have released a new version, let me help you move your code to the new version.
The update this time includes some simple package changes but also some major API changes. I am sure I can’t cover them all here, but hopefully I’ll help you avoid the major ones.
Let’s walk through the changes I am doing when upgrading a project:
If you read my blog, you probably already know how excited I am about ASP.NET 5. To dovetail with that, I’ve created a nine-hour course on Pluralsight that covers this brand-new technology from Redmond.
This new course is similar to my end-to-end course on ASP.NET 4/MVC5 that I released a couple of years ago. The goal of the course is to teach you all the concepts while helping you build a simple web app.
You can find the course here:
The more I work with ASP.NET 5, the more it looks and feels like the old ASP.NET stack except for the hosting. That’s a good thing in most cases, but writing the API that changes.
After dealing with WCF’s bastardized tried to add REST on top of the SOAP stack, I was elated to be introduced to ASP.NET’s Web API some years back. While it let me develop APIs while thinking about REST in more natural forms, it had the problem of being so separated from the MVC stack that many of the facilities had to be duplicated in both stacks. This cognitive dissonance caused many a developer headaches (same class name but in two different namespaces). When I realized that ASP.NET 5 would be merging the two ideas, I was elated…maybe prematurely.
I had planned on finishing these a long time ago, but working on my Pluralsight course about ASP.NET 5 distracted me. Sorry about that.
If you’ve been doing web development in .NET, you probably have at least a passing experience with ASP.NET’s MVC framework. At it’s core, it’s a common way to build and architect web applications. The new stack is built on the same metaphors from the older versions. If you’ve been using MVC before, you won’t be lost and some of the additions are welcome.
I’ll explain what I’m doing in a series of blog posts and link them all here as I write them. The plan is to write posts about:
Part 4: ASP.NET MVC 6 (This Post)
Part 6: Web Tooling with VS2015 (coming soon)
As I’ve been digging into building apps with ASP.NET 5, I’ve had to get used to some of the new metaphors. Some of these make sense (especially if you’ve used Node before), but some are brand new to me. One of these metaphors I ran into was the idea of Identity notifications.
The problem I was running into was one I thought many people would run into: using Identity (e.g. authentication/authorization) with REST APIs. Here is the scenario:
I was using Cookie Authentication (similar to old ASP.NET’s Forms Authentication) to log in users and to protect certain pages of the site to non-anonymous users. It’s simple to set up and works well.
For my upcoming course, I have a decent sized example that I’ll be teaching from. In the process of watching ASP.NET 5 go through the sprints, I have to upgrade the project at every step. I feel at some point I should be getting better at dealing with the sprints, but not yet ; )
Here is a short post that includes the different things I had to deal with in upgrading the project. It’s not just the ASP.NET 5 update, but also EF7 and a couple of small details.
First, I followed these instructions I found as an answer to an upgrade problem on SO. It got me close:
A few weeks back, I released a new course on Pluralsight. This new course talks through what I consider “Best Practices” (though there are no absolutes) for ASP.NET Entities, View Models, and Validation.
I was tremendously pleased to find it made it into the top ten courses for a few days. It seems to be resonating with some students and that makes me really happy. If you’re writing ASP.NET code, this course could make your job easier!
The course covers:
NOTE: This post has been updated for changes in Beta 7 and later.
Every web project needs some sort of data framework and ASP.NET 5 is no exception. Like it’s forbearers, ASP.NET 5 uses Entity Framework, but this version of the Entity Framework is different. It’s being re-engineered from the ground up just like the ASP.NET 5 stack.
In this, the third part of my ASP.NET 5 series, I’ll be talking about Entity Framework 7. While you can use older versions of EF or other storage mechanisms (NoSQL, Postgres, etc.), I think it’s an interesting exercise to see what the EF team is thinking in this evolving version of the framework.
In this second post in my six-part series on ASP.NET 5, we’ll take a look at how your ASP.NET 5 applications will be configured upon startup. The startup in this new version of ASP.NET 5 is very different, but hopefully is clearer and easier to debug. At least that’s my impression so far.
If you haven’t read the prior topics, it would probably be helpful to start with the earlier articles. You can see a list of the links to the articles below:
Over the past few weeks I’ve been playing with the new ASP.NET 5 (also known as ASP.NET vNext) bits using Visual Studio 2015. I’m trying to make sense of the new changes and how they will affect how I build websites. I’d like to share some of what I’ve learned about the new stack.
I’m going to do this by talking through an example website I wrote using the new bits. Do know that we’re still pretty early and Visual Studio 2015 (CTP6 as of this writing) and ASP.NET 5 Beta 3 are both in a state of flux. This is definitely about what’s coming, not what is here so far.
I’ll explain what I’m doing in a series of blog posts and link them all here as I write them. The plan is to write posts about:
I’ve been working on a new web site wholly using the ASP.NET 5 (e.g. vNext, MVC6, etc.) for the past couple of weeks. This means using Visual Studio 2015 Preview and the new project types in ASP.NET 5.
The idea around the site is to be an example of an ASP.NET 5 site using MVC6, EF7, and Visual Studio 2015. It’s not perfect and ASP.NET 5 isn’t ready yet so I expect to continue to fix and remove hacks for quite a while, but it’s been fun to dig into a whole new stack while it’s still getting the kinks worked out. Here are some of my first impressions.
You can see the code as it progresses, I’m I’m not done yet, but I’m sharing the code I’m working on via GitHub here:
As many of you know, I am heading out on World Tour this June and heading across Europe and Asia for a year. For the first stop, I’ve partnered with Sparkles to do a training in Belgium this June. If you’re in Europe and you’ve been looking for a way to easily take my web development course, this is your opportunity. We’re only holding it once in Northern Europe.
The course takes place from June 23-25th, 2014. If you’re in the area, this is a great opportunity to learn how to build websites using the ASP.NET on the back-end and open source tools like Bootstrap 3 and AngularJS on the front-end.
This course is a three-days, hands-on course that covers how to build web applications using the Microsoft’s ASP.NET stack including:
If you’re interesting learning how the new Web API 2 works, you’ll be happy to hear that my popular Pluralsight course “Implementing an API using ASP.NET Web API” now has a new module that shows you how to use the new features in Web API 2!
The Web API 2 features that I cover include:
Are you in the Louisville, KY area this Thursday? I will be! I’ll be at the Louisville .NET Meetup Group talking about Web API..including Web API 2 that was recently released. The details of the event are:
We will meet on Thursday, November 14, 2013 at Adecco's offices at 101 Bullitt Lane. Doors will open at 6:30pm and the presentations will begin sharply at 7:00 pm. Along with a great presentation, we'll have food and raffle prizes. Be sure to RSVP so we know how much food is needed.
I’ll be posting the slides (though there won’t be many) and the example code here so keep an eye out for the downloads!
Web API is a pretty sexy REST stack (though others are cool too). As I’ve been talking about it a lot lately, the biggest question by far is authentication and authorization. There are many options including OAuth, Token-based authentication, basic authentication, and even custom solutions. One option that should be included is to use your existing ASP.NET Forms-Based Authentication.
As a preview to my recently released course on ASP.NET Web API, we’ve released a clip that shows you how to piggy-back on ASP.NET Authentication to protect your Web API interfaces:
In this new course I build a new web site from scratch. I start out with a Bootstrap template (since my design skills suck) and move through creating content, building a database, exposing a REST-ful API and building a Single Page Application. I wrap it up by publishing the site to Azure Web Sites showing you how to not only get your application up an running in the cloud, but also how to monitor it and handle standard tasks like using your own domain in Azure.
You will see every line of code (with one small exception) that I write. This isn't slide-ware…it's show-n-tell. I use a range of technologies including:
I had the pleasure of joining many of the Atlanta .NET community for the annual Atlanta Code Camp. If you didn't get a chance to join us, you missed a great time. The attendees were enthusiastic and friendly. Thanks to everyone who attended!
I promised the people who attended my sessions I'd post the slides and example code so here you are:
Mobile Web Development