Web Method Signature throwing ArgumentException

Discussion in 'ASP .Net Web Services' started by Gordon, Jun 20, 2008.

  1. Gordon

    Gordon Guest

    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
     
    Gordon, Jun 20, 2008
    #1
    1. Advertisements

  2. Gordon

    Tanzim Saqib Guest


    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
     
    Tanzim Saqib, Jul 2, 2008
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.