I posted a decimal formvalue in InvariantCulture (16.4) and was surprised that it didnt get to the Model on my german system.
I had to use the german format (16,4). Is there a way to configure the language that is used for parsing parameters?
EDIT: After debugging into the sourcecode found the language specific parts in ValueProviderDictionary
PopulateDictionary. The doumentation there reads:
- Request form submission (should be culture-aware)
- Values from the RouteData (could be from the typed-in URL or from the route's default values)
- URI query string
1.takes CurrentCulture 2./3. take InvariantCulture
This doesnt work for me: I would not expect a different behaviour regarding use of Culture if I post a value or put it in the querystring. It might be necessary if the user fills out parsable values by hand, but its strange if you fill the values for a Listbox. I thing the ideal solution would be, if I could switch between both versions.
Anyway I needed to find a way now to set CultureInfo.CurrentCulture before PopulateDictionary gets called. Thats how I did it:
void Application_BeginRequest(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
}