0

I'm using a WebClient to make a POST request with a query string but I can't see the raw string. This is what I have:

WebClient TheWebClient = new WebClient();

TheWebClient.QueryString.Add("Param1", "1234");
TheWebClient.QueryString.Add("Param2", "4567");
TheWebClient.QueryString.Add("Param3", "4539");

var TheResponse = TheWebClient.UploadValues("https://www.example.com/posturl", "POST", TheWebClient.QueryString);

string TheResponseString = TheWebClient.Encoding.GetString(TheResponse);

//problem is that this only shows the keys
var RawQueryString = TheWebClient.QueryString;

How can I see the actual raw query string?

1 Answer 1

2

WebClient.UploadValues doesn't save the request "raw query string" simply because you provided it with them, and it's not gonna change, thus is redundant.

Furthermore, HttpPost requests doesn't use query string for the request payload, it has a url, a message payload; which is appended after the headers, maybe query string. Thus there is nothing new the client class should let you know, so it won't save it.

Sign up to request clarification or add additional context in comments.

1 Comment

Got it, got confused with a GET request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.