1
votes

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).

2

2 Answers

3
votes

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.

2
votes

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