-1

VB Studio で構築されたサイトを継承し、このページでフォームを機能させようとしています: http://childplus.com/Support/フォーム。ワーキングフォームが欲しい!

これまでのところ、送信ボタンをクリックすると、ブラウザに関係なく 500 エラーが返されます。ただし、VB Studio を使用して Web フォームを開発するのはまだ初めてです。初心者向けの 500 エラーのデバッグと修正に関する洞察や指示をいただければ幸いです。

ページの実際のフォーム:

<form id="form_support" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>

<!--Name-->
<div class="FormLine">
<asp:Label ID="lblName" runat="server" Text="Name:"  CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:TextBox ID="FullName" runat="server" class="TxtBox" TabIndex="1" MaxLength="100"></asp:TextBox>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValFullname" runat="server" ControlToValidate="FullName"  ToolTip="Name is Required" EnableClientScript="False" SetFocusOnError="true"></asp:RequiredFieldValidator>

</div>

<!--Agency-->
<div class="FormLine">
<asp:Label ID="lblAgency" runat="server" Text="Agency:"  CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:TextBox ID="AgencyName" runat="server" class="TxtBox" TabIndex="2" MaxLength="100"></asp:TextBox>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValAgencyName" runat="server" ControlToValidate="AgencyName"  ToolTip="Agency is Required" EnableClientScript="False" SetFocusOnError="true"></asp:RequiredFieldValidator><br />

</div>

<!--Email-->
<div class="FormLine">
<asp:Label ID="lblemail" runat="server" Text="Email:"  CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:TextBox ID="email" runat="server" class="TxtBox" TabIndex="3" MaxLength="100"></asp:TextBox>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValEmail" runat="server" ControlToValidate="email"  ToolTip="Email is Required" EnableClientScript="False"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator  Display="Static" ID="RegularExpressionValEmail"   ErrorMessage="Email is not valid." ControlToValidate="email" runat="server" ToolTip="Email is not valid." ValidationExpression="^(['_a-z0-9-]+)(\.['_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,5})$"></asp:RegularExpressionValidator>

</div>

<!--Phone-->
<div class="FormLine">
<asp:Label ID="lblPhone" runat="server" Text="Phone:"  CssClass="Txt"></asp:Label><p class="required">(required)</p>

<asp:TextBox ID="phone" runat="server" class="TxtBox" TabIndex="4" MaxLength="30"></asp:TextBox>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValPhone" runat="server" ControlToValidate="phone"  ToolTip="Phone is Required" EnableClientScript="False" SetFocusOnError="true"></asp:RequiredFieldValidator><br />

</div>

<!--Subject-->
<div class="FormLine">
<asp:Label ID="lblSubject" runat="server" Text="Subject:"  CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:DropDownList ID="ddlSubject" runat="server" class="TxtBox1" TabIndex="5"></asp:DropDownList>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValddlSubject" runat="server" ControlToValidate="ddlSubject"  ToolTip="Subject is Required." InitialValue="" EnableClientScript="False"></asp:RequiredFieldValidator>                          

</div>

<!--Topic-->
<div class="FormLine">
<span class="Txt">Topic:</span>
<asp:DropDownList ID="ddlTopic" runat="server" class="TxtBox1" TabIndex="6"></asp:DropDownList>
<asp:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="ddlSubject"  Category="subject" prompttext="Select a Subject..."  ServicePath="~/wbSubjectTopics.asmx" ServiceMethod="GetDropDownContents">
</asp:CascadingDropDown>
<asp:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="ddlTopic"  Category="topic" prompttext="Select a Topic..."  LoadingText="Loading..." ParentControlID="ddlSubject" ServicePath="~/wbSubjectTopics.asmx" ServiceMethod="GetDropDownContents">
</asp:CascadingDropDown>
</div>

<!--Details-->
<div class="FormMultiLine">
<span class="Txt2">Please include as much detail as possible including:</span>
    <ul>
    <li>What steps you did.</li>
    <li>Your computer's operating system.</li>
    <li>Exact text of any error message.</li>
    </ul> 

<asp:TextBox ID="Comments" class="TxtBoxMulti" runat="server"  TextMode="MultiLine" TabIndex="7" ></asp:TextBox>                        
</div>


<!--Submit-->
<div id="SubBtnWrapper" class="SubBtnBlue">  
    <asp:LinkButton ID="SubBtn" text="" title="Submit" runat="server" TabIndex="8">
    <div class="rollover_wrapper"><div class="submit_rollover"><img src="../../Images/Forms/submit_btn_blue.png" height="78px" width="79px" /></div></div>
    </asp:LinkButton>
</div>


<script type="text/javascript" language="JavaScript"><!--    document.form_support.FullName.focus(); //--></script>
</form>

</div>

コードビハインド: Imports Common

Partial Public Class Support_homepage
    Inherits System.Web.UI.Page
    Public Utils As Utils = New Utils


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub ddlSubject_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ddlSubject.SelectedIndexChanged
        ddlTopic.SelectedIndex = -1
    End Sub

    Private Sub SubBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubBtn.Click
        Page.Validate()

        If (Page.IsValid) Then
            Dim EmailBody As String

            Dim strSubjectTopic As String

            If ddlTopic.SelectedValue = "" Then
                strSubjectTopic = ddlSubject.SelectedValue
            Else
                strSubjectTopic = ddlTopic.SelectedValue
            End If

            EmailBody = "<p style=" + "font-family:Verdana;" + "><strong>Technical Support Request:</strong></p><p style=" + "font-family:Verdana;" + "><strong>Name:</strong> " + FullName.Text + "</p>"
            EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Email:</strong> " + email.Text + "</p>"
            EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Phone:</strong> " + phone.Text + "</p>"
            EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Agency:</strong> " + AgencyName.Text + "</p>"
            EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Subject/Topic:</strong> " + strSubjectTopic + "</p>"
            EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Comments:</strong> " + Comments.Text + "</p>"

            Utils.SendAppNotificationEmails("support@childplus.com", "support@childplus.com", "Website: Technical Support Request", EmailBody)
            Response.Redirect("/")
        Else
            If RequiredFieldValFullname.IsValid Then
                lblName.CssClass = "Txt"
            Else
                lblName.CssClass = "ErrorTxt"
            End If

            If RequiredFieldValAgencyName.IsValid Then
                lblAgency.CssClass = "Txt"
            Else
                lblAgency.CssClass = "ErrorTxt"
            End If

            If RequiredFieldValPhone.IsValid Then
                lblPhone.CssClass = "Txt"
            Else
                lblPhone.CssClass = "ErrorTxt"
            End If

            If RequiredFieldValEmail.IsValid Then
                lblemail.CssClass = "Txt"
            Else
                lblemail.CssClass = "ErrorTxt"
            End If


            If RequiredFieldValddlSubject.IsValid Then
                lblSubject.CssClass = "Txt"
            Else
                lblSubject.CssClass = "ErrorTxt"
            End If
        End If
    End Sub


End Class

スタック トレースは次のとおりです。

Server Error in '/' Application.

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +8644665
   System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +69
   System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection) +53
   System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +13
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +343
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
4

1 に答える 1

0

この記事で説明されている解決策を試してください http://johanleino.wordpress.com/2011/04/09/revisedcascadingdropdown-casues-invalid-postback-or-callback-argument-error/

于 2012-10-16T20:27:21.753 に答える