Dynamically Changing Response.ContentType

Results 1 to 3 of 3

Thread: Dynamically Changing Response.ContentType

  1. #1
    Join Date
    Dec 1969

    Default Dynamically Changing Response.ContentType

    Dear All<BR><BR>I&#039;m having problems dynamically changing the value or Response.ContentType<BR>when I am accessing files from a SQL Server Database... please have a look at the code....<BR><BR>set conn = server.createobject("adodb.connection")<BR>conn.Co nnectionTimeout = Session("ConnectionTimeout")<BR>conn.CommandTimeou t = Session("CommandTimeout")<BR>conn.Open Session("ConnectionString")<BR>set rs = server.createobject("adodb.recordset")<BR>rs.Open "SELECT * FROM rDocs WHERE DocID = "&Request.QueryString("id"), conn<BR>response.addHeader "content-disposition","inline;filename=" & rs("FileName")<BR>Response.ContentType = rs("ContentType") --- does not work<BR>Response.ContentType = "image/jpeg" --- works !!!! <BR>Response.BinaryWrite rs("DOC")<BR>Response.End<BR><BR>I have also tried this<BR><BR>if rs("ContentType") = "image/jpeg" then <BR> var1 = "image/jpeg"<BR>end if<BR>Response.ContentType = var1<BR><BR>and <BR><BR>if Right(rs("FileName"),4) = ".jpg" then <BR> var1 = "image/jpeg"<BR>end if<BR>Response.ContentType = var1<BR><BR>with no luck<BR><BR>Cheers<BR><BR>Kev

  2. #2
    Join Date
    Dec 1969

    Default RE: Dynamically Changing Response.ContentType

    try :<BR><BR>Response.ContentType = rs.fields("ContentType").value<BR><BR><BR>hardly advanced.

  3. #3
    Join Date
    Dec 1969

    Default Debug

    What&#039;s contained in that contenttype field? What&#039;s it&#039;s type when it comes out? What happens if you append a string?<BR><BR>Do you get an error? Is the header just not written correctly?<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts