开发者

Pass null value to ASP.NET web service using HTTP POST?

How do I pass a null value to an ASP.NET web service when accessing it via 开发者_如何学JAVAHTTP POST?

[WebMethod]
public string GetResult(DateTime date, int foo)
{
  //do stuff here
}

When calling this method using HTTP POST, how do I pass a null parameter? Passing empty string just makes the server throw an exception trying to convert the string parameter to a DateTime. Making the DateTime parameter nullable (i.e. DateTime? date) seems to disallow calling it via HTTP.


Neither of these can have null values. They are both value types and can't be set to null even if you attempted to do it using code. I would recommend sending DateTime.MinValue and 0.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜