Created
March 18, 2010 21:35
-
-
Save kersny/336923 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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