473,320 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Response.Write Problem

Hi all,

I am now writing a aspx that get a session variable (string) and then write
it out using Response.Write.

The string length is: 494710.

But Response.Write only write the string partially!

I tried using following code, but it doesn't work, the page is keep loading.

if(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
stringcontent = stringcontent.Substring(500);
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}
}
Response.Write(stringcontent);

How I can solve it?? Thx a lot.

Matthew
Nov 18 '05 #1
5 2089
Hi matthew,

you should not be storing huge items in session as this can degrade your
performance.

if i see your code it seems like you are not changing the value of
stringcontent variable so its an infinite loop.
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}
Regards
Ashish M Bhonkiya
"matthew" <ma**@sinaman.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl... Hi all,

I am now writing a aspx that get a session variable (string) and then write it out using Response.Write.

The string length is: 494710.

But Response.Write only write the string partially!

I tried using following code, but it doesn't work, the page is keep loading.
if(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
stringcontent = stringcontent.Substring(500);
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}
}
Response.Write(stringcontent);

How I can solve it?? Thx a lot.

Matthew

Nov 18 '05 #2
sorry, the code should be

while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
stringcontent= stringcontent.Substring(500);
}

still doesn't work.

If i don't use session, how i can pass such item from aspx to other aspx?
"Ashish M Bhonkiya" <bh******@hotmail.com.nospam> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Hi matthew,

you should not be storing huge items in session as this can degrade your
performance.

if i see your code it seems like you are not changing the value of
stringcontent variable so its an infinite loop.
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}


Regards
Ashish M Bhonkiya
"matthew" <ma**@sinaman.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I am now writing a aspx that get a session variable (string) and then

write
it out using Response.Write.

The string length is: 494710.

But Response.Write only write the string partially!

I tried using following code, but it doesn't work, the page is keep

loading.

if(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
stringcontent = stringcontent.Substring(500);
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}
}
Response.Write(stringcontent);

How I can solve it?? Thx a lot.

Matthew


Nov 18 '05 #3
Hi Matthew,

Probably if you use your code it will not display the last part and that is
where the problem is. so you may update your code as follows and it should
work.

while(stringcontent.Length > 0)
{
// this will take care of the length at the last part if it
is not in the multuple of 500.
int myLength = (stringcontent.Length>500) ?
500:stringcontent.Length;

Response.Write(stringcontent.Substring(0,myLength) );
Response.Write("<BR>");
stringcontent= stringcontent.Substring(myLength);
}
If i don't use session, how i can pass such item from aspx to other aspx?

it was just to make you aware to not unnecessacarily load the server
resources you may go for session variables no issues.
Also you can the data across the form using Using Querystring or Using
Server.Transfer you may read this article for more details
http://www.dotnetbips.com/displayarticle.aspx?id=79

HTH
Regards
Ashish M Bhonkiya
"matthew" <ma**@sinaman.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... sorry, the code should be

while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
stringcontent= stringcontent.Substring(500);
}

still doesn't work.

If i don't use session, how i can pass such item from aspx to other aspx?
"Ashish M Bhonkiya" <bh******@hotmail.com.nospam> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Hi matthew,

you should not be storing huge items in session as this can degrade your
performance.

if i see your code it seems like you are not changing the value of
stringcontent variable so its an infinite loop.
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}


Regards
Ashish M Bhonkiya
"matthew" <ma**@sinaman.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I am now writing a aspx that get a session variable (string) and then

write
it out using Response.Write.

The string length is: 494710.

But Response.Write only write the string partially!

I tried using following code, but it doesn't work, the page is keep

loading.

if(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
stringcontent = stringcontent.Substring(500);
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}
}
Response.Write(stringcontent);

How I can solve it?? Thx a lot.

Matthew



Nov 18 '05 #4
Hello Matthew,

And what happens when you do:

Response.Write(stringcontent);
Response.Flush();
sorry, the code should be

while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
stringcontent= stringcontent.Substring(500);
}
still doesn't work.

If i don't use session, how i can pass such item from aspx to other
aspx?

"Ashish M Bhonkiya" <bh******@hotmail.com.nospam> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Hi matthew,

you should not be storing huge items in session as this can degrade
your performance.

if i see your code it seems like you are not changing the value of
stringcontent variable so its an infinite loop.
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}

Regards
Ashish M Bhonkiya
"matthew" <ma**@sinaman.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I am now writing a aspx that get a session variable (string) and
then

write
it out using Response.Write.

The string length is: 494710.

But Response.Write only write the string partially!

I tried using following code, but it doesn't work, the page is keep

loading.
if(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
stringcontent = stringcontent.Substring(500);
while(stringcontent.Length > 500)
{
Response.Write(stringcontent.Substring(0,500));
pagecontent = stringcontent.Substring(500);
}
}
Response.Write(stringcontent);
How I can solve it?? Thx a lot.

Matthew

--

--
Matt Berther
http://www.mattberther.com
Nov 18 '05 #5
"matthew" <ma**@sinaman.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
I am now writing a aspx that get a session variable (string) and then write it out using Response.Write. .. . . But Response.Write only write the string partially!


matthew,

Does it "break" at any "meaningful" point or just give up after a
certain number of bytes or at a given character in the data (say,
a null character, 0x00 )?

HTH,
Phill W.
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Gary | last post by:
I am having a strange problem that I cannot solve. I have an asp page that I use for a user to login and gain access to other pages. When the user logs in I set a couple of session variables like...
8
by: Jack | last post by:
Hi, Here is my problem: I am logging in to a page, where the page retrieves a record from a database. The text boxes are used in the display formto let the users update the fields, if they...
6
by: Mark | last post by:
Hi... I've come across some weird bug with Response.Cookies. Or maybe it will be called "by design" but for the life of me I can't figure out what purpose it would serve. If you're setting a...
9
by: msuk | last post by:
All, I have a well form block of XML that is stored in a C# string type and I just simply want to display it in the browser using Response.Write but when I try this I get the following error: ...
3
by: Brad | last post by:
I have a response filter which injects "standard" html into my pages. The filter works fine when the initial stream is small enough not to buffer...or....if I have a large unbuffered stream (i.e. I...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
17
by: raj chahal | last post by:
Hi there I need to be able to print on screen when I check if a value within a db <td> <% if ((Recordset1.Fields.Item("profile1").Value) <> "") then response.Write"Pro1<br>" &...
12
by: Jim Rodgers | last post by:
I have a big asp file that has an error under certain conditions -- totally repeatable. However, it only fails when I set response.buffer = True at the top. WHen I set it False in order to debug...
7
by: Jim in Arizona | last post by:
I'm brand new at ajax. In fact, about 20 minutes ago was the first time I got it to work. The problem I'm having on another page did not work, however. I'm running into the following error: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.