|
-
Oct 20th, 2005, 03:17 PM
#1
Thread Starter
Fanatic Member
smoothing the end user's page performance [RESOLVED]
I have a process intensive asp.net page that takes up to two minutes to finish processing. It's a backoffice page that connects to different web services / API's, does some stuff and returns either success or error + error message, that gets displayed in order on a datagrid.
I know I can't do the process faster, because the web services / API's are 3rd party. But I wan't to "smooth" the end user's performance.
Is there anyway to get the datagrid "updated", so the end user see's the results of each connection to the API's? Instead of waiting until the whole page process, and then get the results. Is some kind of flush? or dump? I tryed response.flush() but it doesn't do anithing I can see.
Thanks
HoraShadow
Last edited by HoraShadow; Oct 22nd, 2005 at 09:34 PM.
-
Oct 20th, 2005, 03:40 PM
#2
Re: smoothing the end user's page performance
Do not use any of ASP.NET's built in controls, instead, manually write a table using Response.Write and Response.Flush.
Another thing you have to do is specify the column widths on the table in pixels for ALL columns, otherwise the end user's browser will wait for the whole table before it shows it. If you specify all the widths manually up front, most browsers will write the table as it receives it.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Oct 20th, 2005, 05:48 PM
#3
Thread Starter
Fanatic Member
Re: smoothing the end user's page performance
Thanks for your answer Lord_Rat!.
I tryed your suggestion with a test page, but I couldn't get it to work. After 6 seconds it display the entire page. Instead of flushing segments.
I used the debugger of vs2003 and IE6.1.
This is de code I used to try this out is:
VB Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim counter
Response.Write("<table border=1>")
Response.Flush()
For counter = 0 To 5
wait(counter)
Next
Response.Write("</table>")
Response.Flush()
End Sub
Private Sub wait(ByVal cycle As Integer)
sytem.threading.thread.sleep(2000)
Response.Write("<tr><td width=500>" & cycle.ToString & " | " & now & "</td></tr>")
Response.Flush()
End Sub
What I'm missing for this test to work?
Thanks
HoraShadow
Last edited by HoraShadow; Oct 21st, 2005 at 10:59 AM.
-
Oct 21st, 2005, 11:44 AM
#4
Re: smoothing the end user's page performance
Response.Write("<table border=1>")
Change to :
Response.Write("<table border=""1"" width=""500"">")
Response.Write("<colgroup")
Response.Write("<col width=""500"" />")
Response.Write("</colgroup>")
You don't have to specify a width on the TD elements themselves.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Oct 21st, 2005, 02:08 PM
#5
Thread Starter
Fanatic Member
Re: smoothing the end user's page performance
Thanks again for replying!
I still can't get it to work. I must be doing something wrong, but I don't realize where, or what.
The test code right now looks like this:
VB Code:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim counter
Response.Write("<table border=""1"" width=""500"">")
Response.Write("<colgroup>")
Response.Write("<col width=""500"" />")
Response.Write("</colgroup>")
Response.Flush()
For counter = 1 To 5
System.Threading.Thread.Sleep(2000)
Response.Write("<tr><td>" & counter & "</td></tr>")
Response.Flush()
Next
Response.Write("</table>")
End Sub
While the page process, If I right click and select view source, I can see the tr and td forming up. But it still doesn't display as it gets received. The code IS received, row by row, but not displayed. It gets displayed as soon as the page finishes rendering and gets dumped to the browser.
The html code looks weird too. It looks like this:
VB Code:
[B]<table border="1" width="500"><colgroup><col width="500" /></colgroup><tr><td>1</td></tr><tr><td>2</td></tr><tr><td>3</td></tr><tr><td>4</td></tr><tr><td>5</td></tr></table>[/B]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
</form>
</body>
</HTML>
The table gets dumped before anithing else. Maybe that's what's giving me issues?
Thanks
HoraShadow
-
Oct 22nd, 2005, 09:33 PM
#6
Thread Starter
Fanatic Member
Re: smoothing the end user's page performance
Resolved! Thanks!.
The error I was having, was that the browser doesn't display the table flushed untill it receives the /table. The browser displays complete tables, not just pratial tables.
Thanks a bunch Lord_Rat!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|