ashx如何获取application/json格式的东西
private void ProcessInfo(HttpContext context)
{
string method = string.Empty;
byte[] aa = new byte[context.Request.ContentLength];
string ss = "";
try
{
int r = context.Request.InputStream.Read(aa, 0, context.Request.ContentLength);
}
catch (Exception ex)
{
ss = ex.Message;
}
ss = Encoding.UTF8.GetString(aa);
context.Response.Write(ss??"bbbb");
{
string method = string.Empty;
byte[] aa = new byte[context.Request.ContentLength];
string ss = "";
try
{
int r = context.Request.InputStream.Read(aa, 0, context.Request.ContentLength);
}
catch (Exception ex)
{
ss = ex.Message;
}
ss = Encoding.UTF8.GetString(aa);
context.Response.Write(ss??"bbbb");
return;
}
如果request的contentType为application/x-www-form-urlencoded 那自然好办.