I created a new MVC project, and test the remote validation in the about page.
1)Controller Home:
public ActionResult ValidateTestName(string testName)
{
return Json(!testName.Equals("test"),
JsonRequestBehavior.AllowGet);
}2)Model:
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace MvcApplication1.Models
{
public class AboutModel
{
[Required]
[Remote("ValidateTestName", "Home", ErrorMessage = "this Name already be used.")]
public string TestName { get; set; }
[Required]
[Range(20, 44)]
public int Age { get; set; }
}
}
3)View:
In _Layout.cshtml:
In About.cshtml
@model MvcApplication1.Models.AboutModel
@{
ViewBag.Title = "About Us";
}
About
Put content here.
@using (Html.BeginForm())
{
@Html.EditorForModel();
"submit"
value="Submit" />
}
It is working perfect under FireFox 6:

but not working in my IE9 :(...
I have
downloaded Chrome 10.0, IE9 and FireFox 4.0