Konrad
Konrad

Reputation: 7237

Difference between BindingSource.Path and BindingSource.Query

What's the difference between BindingSource.Path and BindingSource.Query?

From what it seems non-complex values default to BindingSource.Path but I can't really understand the difference between these two.

[HttpGet("{id}")]
public ActionResult<string> Get(int id) // id = BindingSource.Path
{
    return "value";
}

Upvotes: 0

Views: 93

Answers (1)

Camilo Terevinto
Camilo Terevinto

Reputation: 32072

From the documentation:

BindingSource.Path: A BindingSource for the request url path.

An URL path is normally in the format of [controller]/[action]/{id?}

BindingSource.Query: A BindingSource for the request query-string.

An URL with a query-string is normally in the format of [controller]/[action]?parameterName=parameterValue.

As examples:

  • BindingSource.Path: http://localhost:1234/api/test/1
  • BindingSource.Query:http://localhost:1234/api/test?id=1

Upvotes: 1

Related Questions