Web Connection
fastwrite gives different output for .net handler than ISAPI
Gravatar is a globally recognized avatar based on your email address. fastwrite gives different output for .net handler than ISAPI
  Geert
  All
  May 25, 2021 @ 11:36am

I used ISAPI. But with 7.20 for the first time I have used the .net handler. Nearly all works fine, exept fastwrite behaves differently. With ISAPI when fastwriting a binary string that represents a jpg picture, browsers showed it as a jpg picture. But with the .net handler the output is more characters and a lot of characters differ from the binary input string. Could you give a clue? TIA

Gravatar is a globally recognized avatar based on your email address. re: fastwrite gives different output for .net handler than ISAPI
  Rick Strahl
  Geert
  May 25, 2021 @ 01:35pm

Not sure that should work, unless you have some odd encoding issues. This should work fine:

lcFile = FILETOSTR( ADDBS(Request.GetApplicationPath()) + "/images/image01.png")
Response.COntentType = "image/png"
Response.Write(lcFile)

However, the better way to serve a file is to use DownloadFile():

lcFilename = ADDBS(Request.GetPhysicalPath()) + "/images/image01.png"
Response.DownloadFile(lcFilename, "image/png", "MyGreatImage.png")

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: fastwrite gives different output for .net handler than ISAPI
  Geert
  Rick Strahl
  May 26, 2021 @ 03:36am

Rick thanks! Solved. I use the routine to write all kinds of content jpg css etc, that is often created on the fly. The problem was I didn't specify the contentType 😦. Webconnection, great software, Rick.

© 1996-2021