User799752452 posted
Hi All,<?xml:namespace prefix = o /><o:p></o:p>
<o:p> </o:p>
I have the following web method:<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
<WebMethod()> _<o:p></o:p>
Public
Function GetDate(ByVal dt
As DateTime) As
String
<o:p></o:p>
Return dt.Month.ToString<o:p></o:p>
End Function<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
In web.config I defined culture that format date is dd/mm/yyyy:<o:p></o:p>
<o:p> </o:p>
<globalization
requestEncoding="windows-1255"
responseEncoding="windows-1255"
responseHeaderEncoding="windows-1255"
culture="he-IL"
uiCulture="he-IL"
/><o:p></o:p>
<o:p> </o:p>
(the culture can be "en-GB" ect. ,All culture's DateFormat is dd/mm/yyyy)<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
In the client side I call to then web service and send "30/8/2009" to the dt param.<o:p></o:p>
<o:p> </o:p>
When I try it in framework 1.1 the response in correctly (status=200), but when I try it in framework 3.5 it response the following exception:<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
System.ArgumentException: Cannot convert 30/8/2009 to System.DateTime.<o:p></o:p>
Parameter name: type ---> System.FormatException: String was not recognized as a valid DateTime.<o:p></o:p>
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)<o:p></o:p>
at System.Convert.ToDateTime(String value, IFormatProvider provider)<o:p></o:p>
at System.String.System.IConvertible.ToDateTime(IFormatProvider provider)<o:p></o:p>
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)<o:p></o:p>
at System.Web.Services.Protocols.ScalarFormatter.FromString(String value, Type type) <o:p></o:p>
(if I send 8/30/2009 it response correctly). There both web.config globalization node are identical. Is it BUG in then framework, that don't consider on
the culture ??? <o:p></o:p>
Aviad<o:p></o:p>