Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save kersny/336923 to your computer and use it in GitHub Desktop.

Select an option

Save kersny/336923 to your computer and use it in GitHub Desktop.
public static NameValueDictionary GetPostParameters(this Stream input)
{
while (!input.CanRead)
;
long Length = input.Length;
byte[] data = new byte[Length];
for (int i = 0; i < Length; i++)
{
data[i] = (byte)input.ReadByte();
}
string[] parameters = Encoding.ASCII.GetString(data).Split('&');
NameValueDictionary ret = new NameValueDictionary();
foreach (string s in parameters)
{
string[] tmp = s.Split('=');
ret.Add(tmp[0], tmp[1]);
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment