Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set content body of httpresponse?

http://msdn.microsoft.com/en-us/library/system.web.httpresponse.aspx

How do I set the content in the body?

 HTTP/1.1 400 Bad Request  
 Content-Type: application/json;charset=UTF-8
 Cache-Control: no-store
 Pragma: no-cache

 {
   "message":"response content example"
 }
like image 946
001 Avatar asked Feb 24 '23 15:02

001


2 Answers

Use the Output and OutputStream properties, or the Write method.

like image 94
SLaks Avatar answered Mar 07 '23 16:03

SLaks


myHttpResponse.Write("\"{\"message\":\"response content example\"}\"");
like image 45
malinois Avatar answered Mar 07 '23 16:03

malinois