J
Jeff
Hi -
I have an ASP.NET page that hangs (some times; if it loads for you, try
refresh/F5 several times) when I try to run it on my localhost. It contains
an HTML table for formatting, and within the table are several labels,
textboxes, and validators. One of the textboxes is multiline and readonly,
and the codebehind page has code to read a text file into it. (The text
file is about 21,000 characters with spaces.) The aspx page has a
javascript function to set focus on the first textbox when the page loads.
I've also included "<pages smartNavigation="true"/>" in web.config.
My Page_Load event and the entire aspx page is below. When the page hangs,
pressing Esc will stop the hang and display the form, but the text in the
multiline textbox is not complete (last line should be "-- End Of File --").
If I remove the table row with the multiline textbox and leave the rest of
the table rows as they are, the page doesn't hang. If I remove all of the
table rows except the one with the multiline textbox, the page doesn't hang
and the text file loads to end of file.
Can anyone see what might be causing the hang??
Thanks for your help.
- Jeff
'****************
Page_Load code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim srdFile As StreamReader
srdFile = File.OpenText(Server.MapPath("Loren ipsum.txt"))
Me.TextBox1.Text = srdFile.ReadToEnd()
srdFile.Close
srdFile = Nothing
End Sub
'****************
aspx page:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="TextTest01.WebForm1"%>
<!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/ie3-2nav3-0">
<script language="JavaScript">
<!--
function setFocus() { document.forms.Form1.txtCompanyName.focus(); }
//-->
</script>
</HEAD>
<body onload="setFocus();">
<form id="Form1" method="post" runat="server">
<TABLE id=Table1 cellSpacing=0 cellPadding=10 width="90%" border=0>
<TR>
<TD>
<asp:label id=lblCompanyName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">COMPANY NAME <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtCompanyName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="300px"></asp:textbox>
<asp:requiredfieldvalidator id=rfvCompanyName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Company Name is a Required Field"
ControlToValidate="txtCompanyName"></asp:requiredfieldvalidator>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblWebsite runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">Company Website URL</asp:label><BR>
<asp:textbox id=txtWebsite runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="375px"></asp:textbox>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblAddress runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">ADDRESS</asp:label><BR>
<asp:textbox id=txtAddress1 runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="300px"></asp:textbox> <font
color=#ff0000>*</font>
<asp:requiredfieldvalidator id=rfvAddress runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Address is a Required Field"
ControlToValidate="txtAddress1"></asp:requiredfieldvalidator><BR>
<asp:textbox id=txtAddress2 runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="300px"></asp:textbox>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblCity runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">CITY <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtCity runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="225px"></asp:textbox>
<asp:requiredfieldvalidator id=rfvCity runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="City is a Required Field"
ControlToValidate="txtCity"></asp:requiredfieldvalidator>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblRegion runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"><B>County or
Postal Region</B> (Outside of the US, Australia, and Canada)</asp:label><BR>
<asp:textbox id=txtRegion runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="225px"></asp:textbox>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblZip runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">ZIP or Postal Code</asp:label><BR>
<asp:textbox id=txtZip runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="150px"></asp:textbox>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblCountry runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">Country <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtCountry runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="225px">United States</asp:textbox>
<asp:requiredfieldvalidator id=rfvCountry runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Country is a Required Field"
ControlToValidate="txtCountry"></asp:requiredfieldvalidator>
</TD>
</TR>
<TR>
<TD>
<TABLE id=Table2 height=196 width=523 border=2>
<TR>
<TD>
<TABLE id=Table3 cellSpacing=0 cellPadding=5 width="100%"
border=0>
<TR>
<TD colSpan=3>
<asp:label id=lblContactPerson runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True" Font-Underline="True">CONTACT PERSON</asp:label>
</TD>
</TR>
<TR>
<TD width=50></TD>
<TD width=199>
<asp:label id=lblContactName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">NAME <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtContactName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="225px"></asp:textbox><BR>
<asp:requiredfieldvalidator id=rfvContactName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Name is a Required Field"
ControlToValidate="txtContactName"></asp:requiredfieldvalidator>
</TD>
<TD>
<asp:label id=lblContactPassword runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">PASSWORD <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtContactPassword runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="150px" TextMode=Password></asp:textbox><BR>
<asp:requiredfieldvalidator id=rfvContactPassword runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Password is a Required Field"
ControlToValidate="txtContactPassword"></asp:requiredfieldvalidator>
</TD>
</TR>
<TR>
<TD width=50></TD>
<TD width=199>
<asp:label id=lblContactPhone runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">TELEPHONE <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtContactPhone runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="150px"></asp:textbox><BR>
<asp:requiredfieldvalidator id=rfvContactPhone runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Telephone is a Required Field"
ControlToValidate="txtContactPhone"></asp:requiredfieldvalidator>
</TD>
<TD>
<asp:label id=lblContactEmail runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">eMAIL <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtContactEmail runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="300px"></asp:textbox><BR>
<asp:requiredfieldvalidator id=rfvContactEmail runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="eMail is a Required Field"
ControlToValidate="txtContactEmail"></asp:requiredfieldvalidator>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<tr>
<td>
<asp:TextBox id=TextBox1 Font-Names="Verdana,Arial,Helvetica,sans-serif"
runat="server" Width="500px" Height="150px" TextMode="MultiLine"
ReadOnly="True" EnableViewState="False"></asp:TextBox>
</td>
</tr>
</TABLE>
</form>
</body>
</HTML>
I have an ASP.NET page that hangs (some times; if it loads for you, try
refresh/F5 several times) when I try to run it on my localhost. It contains
an HTML table for formatting, and within the table are several labels,
textboxes, and validators. One of the textboxes is multiline and readonly,
and the codebehind page has code to read a text file into it. (The text
file is about 21,000 characters with spaces.) The aspx page has a
javascript function to set focus on the first textbox when the page loads.
I've also included "<pages smartNavigation="true"/>" in web.config.
My Page_Load event and the entire aspx page is below. When the page hangs,
pressing Esc will stop the hang and display the form, but the text in the
multiline textbox is not complete (last line should be "-- End Of File --").
If I remove the table row with the multiline textbox and leave the rest of
the table rows as they are, the page doesn't hang. If I remove all of the
table rows except the one with the multiline textbox, the page doesn't hang
and the text file loads to end of file.
Can anyone see what might be causing the hang??
Thanks for your help.
- Jeff
'****************
Page_Load code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim srdFile As StreamReader
srdFile = File.OpenText(Server.MapPath("Loren ipsum.txt"))
Me.TextBox1.Text = srdFile.ReadToEnd()
srdFile.Close
srdFile = Nothing
End Sub
'****************
aspx page:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="TextTest01.WebForm1"%>
<!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/ie3-2nav3-0">
<script language="JavaScript">
<!--
function setFocus() { document.forms.Form1.txtCompanyName.focus(); }
//-->
</script>
</HEAD>
<body onload="setFocus();">
<form id="Form1" method="post" runat="server">
<TABLE id=Table1 cellSpacing=0 cellPadding=10 width="90%" border=0>
<TR>
<TD>
<asp:label id=lblCompanyName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">COMPANY NAME <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtCompanyName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="300px"></asp:textbox>
<asp:requiredfieldvalidator id=rfvCompanyName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Company Name is a Required Field"
ControlToValidate="txtCompanyName"></asp:requiredfieldvalidator>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblWebsite runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">Company Website URL</asp:label><BR>
<asp:textbox id=txtWebsite runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="375px"></asp:textbox>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblAddress runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">ADDRESS</asp:label><BR>
<asp:textbox id=txtAddress1 runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="300px"></asp:textbox> <font
color=#ff0000>*</font>
<asp:requiredfieldvalidator id=rfvAddress runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Address is a Required Field"
ControlToValidate="txtAddress1"></asp:requiredfieldvalidator><BR>
<asp:textbox id=txtAddress2 runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="300px"></asp:textbox>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblCity runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">CITY <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtCity runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="225px"></asp:textbox>
<asp:requiredfieldvalidator id=rfvCity runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="City is a Required Field"
ControlToValidate="txtCity"></asp:requiredfieldvalidator>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblRegion runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"><B>County or
Postal Region</B> (Outside of the US, Australia, and Canada)</asp:label><BR>
<asp:textbox id=txtRegion runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="225px"></asp:textbox>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblZip runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">ZIP or Postal Code</asp:label><BR>
<asp:textbox id=txtZip runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="150px"></asp:textbox>
</TD>
</TR>
<TR>
<TD>
<asp:label id=lblCountry runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">Country <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtCountry runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="225px">United States</asp:textbox>
<asp:requiredfieldvalidator id=rfvCountry runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Country is a Required Field"
ControlToValidate="txtCountry"></asp:requiredfieldvalidator>
</TD>
</TR>
<TR>
<TD>
<TABLE id=Table2 height=196 width=523 border=2>
<TR>
<TD>
<TABLE id=Table3 cellSpacing=0 cellPadding=5 width="100%"
border=0>
<TR>
<TD colSpan=3>
<asp:label id=lblContactPerson runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True" Font-Underline="True">CONTACT PERSON</asp:label>
</TD>
</TR>
<TR>
<TD width=50></TD>
<TD width=199>
<asp:label id=lblContactName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">NAME <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtContactName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="225px"></asp:textbox><BR>
<asp:requiredfieldvalidator id=rfvContactName runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Name is a Required Field"
ControlToValidate="txtContactName"></asp:requiredfieldvalidator>
</TD>
<TD>
<asp:label id=lblContactPassword runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">PASSWORD <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtContactPassword runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="150px" TextMode=Password></asp:textbox><BR>
<asp:requiredfieldvalidator id=rfvContactPassword runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Password is a Required Field"
ControlToValidate="txtContactPassword"></asp:requiredfieldvalidator>
</TD>
</TR>
<TR>
<TD width=50></TD>
<TD width=199>
<asp:label id=lblContactPhone runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">TELEPHONE <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtContactPhone runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="150px"></asp:textbox><BR>
<asp:requiredfieldvalidator id=rfvContactPhone runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="Telephone is a Required Field"
ControlToValidate="txtContactPhone"></asp:requiredfieldvalidator>
</TD>
<TD>
<asp:label id=lblContactEmail runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="8pt"
Font-Bold="True">eMAIL <font color=#ff0000>*</font></asp:label><BR>
<asp:textbox id=txtContactEmail runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
Width="300px"></asp:textbox><BR>
<asp:requiredfieldvalidator id=rfvContactEmail runat="server"
Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="10pt"
ErrorMessage="eMail is a Required Field"
ControlToValidate="txtContactEmail"></asp:requiredfieldvalidator>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<tr>
<td>
<asp:TextBox id=TextBox1 Font-Names="Verdana,Arial,Helvetica,sans-serif"
runat="server" Width="500px" Height="150px" TextMode="MultiLine"
ReadOnly="True" EnableViewState="False"></asp:TextBox>
</td>
</tr>
</TABLE>
</form>
</body>
</HTML>