为什么会导致错误?

时间:2014-01-09 10:59:08

标签: c# javascript jquery ajax iis

这段代码总是在提交时返回错误,为什么会有任何想法?

<script type="text/javascript">
    $(function () {
        $('#Form1').submit(function (event) {
            var form = $(this);
            $.ajax({
                type: form.attr('method'),
                url: form.attr('action'),
                data: form.serialize()
            }).done(function () {
                // Optionally alert the user of success here...
                alert("Success");
            }).fail(function () {
                // Optionally alert the user of an error here...
                alert("Error" + form.serialize());
            });
            event.preventDefault(); // Prevent the form from submitting via the browser.
        });
    });

<form id="Form1" action="PostData.aspx?RoomID=1" method="post" runat="server">
<!-- Modal -->
<div class="modal fade" id="reportProblem" tabindex="-1" role="dialog" labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;         </button>
     <h4 class="modal-title" id="H3">Report a Problem</h4>
  </div>
  <div class="modal-body">
    <p>What are you having a problem with?</p>

          <select class="form-control" id="ProblemSelect" name="ProblemSelect" runat="server">
<option selected="selected" runat="server">Projector</option>
<option runat="server">TV</option>
<option runat="server">Video Conference</option>
<option runat="server">Damage</option>
<option runat="server">Other</option>

</select>



  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    <asp:Button type="button" runat="server" Text="Report Problem" class="btn btn-primary"></asp:Button>
  </div>
</div><!-- /.modal-content -->
</form>

发现发生此错误:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or    cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 

这是托管在运行IIS7的Windows Server上的任何想法吗?

0 个答案:

没有答案