Sarasota Web Design and Sarasota Web Development

Blog Tags
Developing Custom Orchard Modules and Orchard Themes

  • David Hayden - Orchard Web Developer

asp.net mvc 4 tutorials

ASP.NET MVC 4 AllowAnonymous Attribute and Authorize Attribute

ASP.NET MVC 4 AllowAnonymous Attribute and Authorize Attribute

I've been writing a number of ASP.NET MVC 4 Tutorials on new features as I either come across them or use them. One of the new features in ASP.NET MVC 4 is the AllowAnonymous Attribute that helps you secure an entire ASP.NET MVC 4 Website or Controller while providing a convenient means of allowing anonymous users access to certain controller actions, like the login and register Actions. If you look at the AccountController in a default ASP.NET MVC 4 Internet Project you will see AllowAnonymous Attributes sprinkled throughout various login and register controller actions for this very reason.

read more


Author: David Hayden

Conditional Attributes in Razor View Engine and ASP.NET MVC 4

Conditional Attributes in Razor View Engine and ASP.NET MVC 4

ASP.NET MVC 4 and the Razor View Engine v2 were released in beta awhile back with some pretty nice features like ASP.NET MVC 4 Bundling and Minification, EF Data Migrations, and ASP.NET Web API. You can find all of this in my ASP.NET MVC 4 Tutorials. The new Razor View Engine v2 has a couple of nice features, too, like the new "Tilde Slash" feature that avoids the use of Url.Content and Href to convert relative paths to absolute paths. Another nice feature I want to mention in Razor are conditional attributes, which simplify the code you need to write to include attributes on various HTML tags in your Razor Views. This is a Razor View Engine enhancement and available in ASP.NET MVC 4, ASP.NET Web Pages, and any framework that uses Razor as its templating language.

read more


Author: David Hayden

ASP.NET MVC 4 - The New Tilde Slash Feature in Razor 2

ASP.NET MVC 4 - The New Tilde Slash Feature in Razor 2

Razor 2 in ASP.NET MVC 4 has a very subtle enhancement that allows you to dump the old Url.Content("~/...") or @Href("~/...") when specifying relative paths in your Razor Pages and just use "~/". This doesn't seem like much, but it really eliminates a lot of noise in your Razor Views. It also probably cuts down on errors for those in the habit of typing "~/" in their paths anyway forgetting to use Url.Content or something similar.

read more


Author: David Hayden

ASP.NET MVC 4 Web API Routes and ApiController

ASP.NET MVC 4 Web API Routes and ApiController

This is the 3rd post in a series of ASP.NET MVC 4 Tutorials. The first two posts were on ASP.NET MVC 4 Bundling and Minification and ASP.NET MVC 4 Entity Framework and Data Migrations. In this tutorial I want to briefly look at the new Web API integration in ASP.NET MVC 4. Web API introduces a new route for API calls as well as an ApiController that responds to Get, Post, Put, and Delete requests from REST Clients. Web API introduces formatters that can do content negotiation via XML, JSON, etc. as well as provides better customization of the response using HttpResponseMessage.

read more


Author: David Hayden

ASP.NET MVC 4 Bundling and Minification

ASP.NET MVC 4 Bundling and Minification

ASP.NET MVC 4 provides bundling and minification of CSS and JavaScript, which reduces the number of HTTP Requests and payload size resulting in faster and better performing ASP.NET MVC Websites. There are a number of ways you can reduce and combine the size of CSS and JavaScript using the new feature, and in this ASP.NET MVC 4 Tutorial I want to show how you can create custom bundles where you specify the name and order of CSS and JavaScript Files. In this case, I specify the CSS and JavaScript that is part of Twitter Bootstrap. Don't forget to also check out my previous ASP.NET MVC 4 Post - ASP.NET MVC 4 and Entity Framework Database Migrations.

read more


Author: David Hayden

ASP.NET MVC 4 and Entity Framework Database Migrations

ASP.NET MVC 4 and Entity Framework Database Migrations

ASP.NET MVC 4 was released in beta by the Microsoft ASP.NET MVC Developer Team and it comes with a number of really cool features: Bundling and Minification Support of CSS and JavaScript, Database Migrations using Entity Framework 4.3, Web APIs, Mobile Web with support for jQuery Mobile, Real Time Communication via SignalR, and Asynchronous Support. The Database Migrations using Entity Framework Code-First is really cool and is very much like Rails where you can change your code and then via Package Manager add migrations and update your database as your code evolves. Because the EF Migration Files and Configuration get added to your Visual Studio Solution, all the database migration changes get added to source code.

read more


Author: David Hayden