I am trying to determine the problem in an ASPX that I did not write. In fact, I do not yet have enough skill with ASP.NET to write this page so please go easy on me.
If the page were functioning properly, it would allow a user to edit the contents of a greeting letter in rich text format. From the user perspective, the page loads as a pure HTML <form>. The form contains an HTML TEXTAREA and a "Save" button.
The page properly loads the existing greeting letter contents into the TEXTAREA but when the form is submitted by clicking Save, an error appears.
I have emphasized the portions of the stack trace when seem to me to be the most interesting:[tt]
[Win32Exception (0x80004005): [red]Error creating window handle.[/red]]
System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) +677
System.Windows.Forms.Control.CreateHandle() +213
System.Windows.Forms.Control.get_Handle() +60
System.Windows.Forms.Control.CreateHandle() +200
System.Windows.Forms.TextBoxBase.CreateHandle() +54
System.Windows.Forms.Control.get_Handle() +60
System.Windows.Forms.RichTextBox.ForceHandleCreate() +5
System.Windows.Forms.RichTextBox.set_SelectedText(String value) +13
[highlight] System.Windows.Forms.TextBoxBase.AppendText(String text) +105
FormLetterManagement.PersonalFormsBody.btnEditSave_Click(Object sender, EventArgs e)
[/highlight] System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
[/tt]
The codebehind for the form Save button copies the submitted value of the TextArea into a WinForm rich textbox, appends a blank space character, and then saves the file. [red]*[/red] Below is the code that I believe is referenced by the stack trace:
I assume a RTB would be good for opening an existing letter in rich text format and converting it into plain text for use in an HTML TEXTAREA... but why would a RTB be used on the back side to process plain text submitted *from* a TEXTAREA? I can't imagine the users are submitting anything other than plain text because its not like these folks know any markup languages.
Why go through the effort to append a blank space character in Arial 10pt font? To insert some RTF markup code into an otherwise plaintext document?
Any insight will be very much appreciated.
[red]*[/red] Strangely, the file name is taken from a label, which although is displayed on the page, the value of the filename does not appear in any HTML form element so therefore must not be part of the submitted HTTP Request. I assume this is accomplished by the ASP.NET's mechanism for maintaining application state.
If the page were functioning properly, it would allow a user to edit the contents of a greeting letter in rich text format. From the user perspective, the page loads as a pure HTML <form>. The form contains an HTML TEXTAREA and a "Save" button.
The page properly loads the existing greeting letter contents into the TEXTAREA but when the form is submitted by clicking Save, an error appears.
I have emphasized the portions of the stack trace when seem to me to be the most interesting:[tt]
[Win32Exception (0x80004005): [red]Error creating window handle.[/red]]
System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) +677
System.Windows.Forms.Control.CreateHandle() +213
System.Windows.Forms.Control.get_Handle() +60
System.Windows.Forms.Control.CreateHandle() +200
System.Windows.Forms.TextBoxBase.CreateHandle() +54
System.Windows.Forms.Control.get_Handle() +60
System.Windows.Forms.RichTextBox.ForceHandleCreate() +5
System.Windows.Forms.RichTextBox.set_SelectedText(String value) +13
[highlight] System.Windows.Forms.TextBoxBase.AppendText(String text) +105
FormLetterManagement.PersonalFormsBody.btnEditSave_Click(Object sender, EventArgs e)
[/highlight] System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
[/tt]
The codebehind for the form Save button copies the submitted value of the TextArea into a WinForm rich textbox, appends a blank space character, and then saves the file. [red]*[/red] Below is the code that I believe is referenced by the stack trace:
Code:
Private Sub btnEditSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEditSave.Click
Dim filename As String
filename = Label1.Text
Dim temp As String = TextBox1.Text
Dim richtextbox As New System.Windows.Forms.RichTextBox
Dim newtext As String
richtextbox.Text = temp
Dim nfont As System.Drawing.Font
richtextbox.Font = New System.Drawing.Font("Arial", 10)
[highlight]richtextbox.AppendText(" ")[/highlight]
newtext = richtextbox.Rtf
[... snip ...]
I assume a RTB would be good for opening an existing letter in rich text format and converting it into plain text for use in an HTML TEXTAREA... but why would a RTB be used on the back side to process plain text submitted *from* a TEXTAREA? I can't imagine the users are submitting anything other than plain text because its not like these folks know any markup languages.
Why go through the effort to append a blank space character in Arial 10pt font? To insert some RTF markup code into an otherwise plaintext document?
Any insight will be very much appreciated.
[red]*[/red] Strangely, the file name is taken from a label, which although is displayed on the page, the value of the filename does not appear in any HTML form element so therefore must not be part of the submitted HTTP Request. I assume this is accomplished by the ASP.NET's mechanism for maintaining application state.