Errors Streaming Excel File

Discussion in 'ASP .Net' started by =?Utf-8?B?Um9iIE5lbGRlcg==?=, Oct 1, 2007.

  1. I'm trying to stream an Excel file to IE from an ASP.NET page (VB.NET 1.1).
    I've been searching the web for a couple of days and found many different but
    similar methods, tried everything I've found and none of it works for me. I
    consistently get the following two error messages, in this order:

    "Could not open '<MY URL>'."

    "Microsoft Office Excel cannot access the file '<MY URL>'. There are several
    possible reasons: The file name or path does not exist. The file is being
    used by another program. The workbook you are trying to save has the same
    name as a currently open workbook."

    The code I am currently using is as follows ...

    Response.Clear()
    Response.ContentType = "application/vnd.ms-excel"
    Response.AppendHeader("content-length", Convert.ToString(Bytes.Length))
    Response.OutputStream.Write(Bytes, 0, Convert.ToInt32(Bytes.Length))
    Response.Flush()

    Bytes is a Byte array containing the file. Ultimately I want to be using a
    Byte array generated by Report Services, but have also tried reading an Excel
    file from the file system into a Byte array to rule out Report Services as
    the source of my grief.

    This code (with ContentType="application/pdf") works fine when streaming a
    PDF, but I just can't get it to work with Excel.

    Can anyone help please?

    Many thanks in advance,
    Rob

    P.S. Please let me know if this would be better posted elsewhere.
    =?Utf-8?B?Um9iIE5lbGRlcg==?=, Oct 1, 2007
    #1
    1. Advertising

  2. On Oct 1, 1:59 pm, Rob Nelder <>
    wrote:
    > I'm trying to stream an Excel file to IE from an ASP.NET page (VB.NET 1.1).
    > I've been searching the web for a couple of days and found many different but
    > similar methods, tried everything I've found and none of it works for me. I
    > consistently get the following two error messages, in this order:
    >
    > "Could not open '<MY URL>'."
    >
    > "Microsoft Office Excel cannot access the file '<MY URL>'. There are several
    > possible reasons: The file name or path does not exist. The file is being
    > used by another program. The workbook you are trying to save has the same
    > name as a currently open workbook."
    >
    > The code I am currently using is as follows ...
    >
    > Response.Clear()
    > Response.ContentType = "application/vnd.ms-excel"
    > Response.AppendHeader("content-length", Convert.ToString(Bytes.Length))
    > Response.OutputStream.Write(Bytes, 0, Convert.ToInt32(Bytes.Length))
    > Response.Flush()
    >
    > Bytes is a Byte array containing the file. Ultimately I want to be using a
    > Byte array generated by Report Services, but have also tried reading an Excel
    > file from the file system into a Byte array to rule out Report Services as
    > the source of my grief.
    >
    > This code (with ContentType="application/pdf") works fine when streaming a
    > PDF, but I just can't get it to work with Excel.
    >
    > Can anyone help please?
    >
    > Many thanks in advance,
    > Rob
    >
    > P.S. Please let me know if this would be better posted elsewhere.


    Do you use SSL?
    Alexey Smirnov, Oct 1, 2007
    #2
    1. Advertising

  3. "Alexey Smirnov" wrote:

    > On Oct 1, 1:59 pm, Rob Nelder <>
    > wrote:
    > > I'm trying to stream an Excel file to IE from an ASP.NET page (VB.NET 1.1).
    > > I've been searching the web for a couple of days and found many different but
    > > similar methods, tried everything I've found and none of it works for me. I
    > > consistently get the following two error messages, in this order:
    > >
    > > "Could not open '<MY URL>'."
    > >
    > > "Microsoft Office Excel cannot access the file '<MY URL>'. There are several
    > > possible reasons: The file name or path does not exist. The file is being
    > > used by another program. The workbook you are trying to save has the same
    > > name as a currently open workbook."
    > >
    > > The code I am currently using is as follows ...
    > >
    > > Response.Clear()
    > > Response.ContentType = "application/vnd.ms-excel"
    > > Response.AppendHeader("content-length", Convert.ToString(Bytes.Length))
    > > Response.OutputStream.Write(Bytes, 0, Convert.ToInt32(Bytes.Length))
    > > Response.Flush()
    > >
    > > Bytes is a Byte array containing the file. Ultimately I want to be using a
    > > Byte array generated by Report Services, but have also tried reading an Excel
    > > file from the file system into a Byte array to rule out Report Services as
    > > the source of my grief.
    > >
    > > This code (with ContentType="application/pdf") works fine when streaming a
    > > PDF, but I just can't get it to work with Excel.
    > >
    > > Can anyone help please?
    > >
    > > Many thanks in advance,
    > > Rob
    > >
    > > P.S. Please let me know if this would be better posted elsewhere.

    >
    > Do you use SSL?
    >
    >


    I hope to eventually, but I'm not using it for this page at the moment as
    I'm struggling to get the PDFs working with that too!
    =?Utf-8?B?Um9iIE5lbGRlcg==?=, Oct 1, 2007
    #3
    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. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    926
    Mark Goldin
    Jan 17, 2004
  2. =?Utf-8?B?S3Jpc2huYQ==?=

    Streaming Excel Content

    =?Utf-8?B?S3Jpc2huYQ==?=, Feb 24, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,136
    =?Utf-8?B?S3Jpc2huYQ==?=
    Feb 25, 2004
  3. Yelena Kaplun
    Replies:
    1
    Views:
    5,144
    Yelena Kaplun
    Jan 19, 2005
  4. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,483
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  5. jim
    Replies:
    3
    Views:
    175
Loading...

Share This Page