Web Method Signature throwing ArgumentException

G

Gordon

Hi,

If I create Web Method with input parameter datatypes other than strings
then the Web Method pukes with a "System.ArgumentException Can't convert to
DateTime" when the field is left blank.
e.g public string myWebMethod(DateTime StartDate)

Is there a way to trap and handle this exception. Does this confine
developers to only writing Methods with input parameters as Strings.

Someones experience appreciated
 
T

Tanzim Saqib

Hi,

If I create Web Method with input parameter datatypes other than strings
then the Web Method pukes with a "System.ArgumentException Can't convert to
DateTime" when the field is left blank.
e.g public string myWebMethod(DateTime StartDate)

Is there a way to trap and handle this exception. Does this confine
developers to only writing Methods with input parameters as Strings.

Someones experience appreciated


Hi Gordon

You cannot pass null/empty. You can pass DateTime.MinValue to
determine the intention of leaving this field empty.

Tanzim Saqib
http://www.TanzimSaqib.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top