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 6665669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:44:51+00:00 2026-05-26T02:44:51+00:00

I have the simplest model with a single Date field that I want to

  • 0

I have the simplest model with a single Date field that I want to validate.
The problem is that if I enter the date as dd.mm.yyyy and submit it via GET it’s not passing the validation. If I submit it via POST everything is ok.

I’ve explicitly set the CultureInfo to proper value for my project.
I’ve noticed that in case of GET ModelState.Values.ToList()[0].Value.Culture is InvariantCulture, and in case of POST it’s my ru-RU.

Why the Culture is not set for GET requests? Is that a proper behavior of ASP.Net? Are there workarounds?

Just for reference or if someone wants to check, here’s the Model:

    public class TestModel
    {
        [Required]
        [DataType(DataType.Date)]
        public DateTime Date { get; set; }
    }

The view:

@using (Html.BeginForm("Index2", "Home", FormMethod.Get)) @* if that is changed to FormMethod.Post - everything's ok *@
{
    @Html.ValidationSummary(true)
    @Html.EditorForModel()
    <input type="submit" value="Ok" />
}

And the handler:

    public ActionResult Index2(TestModel model)
    {
        if (!ModelState.IsValid)
        {
            return View("Index", model);
        }

        return Content("Ok");
    }
  • 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-05-26T02:44:51+00:00Added an answer on May 26, 2026 at 2:44 am

    This is the proper MVC behavior.

    GET requests leverage the query string to send data to the server, while POSTs leverage the request body.

    Since URLs, including the query string, are usually “owned” by the applications developer, MVC uses the invariant culture to parse the raw string value into an object on your model. Parsing always happens within the context of a locale, so you have to understand which local will be used.

    The easiest fix for this is to enter the date in an invariant format when using GETs, or to use a POST which would then use the culture of the IIS thread, or users Accept-Language header depending on you site’s configuration.

    Finally, you could implement IModelBinder or extend DefaultModelBinder yourself and change this behavior.

    I’ll also throw in a plug for Glimpse, which will show you the cultures that get used on each property/parameter being model bound.

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

Sidebar

Related Questions

I have the simplest code that I want to separate in three files: Header
I have no idea how to describe my problem. It is the simplest way
It's common to have many pages in a website that request the same model
I have a model program that represents message flow along a chain of servers:
I have a problem with hashCode() that delegates to uninitialized objects using hibernate. My
What's the simplest way to code against a property in C# when I have
Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =
Have a matrix report now that has Position, Hours and Wages for a location
I have a database that was created with the Entity Framework's code first approach.
We are using JAXB Annotations on our model objects that we return from our

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.