locked
data from http post method to string RRS feed

Answers

  • User1622957740 posted

    You should be able to use something like this:

    /// <summary>
    /// Returns the content of the POST buffer as string
    /// </summary>
    /// <returns></returns>
    public static string FormBufferToString()
    {
        HttpRequest Request = HttpContext.Current.Request;            
    
        if (Request.TotalBytes > 0)            
            return Encoding.Default.GetString(Request.BinaryRead(Request.TotalBytes));
    
        return string.Empty;
    }
    

    There's more info on this topic here:

    http://www.west-wind.com/weblog/posts/2011/Jan/17/Retrieve-the-full-ASPNET-Form-Buffer-as-a-String

    Hope this helps,

    +++ Rick ---

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 31, 2011 6:58 PM