469,282 Members | 1,743 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

text file

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
Oct 13 '05 #1
4 2922
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" <ga***@mcgix.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
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

Oct 14 '05 #2
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:eT*************@TK2MSFTNGP15.phx.gbl...
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" <ga***@mcgix.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
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


Oct 14 '05 #3
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.
Oct 14 '05 #4
"Bob Barrows [MVP]" wrote in message
news:ea*************@TK2MSFTNGP12.phx.gbl...
: 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
Oct 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Ling Lee | last post: by
1 post views Thread by Rigga | last post: by
27 posts views Thread by Eric | last post: by
16 posts views Thread by thenightfly | last post: by
7 posts views Thread by Chris | last post: by
3 posts views Thread by bbepristis | last post: by
10 posts views Thread by bluemountain | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.