Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8665451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:29:01+00:00 2026-06-12T17:29:01+00:00

I have been having a wierd issue that is driving me absolutely crazy. It

  • 0

I have been having a wierd issue that is driving me absolutely crazy.

It started with the following error out of the blue after it had been working great:

Validation type names in unobtrusive client validation rules must be unique. The following     
validation type was seen more than once: required

This error first started on one of my controllers in Area/Admin/WebSites. But as soon as my auth cookie expired I got it on my Login page as well on the EditFor(m=>m.UserName) line. I combed through my code looking for duplicate Required attribute anywhere on any model that might be remotely named the same to no avail.

I even went into my LoginViewModel, removed the [Required] From UserName. The error moved to the EditFor(m=>m.Password). I removed the Required from Password as well, and the error moved the RememberMe line but there was no Required attribute on that member at all even. In fact I have nothing else even remotely named RememberMe in any other class anywhere.

Okay, well I gave up and started rebuilding the webSite project from scratch (not the rest of the solution) and still ended up with the same thing.

Out of desperation, I rebuild the entire solution from scratch, only copying the *.cs files in and manually reloading all the references thinking there was a duplicate reference somewhere.

Once I got to the point of building the MVC4 project once again I did it in stages to see if I could figure what was happening. It was doing fine, loading up and I could log in, etc, until I started adding Areas. At first I just copied the Areas folder directly into the project (all the namespace names are the same, so this should have been fine). But sure enough I started getting this error right way.

Okay, so I started deleting controllers in reverse order of my creating them originally. The site never returned to normal until I had deleted the Areas folder completely.

Testing this, as soon as I created an Areas folder in the project, it would break. Same thing if I used the GUI to create the new Area.

Okay, back to the drawing board. Recreated the MVC4 project from scratch, this time outside of the solution and only pulled in the 2 critical NuGet packages critical to my solution at this point: Ninject.MVC3 and Mvc3ControlsKit (the one from nuget which is for both 3 & 4). Okay everything finally starts working great. At this point, my Jquery is version 1.7.2 with the default Jquery UI that comes with MVC4.

At some point, I ran into a problem with the jquery dialog not closing so I installed JQuery 1.8.2 and the latest JQuery UI from NuGet. Everything worked fine until I went to add a completely blank Controller in my Admin Area and this error popped up again.

Okay, back to the drawing board again… I rebuilt it in stages, testing at each point. This time not installing the latest JQuery goodies. Everything starts working fine again. Added a new controller, then two. Okay, made a valid copy of this version and set it aside. Updated Jquery and Jquery UI to latest versions. Add a new controller in the area and it still continues to work to my complete frustration.

My Entities are all using Fluent API to configure my entities with no DataAnnotatian Attributes at all. Any ideas? I keep waiting for it to break again.

EDIT:

Here is some more information I just figured out. The error is occuring on this line of code in my LogIn Partial View. My model is

public class LoginViewModel 
{
    [Required]
    [Display(Name = "User Name")]
    public string UserName { get; set; }

    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Display(Name = "Remember me?")]
    public bool RememberMe { get; set; }

    /// <summary>
    /// Role
    /// </summary>
    public string Role { get; set; }

}

The error occurs when calling this line in the view:

@Html.TextBoxFor(m => m.UserName)

At this point, Ninject takes over and immediately after returning from the following method in the Ninject.Web.Mvc.Validation.NinjectDataAnnotationsModelValidatorProvider class, the aforementioned unobtrusive validation error occurs. Additionally, I have confirmed that this method has correctly identified the required validations and injected them. The exception is not occurring in this method but afterwards.

protected override IEnumerable<ModelValidator> GetValidators(ModelMetadata metadata, ControllerContext context, IEnumerable<Attribute> attributes)
    {
        var validators = base.GetValidators(metadata, context, attributes);
        foreach (var modelValidator in validators.OfType<DataAnnotationsModelValidator>())
        {
            var attribute = this.getAttributeMethodInfo.Invoke(modelValidator, new object[0]);
            this.kernel.Inject(attribute);
        }

        return validators;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:29:02+00:00Added an answer on June 12, 2026 at 5:29 pm

    The error occurs because you are trying to use a mixed validation solution in your project and two providers are trying to add unobtrusive required validation for a field and hence the duplicate issue fires up.

    Make sure that you are not using both dataannotation and fluent validation to perform a same validation over a same property (like required in your case).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having a really weird problem. I have a mutable array that is
I have been having the following problem, i think it's probably due to the
I have been having this issue in iterating through an array of keys and
I'm having a weird issue that I can't track down... For context, I have
I'm having an issue I've been fighting for a few hours, and have not
This is a really weird problem that I have been having. When I download
I have been having this weird problem with Xcode 4.3.2, of course after the
I have been having trouble pulling up a custom UIPickerView from the textfield's inputview
I have been having these really odd problems with Visual Studio 2010. At this
I have been having this annoying problem when trying to implement a picture gallery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.