March 2018
Beginner to intermediate
410 pages
10h 40m
English
You can also choose to explicitly encode your content. The image encoder, for instance, encodes images to PNG files. If you want to encode the image to another file format, you can explicitly do so, as follows:
private void ReturnMomentaryAsJpg(HttpRequest Request,
HttpResponse Response)
{
SKImage Gauge = this.GenerateGauge(Request.Header);
SKData Data = Gauge.Encode(SKEncodedImageFormat.Jpeg, 90);
byte[] Binary = Data.ToArray();
Response.ContentType = "image/jpeg";
Response.Write(Binary);
}
Here you must explicitly set the content type of the response and then write the binary encoded data to the response stream.
You can now run the application and test it by typing in the URL of your new resource.
Read now
Unlock full access