I have created a windows form based application and am using the simple membership AccountModel. On the registration form I am having problems with the date format when the application is uploaded to azure.
Locally I am able to enter the format "31/10/2013" but on the azure hosted application I must enter it in the format "10/31/2013". How can I override the validation so that it allows the use of DD/MM/YYYY format
My register model is as follows:
public class RegisterModel
{
[Required]
[Display(Name = "Username")]
public string UserName { get; set; }
[Required]
[Display(Name = "Forename")]
public string Forename { get; set; }
[Required]
[Display(Name = "Surname")]
public string Surname { get; set; }
[Required]
[Display(Name = "DOB")]
[DataType(DataType.Date)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd.MM.yyyy}")]
public DateTime DOB { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Secret Answer")]
public string SecretAnswer { get; set; }
}
I tried applying a dateformat to the DOB property as above but on azure it is still validating against MM/DD/YYYY