brianbolton.me

home

aspx page

20 Nov 2006

The following code is used by the aspx page to receive and parse the input string. This code assumes the input is meant to be interpreted as a string. The string could be xml or just text. I send plain text in previous javascript samples.

//I use this page to receive and parse any packets sent to my aspx page
public string GetInputStream(){
    long length = Request.InputStream.Length;
    byte [] b = new byte[length];
    Request.InputStream.Read(b,0,(int)length);
    string inputstream = string.Empty;
    foreach(byte by in b)
        inputstream += Convert.ToChar(by).ToString();

    return inputstream; 
}

//you call the code like this
string input = GetInputStream();