Imagine a search page with various search parameters (e.g. last name, date of birth). We used a GET-based form and everything worked fine - until now.
Last week we introduced globalization into our application and ran into problems with various fields. The HTTP-GET request is still side-effect free, however, not idempotent anymore - if the user is running under a different culture the collation changes and a different set of matched persons is returned.
Q1) Is it still a good idea to use the GET method then?
This globalization-unawareness is also "documented" in the ASP.NET MVC value binders: the QueryStringValueProvider
uses CultureInfo.InvariantCulture
. This provides a well-defined API to all non-UI-clients.
Without regard to question 1 we converted those forms to POST-based forms. The ASP.NET MVC FormValueProvider
uses CultureInfo.CurrentCulture
and model binding is back at work - without that modification we retrieved model binding errors from ASP.NET MVC.
Of course we face the problem now, that a user is not able to click the back button of his browser after searching without retrieving the annoying "are you sure that you want to POST this data again" warning.
Q2) Is there a way to tell the browser that for a page it is completely okay to post it again?
If this is not possible, we need to change back to GET-based forms, however, our URL API is not idempotent anymore...something I don't like either - AND requires me to dive deep into the ASP.NET MVC model binding infrastructure to use a culture-aware value provider...