Thursday, April 10, 2014
ColdFusion 10 CFLOOP bug with decimal steps
Thursday, February 13, 2014
ASP.NET MVC5 (Novice) Protecting your site with a login wrapper
The default MVC framework includes login and registration pages. They are functional, but by default the main pages in the site are not configured as login-protected.
As with much of MVC, the login wrapper has been abstracted to a configuration component – a filter in this case.
In the solution explorer under ~/App_Start, double, double-click “FilterConfig.cs”
Add the following lines to RegisterGlobalFilters:
filters.Add(new System.Web.Mvc.AuthorizeAttribute());
filters.Add(new RequireHttpsAttribute());
I disabled RequireHttpsAttribute during development.
The entire site is now protected by the login wrapper with the exception of the account related pages. The account pages are excluded from the login wrapper because of the [AllowAnonymous] attribute.
For a much more comprehensive treatment, see “Deploy a Secure ASP.NET MVC 5 app with Membership, OAuth, and SQL Database to a Windows Azure Web Site” by Rick Anderson.
This is a beginning-to-end explanation of how to create and deploy a site. To skip to the security section, scroll to the middle of the page and look for “Protect the Application with SSL and Authorize Attribute”. He even explains how to create security levels!
ASP.NET MVC5 (Novice) Creating different layouts for different views
I’m creating a simple login-protected site. I want to have a main layout for the core site and a separate layout for the login and other account-related pages.
It took me a while to stumble on the most ‘elegant’ answer for ASP.NET MVC 5. The easiest/best solution (also restated here) is to copy _ViewStart.cshtml from the View folder root to the view folder that you want to style differently.
Create a new layout in ~/Views/Shared … (_Layout-Account.cshtml in my case)
and edit ~/Views/Account/_ViewStart.cshtml to point to the new Layout.
This will override the main _ViewStart.cshtml in the Views folder. There are many other approaches, like adding conditional logic to the main _ViewStart.cshtml page, but creating a _ViewStart.cshtml page for each view you
Shailendra Chauhan made an excellent blog post exploring many different ways of rendering layouts in ASP.NET MVC.
Thursday, December 26, 2013
MVC 5 Entity Framework and Dealing with Multi-key tables
(New Item --> Data --> ADO.NET Entity Data Model)
Friday, December 6, 2013
Learning One ASP.NET MVC 5
- Pluralsight "One ASP.NET From Scratch" by Jesse Liberty and Jeff Fritz.
- Microsoft "Getting Started with ASP.NET MVC5"
- [RELEASED!] Apress "Mobile ASP.NET MVC 5" November 2013
- [RELEASED!] Apress "Pro ASP.NET MVC 5" (Adam Freeman) January 2014
- As of January 2014, the kindle version is about $28 compared to around $50 for the print version!
- [RELEASED!] O'Reilly "Programming Microsoft ASP.NET MVC, 3rd Edition" (MVC 5) Coming
January 2014. February 2014. - [RELEASED!] Wrox "Professional ASP.NET MVC 5" Coming
March 2014.May 2014.June 2014August 2014
- RELEASED Apress: "Beginning ASP.NET MVC 4" June 2013
- RELEASED Apress "Pro ASP.NET MVC 4" December 2012
What I like most about these books is they both take a real world scenario and build it out completely, explaining details in a way that video tutorials can't. It is not easy for a novice to translate the MVC 4 examples to MVC 5, but if you build for MVC 4 in Visual Studio 2013, you can follow along with the MVC 4 books almost exactly.
2/10/2014 Removed most of my editorial blather.
4/14/2014 Wrox publish date bumped out yet again.
8/6/2014 Wrox finally released their book. I have changed language stacks to ColdFusion/Java, so this is the last time I will update this page or my ASP.NET content.
Friday, November 8, 2013
"Hello World!" Using One ASP.NET MVC 5 From the Visual Studio 2013 Empty Template
Update 2/10/2014
To avoid confusion, I changed the title of this post. This is not how to build a complete sample MVC 5 site from the ground up; it is just a tutorial on getting the empty template running. MVC5 books are out now that will explain site construction in extreme detail.


App_Start contains the RouteConfig.cs file which is where you’ll find the default controller and action definition. According to line 19, the app will look for a controller named “Home” to start.

Create the Default Controller “HomeController”
Choose “MVC 5 Controller – Empty” and click [Add]
Create the Default View “Index”

Change the name of the view item to “Index” to match the ActionResult in the Controller.
Success!
Friday, November 1, 2013
Understanding Visual Studio 2013 and TFS - Projects vs Team Projects
Visual Studio Project and a Team Project are completely different groupings. Reuse of the name is very confusing and, in fact, is what motivated me to create this blog post. An Article on TFS in MSDN Magazine dated April 2011 describes a team project as a “container for artifacts, including source code (organized into folders, branched folders and branches) and containing one or more Visual Studio solutions, Team Build configuration files, Team Load Test Agents, an optional SharePoint repository containing the pertinent documents for the project…” In other words, a team project is a source control container for one or more Visual Studio solutions. [2]

A collection groups team projects. (Multiple team projects as pictured above are not possible in the Team Foundation Service provided with Visual Studio.)







































