Friday, August 17, 2012

What's really new in ASP.NET MVC 4 (not much)


[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public sealed class AllowAnonymousAttribute : Attribute
This new attribute allows you to secure an entire controller using AuthorizeAttribute but still expose individual actions for anonymous access.

Saturday, August 11, 2012

Implementing a Delete button in ASP.NET MVC

I've been reading the HTML 4 and 5 specs lately, more specifically about forms, and learned something new. I knew a button could have a name and value, what I didn't know is that a button is considered a successful control, which means its data is sent to the server, only if the form submission is triggered by that button. This is a cool feature that allows your server logic to know which button was clicked and perform different operations based on that. A very common scenario is implementing a delete button.