text file

Discussion in 'ASP General' started by Gary, Oct 13, 2005.

  1. Gary

    Gary Guest

    Hello,
    I am using asp classical and connection to SQL 2000 on a Windows 2000
    machine.
    I am using this code to generate a text file when the user clicks on the
    link. This is so the user can download the file on an as needed basis.
    DIM filename
    filename = "Companies.txt"
    Response.ContentType = "Unknown"
    Response.AddHeader "content-disposition", "attachment;filename=""" &
    filename & """"

    The issue I am having is if the text file is less than approx. 1 mb then the
    file downloads fine. If the file is bigger than that I get this error:
    "Internet Explorer cannot download <the name of the asp page> from <the name
    of the website> Internet Explorer was not able to open this internet site.
    The requested site is either unavailable or cannot be found. Please try
    again later."

    I get my data here:
    DIM rs, strSQL
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.CursorLocation = adUseClient
    strSql = "stored procedure" & param1 & "," & param2
    rs.Open strSql ,objConn ,adOpenForwardOnly ,adLockReadOnly ,adCmdtext

    I then write it to a text file like this:

    <%
    Response.Write "CompanyName" & "|"
    if not rs.BOF and not rs.EOF then
    rs.MoveFirst
    Do until rs.EOF
    Response.Write rs.fields("Company_Name")& "|"
    rs.MoveNext
    Loop
    end if
    rs.Close
    Set rs= nothing
    %>

    There are many more fields that are being returned but to keep it short I
    only included one so you could see the layout of my code.

    If someone could help me I would appreciate it.
    If you need more information please let me know.

    Thanks Gary
     
    Gary, Oct 13, 2005
    #1
    1. Advertising

  2. If you comment out the part that prompts this to be a file download and just
    let everything response.write out normally, what do you get?

    Ray at home

    "Gary" <> wrote in message
    news:...
    > Hello,
    > I am using asp classical and connection to SQL 2000 on a Windows 2000
    > machine.
    > I am using this code to generate a text file when the user clicks on the
    > link. This is so the user can download the file on an as needed basis.
    > DIM filename
    > filename = "Companies.txt"
    > Response.ContentType = "Unknown"
    > Response.AddHeader "content-disposition", "attachment;filename=""" &
    > filename & """"
    >
    > The issue I am having is if the text file is less than approx. 1 mb then
    > the file downloads fine. If the file is bigger than that I get this error:
    > "Internet Explorer cannot download <the name of the asp page> from <the
    > name of the website> Internet Explorer was not able to open this internet
    > site. The requested site is either unavailable or cannot be found. Please
    > try again later."
    >
    > I get my data here:
    > DIM rs, strSQL
    > Set rs = Server.CreateObject("ADODB.Recordset")
    > rs.CursorLocation = adUseClient
    > strSql = "stored procedure" & param1 & "," & param2
    > rs.Open strSql ,objConn ,adOpenForwardOnly ,adLockReadOnly ,adCmdtext
    >
    > I then write it to a text file like this:
    >
    > <%
    > Response.Write "CompanyName" & "|"
    > if not rs.BOF and not rs.EOF then
    > rs.MoveFirst
    > Do until rs.EOF
    > Response.Write rs.fields("Company_Name")& "|"
    > rs.MoveNext
    > Loop
    > end if
    > rs.Close
    > Set rs= nothing
    > %>
    >
    > There are many more fields that are being returned but to keep it short I
    > only included one so you could see the layout of my code.
    >
    > If someone could help me I would appreciate it.
    > If you need more information please let me know.
    >
    > Thanks Gary
    >
    >
     
    Ray Costanzo [MVP], Oct 14, 2005
    #2
    1. Advertising

  3. Gary

    Gary Guest

    Ray, thanks for the reply.
    I commented out the item you sugested and I get the following error.
    "Response Buffer Limit Exceeded"

    "Execution of the ASP page caused the Response Buffer to exceed its
    configured limit."

    is there any way to get around this limit?

    How do I configure the Response Buffer Limit?



    Thanks



    Gary

    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:...
    > If you comment out the part that prompts this to be a file download and
    > just let everything response.write out normally, what do you get?
    >
    > Ray at home
    >
    > "Gary" <> wrote in message
    > news:...
    >> Hello,
    >> I am using asp classical and connection to SQL 2000 on a Windows 2000
    >> machine.
    >> I am using this code to generate a text file when the user clicks on the
    >> link. This is so the user can download the file on an as needed basis.
    >> DIM filename
    >> filename = "Companies.txt"
    >> Response.ContentType = "Unknown"
    >> Response.AddHeader "content-disposition", "attachment;filename=""" &
    >> filename & """"
    >>
    >> The issue I am having is if the text file is less than approx. 1 mb then
    >> the file downloads fine. If the file is bigger than that I get this
    >> error:
    >> "Internet Explorer cannot download <the name of the asp page> from <the
    >> name of the website> Internet Explorer was not able to open this
    >> internet site. The requested site is either unavailable or cannot be
    >> found. Please try again later."
    >>
    >> I get my data here:
    >> DIM rs, strSQL
    >> Set rs = Server.CreateObject("ADODB.Recordset")
    >> rs.CursorLocation = adUseClient
    >> strSql = "stored procedure" & param1 & "," & param2
    >> rs.Open strSql ,objConn ,adOpenForwardOnly ,adLockReadOnly ,adCmdtext
    >>
    >> I then write it to a text file like this:
    >>
    >> <%
    >> Response.Write "CompanyName" & "|"
    >> if not rs.BOF and not rs.EOF then
    >> rs.MoveFirst
    >> Do until rs.EOF
    >> Response.Write rs.fields("Company_Name")& "|"
    >> rs.MoveNext
    >> Loop
    >> end if
    >> rs.Close
    >> Set rs= nothing
    >> %>
    >>
    >> There are many more fields that are being returned but to keep it short I
    >> only included one so you could see the layout of my code.
    >>
    >> If someone could help me I would appreciate it.
    >> If you need more information please let me know.
    >>
    >> Thanks Gary
    >>
    >>

    >
    >
     
    Gary, Oct 14, 2005
    #3
  4. Gary wrote:
    > Ray, thanks for the reply.
    > I commented out the item you sugested and I get the following error.
    > "Response Buffer Limit Exceeded"
    >
    > "Execution of the ASP page caused the Response Buffer to exceed its
    > configured limit."
    >
    > is there any way to get around this limit?
    >
    > How do I configure the Response Buffer Limit?
    >
    >
    >

    Turn off buffering for the page?

    Response.buffer = false

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Oct 14, 2005
    #4
  5. Gary

    Roland Hall Guest

    "Bob Barrows [MVP]" wrote in message
    news:eaX$...
    : Gary wrote:
    : > Ray, thanks for the reply.
    : > I commented out the item you sugested and I get the following error.
    : > "Response Buffer Limit Exceeded"
    : >
    : > "Execution of the ASP page caused the Response Buffer to exceed its
    : > configured limit."
    : >
    : > is there any way to get around this limit?
    : >
    : > How do I configure the Response Buffer Limit?
    : >
    : >
    : >
    : Turn off buffering for the page?
    :
    : Response.buffer = false

    Interesting. My download routine has buffering on and I just tested
    downloading a 2Mb file and it worked fine. Also, I missed the part where
    the OP wrote the text to the file. I only see it written to the screen.
    Could that be the issue for the buffer depletion?
    My download routine is a little more complex that what it shown here as this
    appears to not be complete but I don't think the download itself is the
    issue.

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Oct 17, 2005
    #5
    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. Jeremy Chapman

    Load contents of a text file into a text box

    Jeremy Chapman, Aug 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    764
    Tommy
    Aug 15, 2003
  2. Krish
    Replies:
    1
    Views:
    1,082
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Oct 20, 2005
  3. sm
    Replies:
    2
    Views:
    541
    Rolf Magnus
    Apr 29, 2005
  4. walterbyrd
    Replies:
    7
    Views:
    314
    Asun Friere
    May 17, 2007
  5. leo
    Replies:
    1
    Views:
    289
    Bob Lehmann
    Dec 5, 2005
Loading...

Share This Page