SAJ14SAJ
SAJ14SAJ

Reputation: 1708

ServiceStack: POST body content as NameValueCollection

In a ServiceStack service or filter, is there any way to get access to the NameValueCollection parsed from a URLEncoded POST content?

While I understand that it is parsed into the DTO as appropriate, sometimes it is valuable to have access to the arbitrary values in the name value collection.

I don't mind having ServiceStack parse and fill the DTO—I just also want to see the raw NameValueCollection (or equivalent data structure if ServiceStack uses its own parsing mechanism).

Upvotes: 1

Views: 1125

Answers (2)

mythz
mythz

Reputation: 143319

Inside a Service you can access the POST'ed data with:

var htmlPostVar = base.Request.FormData["postName"];

See the Access HTTP specific features in services for more info on how to access HTTP Request and Response info from inside services.

Upvotes: 3

jeffgabhart
jeffgabhart

Reputation: 1127

The Service base class gives you access to the Request and you can find the POST content in FormData which is a NameValueCollection.

Request.FormData

Upvotes: 2

Related Questions