I have created a custom attribute in my asp.net MVC application using the following link:
http://www.falconwebtech.com/post/2012/04/18/MVC3-Custom-Validation-Attribu
Make sure you have added using System.Web.Mvc; to the top of your file which is the namespace in which this class is defined.
using System.Web.Mvc;