How can I user binarywrite and frames?

Discussion in 'ASP .Net' started by Vinay, Oct 31, 2003.

  1. Vinay

    Vinay Guest

    Hi All:

    I have a frameset (right and left). In the left frame I have a listbox that
    contains items. When the user clicks on any one of these items (each item
    points to either a word document or an image) - I'd like to show this (image
    or word document) in the frame on the right. Would anyone have any ideas on
    how I can do this? The code I currently have is:

    I am trying to figure out what response.redirectlocation does - without much
    luck.
    Dim filename As String = "C:\temp\p.jpg"
    Response.ContentType = "text/HTML"
    Response.AddHeader("content-disposition", "attachment; filename=" & fn)
    Dim adoStream As ADODB.Stream = Server.CreateObject("ADODB.Stream")
    adoStream.Open()
    adoStream.Type = 1
    adoStream.LoadFromFile(fn)
    Response.BinaryWrite(adoStream.Read())
    adoStream.Close() : adoStream = Nothing
    Response.End()

    TIA

    Vinay
    am
     
    Vinay, Oct 31, 2003
    #1
    1. Advertisements

  2. Vinay,

    Since you haven't mentioned what your problem(s) you are encountering, I'm
    going to guess that it's being caused by the declared content type. You
    should be using the appropriate mime type for the actual content, and a jpg
    is not of type text/HTML. Try using image/jpeg instead.

    HTH,
    Nicole


    "Vinay" <> wrote in message
    news:evvHr%23$...
    > Hi All:
    >
    > I have a frameset (right and left). In the left frame I have a listbox

    that
    > contains items. When the user clicks on any one of these items (each item
    > points to either a word document or an image) - I'd like to show this

    (image
    > or word document) in the frame on the right. Would anyone have any ideas

    on
    > how I can do this? The code I currently have is:
    >
    > I am trying to figure out what response.redirectlocation does - without

    much
    > luck.
    > Dim filename As String = "C:\temp\p.jpg"
    > Response.ContentType = "text/HTML"
    > Response.AddHeader("content-disposition", "attachment; filename=" & fn)
    > Dim adoStream As ADODB.Stream = Server.CreateObject("ADODB.Stream")
    > adoStream.Open()
    > adoStream.Type = 1
    > adoStream.LoadFromFile(fn)
    > Response.BinaryWrite(adoStream.Read())
    > adoStream.Close() : adoStream = Nothing
    > Response.End()
    >
    > TIA
    >
    > Vinay
    > am
    >
    >
    >
     
    Nicole Calinoiu, Nov 1, 2003
    #2
    1. Advertisements

  3. Vinay

    Vinay Guest

    Nicole:
    Thanks for the input. What I'm trying to do is:

    I have a frameset that has 2 pages (the one on the right and the one on the
    left).
    In the one on the left I have a button - when the user clicks this button I
    want to use the binarywrite method to show the contents in the frame on the
    right. If I were not using binarywrite I could use:
    window.open (pagename.aspx), "_right"

    How can I accomplish this using binarywrite?

    TIA

    Vinay


    "Nicole Calinoiu" <> wrote in message
    news:ey%...
    > Vinay,
    >
    > Since you haven't mentioned what your problem(s) you are encountering, I'm
    > going to guess that it's being caused by the declared content type. You
    > should be using the appropriate mime type for the actual content, and a

    jpg
    > is not of type text/HTML. Try using image/jpeg instead.
    >
    > HTH,
    > Nicole
    >
    >
    > "Vinay" <> wrote in message
    > news:evvHr%23$...
    > > Hi All:
    > >
    > > I have a frameset (right and left). In the left frame I have a listbox

    > that
    > > contains items. When the user clicks on any one of these items (each

    item
    > > points to either a word document or an image) - I'd like to show this

    > (image
    > > or word document) in the frame on the right. Would anyone have any ideas

    > on
    > > how I can do this? The code I currently have is:
    > >
    > > I am trying to figure out what response.redirectlocation does - without

    > much
    > > luck.
    > > Dim filename As String = "C:\temp\p.jpg"
    > > Response.ContentType = "text/HTML"
    > > Response.AddHeader("content-disposition", "attachment; filename=" & fn)
    > > Dim adoStream As ADODB.Stream = Server.CreateObject("ADODB.Stream")
    > > adoStream.Open()
    > > adoStream.Type = 1
    > > adoStream.LoadFromFile(fn)
    > > Response.BinaryWrite(adoStream.Read())
    > > adoStream.Close() : adoStream = Nothing
    > > Response.End()
    > >
    > > TIA
    > >
    > > Vinay
    > > am
    > >
    > >
    > >

    >
    >
     
    Vinay, Nov 7, 2003
    #3
    1. Advertisements

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. Vitaly Sedov
    Replies:
    0
    Views:
    518
    Vitaly Sedov
    Feb 14, 2006
  2. Powerslave2112

    From Frames to no frames?

    Powerslave2112, Jan 20, 2004, in forum: HTML
    Replies:
    2
    Views:
    785
    brucie
    Jan 20, 2004
  3. Philip
    Replies:
    3
    Views:
    1,207
    Karl Groves
    Jun 28, 2004
  4. Ale

    Frames or not Frames...

    Ale, Aug 3, 2005, in forum: HTML
    Replies:
    17
    Views:
    1,352
    Adrienne
    Aug 5, 2005
  5. Replies:
    1
    Views:
    1,145
    dorayme
    Feb 10, 2006
  6. Replies:
    0
    Views:
    1,346
  7. Brian Cryer
    Replies:
    10
    Views:
    4,169
    dorayme
    Feb 16, 2007
  8. JP
    Replies:
    1
    Views:
    596
    Martin Honnen
    Jul 7, 2003
Loading...