Introduction In my previous blog post I demonstrated how we can allow the user to save their culture preferences, and then apply the correct culture preferences once the user has signed in. We allowed the user to set the Culture and the UI Culture, but I think in a real world scenario that is not very realistic. Typically we will want to give the user more fine-grained control to set their language, date format, time format, currency etc.
In a previous blog post I demonstrated how ASP.NET 5 determines which Culture settings to use when serving a request. That is fine for many cases, but in some instances you want to allow users to save their culture settings preferences in their user profile. This is Part 1 in a 2 part series when I will demonstrate how you can do this. In this blog post I will show you how we can allow a user to pick a specific culture and then save that against their user profile.
Introduction In ASP.NET 5, the Localization middleware can be used to ensure the correct culture settings are applied when serving a request. In this blog post I will walk you through the process which the Localization middleware takes to determine the correct culture settings to use when serving a request. I am using Beta 8, and have created a simple web application using the ASP.NET 5 Yeoman generator. Configuring the Localization middleware The first thing you will need to do is to enable the Localization middleware inside your application.
Introduction Part of my journey in working with ASP.NET is figuring out how to replace the way in which I did things before with a more appropriate way of doing it in ASP.NET 5. One of these is figuring out how to test my controllers. Previously in ASP.NET MVC 5 I used the awesome FluentMVCTesting library, but currently it does not support ASP.NET 5, so I had to revert back to the old ways of doing things.
Introduction I recently had to figure out how to set the Culture in an ASP.NET 5 application to a specific setting. The documentation on this is still non-existing, so this is how I figured out doing it by looking at Damian Edwards’ i18nStarterWeb sample project on Github. This information is current as of Beta 7. It may change in the future. The ASP.NET 4.6 way In ASP.NET 4.6 and before there were two typical ways in which you would be able to set the Culture and UI Culture to a specific value for a website.
Introduction In a previous blog post I demonstrated the support for option groups in the new Select TagHelper in MVC 6. Someone asked about using enums with the Select TagHelper, so let us look at how you can use enums with the TagHelper. This blog post is based on ASP.NET 5 Beta 7. Basic binding For demonstration purposes, let us assume that we have an enum type with the list of possible relationship types:
Introduction In MVC 6 we are switching away from the use of the classical HTML Helpers in our Razor views to use TagHelpers instead. Various posts have been written about the new TagHelpers in MVC 6. If you are not familiar with them, then a good place to start would be Dave Paquette’s Complete Guide to the MVC 6 Tag Helpers or Matthew Jones’ Tag Helpers in ASP.NET 5 - An Overview.
Introduction In a typical web application that performs CRUD actions, the normal workflow for adding a new record is that a user will be presented with a list of records and will then click on an “Add” button to add a new record. This will then navigate them away to a separate web pages where they can add the details for the new record and click on a Save button to add the new record to the database.
Introduction Have a look at the following URL: http://www.amazon.com/gp/product/1617292397/ref=s9_psimh_gw_p14_d4_i1?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=desktop-1&pf_rd_r=0TFM5Q6WM6KD9NPNG9G7&pf_rd_t=36701&pf_rd_p=2079475242&pf_rd_i=desktop Do you have any idea what the URL is pointing to by just looking at it? Most likely not. Now look at this one: http://www.dpreview.com/articles/9485436827/the-big-beast-hands-on-with-the-panasonic-lumix-dmc-gx8 Any idea? Well it would seem that it is an article about a hands-on with the Panasonic Lumix DMX-GX8. In today’s blog post I would like to demonstrate how to generate “friendly” URLs in your ASP.