Ken Lyon

I was writing a small web service the other day there and I couldn't get it to work properly. It was only when I set a breakpoint that I saw that one of the parameters I had supplied was being parsed incorrectly. The parameter in question was a DateTime.

Now you need to excuse me here because I don't really know the proper name for this file yet, but it's the page such as Service.asmx that you can browse to in order to test the web methods. Well, when I go to that page with my browser, I choose the Web Method I want to test and then I have the message "To test the operation using the HTTP POST protocol, click the 'Invoke' button." with a wee text box there for me to enter a date. Well, it so happens I'm in Scotland and our date format is day/month/year here. I had entered the date in this format and my code had not worked as expected. Upon closer inspection I discovered it was being parsed as month/day/year - the default US date format.

Is there a way I can change a setting somewhere to allow this test page to parse the date the way I want it to It was a sad realisation that my code was actually working fine and the source of the problem was actually the test page itself. Ideally I would love to make a global change so that every web service I produce on my machine would respect my Regional Settings. Actually, maybe there should be a patch. It seems a bit of a bug from my point of view. Does anyone know of solutions to this problem

I know I could enter the datetime in m/d/year format, but when you're right in the midst of debugging something and the pressure's on, it would be really great to be able to use the date format you're familiar with rather than needing to remember that this one thing is the opposite of all your other windows settings!

Re: ASMX Web Services and XML Serialization Web Service Test Page uses wrong Date format to parse my input

John Saunders

This sounds like a bug, and you should report it to Microsoft.

In the meantime, the page in question is located at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\DefaultWsdlHelpGenerator.aspx (adjust for framework version). It's just an ASP.NET page like any other. You might want to change it to understand dates and to use a calendar control to input them.

Re: ASMX Web Services and XML Serialization Web Service Test Page uses wrong Date format to parse my input

Ken Lyon

Hi John,

Thanks for your suggestions. I've reported the bug as you suggested. It can be seen here: FeedbackID=293261

I had read a post somewhere about the DefaultWsdlHelpGenerator.aspx file before writing about this problem, but I couldn't quite see what was going on inside it. I'd like to be able to set a breakpoint and watch it step by step.

I looked at it again, though, and it seems the method WriteSoapMessage could be the one to investigate further. I'll see of I can find something in there to change. Now that I'm thinking about it, I'm going to see how my own Web Applications interprets dates in textboxes as well.