rafale
rafale

Reputation: 1735

Using URIs with HTTP POST

Is it possible to use URIs that are visible in the address bar of a browser with methods that use HTTP POST? For example, I have an OperationContract defined like this:

[OperationContract, WebInvoke(Method = "POST")]
Stream GetFile(string username, int fileid);

At the moment, both parameters are sent using POST. However, what if I only wanted to send 'username' by POST and have 'fileid' visible in the URI? Would the following work?

[OperationContract, WebInvoke(Method = "POST", UriTemplate = "GetFile?fileid={fileid}")]
Stream GetFile(string username, int fileid);

i.e., I want GetFile?fileid={fileid} visible in the address bar of the browser accessing the service.

Upvotes: 0

Views: 206

Answers (1)

John Zwinck
John Zwinck

Reputation: 249642

It seems like it could work. Certainly HTTP POST requests can have query parameters.

Upvotes: 1

Related Questions