Can I call a ASP .NET 2.0 WebMethod through POST request without specifying all parameters?

171 views Asked by At

I have methods that can accept multiple parameters and combinations of them. Without declaring a method for every possible combination of parameters, can I declare just one method with all the parameters and then check which ones have been provided?

1

There are 1 answers

5
Camilo Terevinto On

You can if you specify the parameters as optional, as in

public static string DoSomething(string base = "DEFAULTVALUE")
{
    if (base == "DEFAULTVALUE")
    {
        // Then base was not specified.
    }
}