views:

11

answers:

0

I came across a strange problem with a website that I am working on when I moved it from Visual Studio 2010 (Cassini) Webserver to IIS 7 running on Windows 2008. Given the following class as the viewmodel posted back to the server:

public class NominateViewModel
    {
        public Models.Category Category { get; set; }

        public string Description { get; set; }

        public string Name { get; set; }

        public HttpPostedFileBase PictureSrc { get; set; }

        public string Website { get; set; }

        public IList<Nominee> Existing { get; set; }

        public IEnumerable<SelectListItem> ExistingNominees
        {
            get {
                    return from e in Existing select new SelectListItem() { Text = e.Name, Value = e.Id.ToString() };
            }
        }

        public int? Selected
        {
            get;
            set;
        }

        public int CategoryId { get; set; }
    }

the DefaultModelBinder attempts to validate the ExistingNominees property (more precisely tries to pull back the value of the property). As you can see there is no validation logic at all on this class (there should be, but that's not the point) and it should not be trying to validate this method.

Secondly, the HttpDelete attribute is not being respected and when I attempt to do an AJAX call with DELETE verb, it complains that it is an invalid method / verb (HTTP 405). I have validated that it is running ASP.NET 4.0, System.Web.MVC 2.0, System.ComponentModel.DataAnnotations 4.0, etc. I do not understand why the behaviour of the application is so altered simply by moving it to a different webserver.