Summary of several return methods for calling HttpHanlder

  • 2020-03-30 01:00:28
  • OfStack

1: if you only need to return string form such as content, JSON string array, etc

The context. The Response. The Write (resultPrice. ToString ());

2: if you want to return a picture, take the form of a stream

Bitmap. The Save (context. The Response. The OutputStream, System. Drawing. The Imaging. ImageFormat. Jpeg);

3: if the return file, such as TXT document is provided to the client for download

The context. The Response. The WriteFile (" text instance. TXT ");

Related articles: