'How to change default validation messages of a login form in ASP.NET MVC?

Making your own model and custom validation error messages was not too complicated for me to understand. It just requires you to know about data annotations. I copied the login page's login form to my homepage, since I want a user to login as soon as they enter the webapplication.

The thing is that the user is not supposed to read the validation messages in English, thus I want to change the validation text. How would I approach this? Could some please explain how to accomplish changing validation messages on a login form (preferably by making use of the default login method found in the accountcontroller and default login view)?



Solution 1:[1]

Since you want to change the error message to another language it would be best to create a new resource file and place all the translations there for your language. SO basically create a new resource file (they have resx extension Language.resx), place the resource keys into the file and replace the binder values to your new file DefaultModelBinder.ResourceClassKey = "Language";

Solution 2:[2]

The answer is to sumulate mouse hoover in the following way:

    await driver.wait(until.elementLocated(By.css(".px-2 > .w-fit > .d-flex > .hover-visible > .hover-visible-el > .mx-2  > .ui-svg-inline")), 30000)
    {
      const hoverLocation = await driver.findElement(By.css(".px-2 > .w-fit > .d-flex > .hover-visible > .hover-visible-el > .mx-2  > .ui-svg-inline"));
      const actions = driver.actions({ bridge: true });
      await actions.move({origin: hoverLocation}).perform();
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Proxy
Solution 2