初学asp.net遇到问题,求大家帮忙!
我抄书上的asp.net代码,运行时遇到问题:
回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentException: 回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
代码为:
<%@ Page Language="C#" AutoEventWireup="true" %>
<head runat="server">
<title>会员信息</title>
<script runat ="server">
void submit(object sender, EventArgs e)
{
table2.Visible = true;
table2.Rows[0].Cells[0].InnerText = "姓名:" + Name.Value;
table2.Rows[1].Cells[0].InnerText ="性别:" + (Man.Checked ? "男": "女");
table2.Rows[2].Cells[0].InnerText ="年龄:" + Age.Value ;
table2.Rows[3].Cells[0].InnerText ="婚姻状况:" + Select1 .Items[Select1 .SelectedIndex ].Value ;
table2.Rows[4].Cells[0].InnerText = train.Checked ? "参加过培训" : "没有参加过培训";
table2.Rows[5].Cells[0].InnerText =TextArea1 .Value ;
}
</script>
<style type="text/css">
.style2
{
width: 126px;
}
.style4
{
width: 38%;
}
.style6
{
width: 128px;
}
.style7
{
height: 70px;
}
.style8
{
width: 190px;
}
.style9
{
width: 617px;
}
</style>
</head>
<body>
<form id="form1" method ="post" runat="server">
<div>
会员信息:</div>
</form>
<table class="style4">
<tr>
<td class="style8">
姓名:</td>
<td class="style2">
<input id="Name" type="text" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
性别:</td>
<td class="style2">
<input id="Man" checked="true" name="sex" type="radio" value="V1" runat ="server" />男
<input id="Woman" name="sex" type="radio" value="V1" runat ="server" />女</td>
</tr>
<tr>
<td class="style8">
年龄:</td>
<td class="style2">
<input id="Age" type="text" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
婚姻状况:</td>
<td class="style2">
<select id="Select1" class="style6" name="D1" runat ="server">
<option value ="已婚">已婚</option>
<option value="未婚">未婚</option>
</select></td>
</tr>
<tr>
<td class="style8">
是否参加过培训:</td>
<td class="style2">
<input id="train" type="checkbox" checked="checked" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
自我介绍:</td>
<td class="style2">
<textarea id="TextArea1" class="style7" cols="20" rows ="4" name="S1" runat ="server"></textarea></td>
</tr>
<tr>
<td class="style8">
<input id="Button1" type="button" value="提交" runat ="server" onserverclick = "submit" /></td>
<td class="style2">
<input id="Reset1" type="reset" value="取消" runat="server" /></td>
</tr>
</table>
<p>
</p>
<table id="table2" visible ="true" cellpadding ="5" cellspacing ="0" border ="2" runat ="server" style="width:30%;">
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
</table>
</body>
</html>
如果用enableEventValidation="fase",就看不到返回信息了.有没有什么解决的方法啊?
回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentException: 回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
代码为:
<%@ Page Language="C#" AutoEventWireup="true" %>
<head runat="server">
<title>会员信息</title>
<script runat ="server">
void submit(object sender, EventArgs e)
{
table2.Visible = true;
table2.Rows[0].Cells[0].InnerText = "姓名:" + Name.Value;
table2.Rows[1].Cells[0].InnerText ="性别:" + (Man.Checked ? "男": "女");
table2.Rows[2].Cells[0].InnerText ="年龄:" + Age.Value ;
table2.Rows[3].Cells[0].InnerText ="婚姻状况:" + Select1 .Items[Select1 .SelectedIndex ].Value ;
table2.Rows[4].Cells[0].InnerText = train.Checked ? "参加过培训" : "没有参加过培训";
table2.Rows[5].Cells[0].InnerText =TextArea1 .Value ;
}
</script>
<style type="text/css">
.style2
{
width: 126px;
}
.style4
{
width: 38%;
}
.style6
{
width: 128px;
}
.style7
{
height: 70px;
}
.style8
{
width: 190px;
}
.style9
{
width: 617px;
}
</style>
</head>
<body>
<form id="form1" method ="post" runat="server">
<div>
会员信息:</div>
</form>
<table class="style4">
<tr>
<td class="style8">
姓名:</td>
<td class="style2">
<input id="Name" type="text" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
性别:</td>
<td class="style2">
<input id="Man" checked="true" name="sex" type="radio" value="V1" runat ="server" />男
<input id="Woman" name="sex" type="radio" value="V1" runat ="server" />女</td>
</tr>
<tr>
<td class="style8">
年龄:</td>
<td class="style2">
<input id="Age" type="text" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
婚姻状况:</td>
<td class="style2">
<select id="Select1" class="style6" name="D1" runat ="server">
<option value ="已婚">已婚</option>
<option value="未婚">未婚</option>
</select></td>
</tr>
<tr>
<td class="style8">
是否参加过培训:</td>
<td class="style2">
<input id="train" type="checkbox" checked="checked" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
自我介绍:</td>
<td class="style2">
<textarea id="TextArea1" class="style7" cols="20" rows ="4" name="S1" runat ="server"></textarea></td>
</tr>
<tr>
<td class="style8">
<input id="Button1" type="button" value="提交" runat ="server" onserverclick = "submit" /></td>
<td class="style2">
<input id="Reset1" type="reset" value="取消" runat="server" /></td>
</tr>
</table>
<p>
</p>
<table id="table2" visible ="true" cellpadding ="5" cellspacing ="0" border ="2" runat ="server" style="width:30%;">
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
</table>
</body>
</html>
如果用enableEventValidation="fase",就看不到返回信息了.有没有什么解决的方法啊?
...全文
相关推荐
ASP.NET实例——漂亮的自适应宽度的导航条(仿Discuz!)
总之,通过ASP.NET的asp:Menu控件和自适应布局技术,我们可以创建出类似于Discuz!论坛的导航条,提供跨设备的出色用户体验。
【使用ASP.NET开发Web项目】第一课——初识ASP.NET,创建第一个ASP.NET程序
知识点:理解 ASP.NET 的概念和优势、会创建 ASP.NET Web Form 程序、理解 ASP.NET Web Form 程序的执行阶段、会使用代码内嵌和代码后置两种方式进行编码。 1、网站开发基础了解 1.1 网站开发各环节组成 1.2 开发网站需要的知识结构 (1)网站开发前台页面技术 页面设计:HTML、DIV+CSS 页面特效:JavaScr...
easyUI+ASP.net使用实例(初学者 )
**标题与描述解析**标题"easyUI+ASP.net使用实例(初学者 )"表明这是一个面向初学者的教学资源,主要讲解如何将easyUI框架与ASP.NET技术结合使用。
ASP.NET一本很好的书籍,适合初学者。
这本"ASP.NET一本很好的书籍"显然是针对初学者设计的,旨在帮助他们快速入门并掌握ASP.NET的基础知识。
ASP.Net初学者小程序项目
ASP.NET初学者小程序项目是一个适合新手入门的编程实践,它主要涵盖了ASP.NET基础、网页交互以及用户认证等关键知识点。


