BinaryWrite Problem

Discussion in 'ASP General' started by Kevin Humphreys, Oct 20, 2003.

  1. Hi All,

    Please help me regarding the 'Response.BinaryWrite' I am making one web
    application where I need to store some of client logo's and others images.
    In this context I am able to store images into .DB file and even able to
    display into browser to. But it seems to be 'Response.BinaryWrite' does not
    support 'html/text' hearder if you user 'BinaryWrite'? I had tried many way
    to do so but its does not write binary if pages content <html><body> tag's.

    I could had done it by uploading images into disk, which is quite simple
    method and faster too<img src"images/<%=filename%>.jpg/gif"> by having
    unique file name. But I am not the person who is going to monitor it as
    user itself has a persmission through the web to have there image as they
    want to give file name etc. Also I can't have individual directory for each
    users as if tomorrow users grow then what I suppose to do?

    Thanks,
    Kevin.
     
    Kevin Humphreys, Oct 20, 2003
    #1
    1. Advertising

  2. Kevin Humphreys

    Ken Schaefer Guest

    Hi,

    If you want to display a webpage *and* an image, then you need to:

    a) Response.Write() the HTML page, so that it contains a HTML <img> tag. You
    point the src="" attribute to a special ASP page on your server, eg:

    <img src="getImage.asp?ImageID=1">

    b) getImage.asp retrieves the image data and Response.BinaryWrite() it to
    the client using the appropriate content type for the image, eg image/gif or
    image/jpg. An image is *not* text/html - that's for the HTML page.

    Remember you have to do this the way way a normal HTML page works. First the
    browser downloads the HTML page - then it looks for <img> tags, and it
    downloads the images separately. Each image request is a separate request.
    Each request needs an appropriate response from the server, with the correct
    ContentType.

    Cheers
    Ken

    "Kevin Humphreys" <> wrote in message
    news:%...
    : Hi All,
    :
    : Please help me regarding the 'Response.BinaryWrite' I am making one web
    : application where I need to store some of client logo's and others images.
    : In this context I am able to store images into .DB file and even able to
    : display into browser to. But it seems to be 'Response.BinaryWrite' does
    not
    : support 'html/text' hearder if you user 'BinaryWrite'? I had tried many
    way
    : to do so but its does not write binary if pages content <html><body>
    tag's.
    :
    : I could had done it by uploading images into disk, which is quite simple
    : method and faster too<img src"images/<%=filename%>.jpg/gif"> by having
    : unique file name. But I am not the person who is going to monitor it as
    : user itself has a persmission through the web to have there image as they
    : want to give file name etc. Also I can't have individual directory for
    each
    : users as if tomorrow users grow then what I suppose to do?
    :
    : Thanks,
    : Kevin.
    :
    :
     
    Ken Schaefer, Oct 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DAC
    Replies:
    1
    Views:
    2,295
    Steve C. Orr, MCSD
    Jul 31, 2003
  2. Nik

    c#, binarywrite method.

    Nik, Oct 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    4,266
    Dmitriy Lapshin [C# / .NET MVP]
    Oct 21, 2003
  3. Vinay
    Replies:
    2
    Views:
    1,259
    Vinay
    Nov 7, 2003
  4. Gregory Silvano

    .NET Bug with BinaryWrite or just bad code?

    Gregory Silvano, Dec 22, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    704
    Gregory Silvano
    Dec 23, 2003
  5. Magnus
    Replies:
    1
    Views:
    616
    Brock Allen
    May 24, 2005
Loading...

Share This Page