首页 > 代码库 > C# 获取页面Post过来的数据

C# 获取页面Post过来的数据

/// <summary>
/// 获取post过来的数据
/// </summary>
/// <param name="page"></param>
/// <returns></returns>
private static string PostInput(System.Web.UI.Page page)
{
try
{

System.IO.Stream s = page.Request.InputStream;

int count = 0;

byte[] buffer = new byte[1024];

StringBuilder builder = new StringBuilder();

while ((count = s.Read(buffer, 0, 1024)) > 0)
{

builder.Append(Encoding.UTF8.GetString(buffer, 0, count));

}

s.Flush();

s.Close();

s.Dispose();

return builder.ToString();

}
catch (Exception ex)
{
throw ex;
}
}

C# 获取页面Post过来的数据