现在是在一个html页里放了一个form,就是一个用户登陆的,这是FORM的<form action="Default2.aspx" method="post">
<center><table style="width: 470px; height: 185px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 100px">
</td>
<td style="width: 245px">
<input id="txtUserName" type="text" onclick="return txtUserName_onclick()" /></td>
<td style="width: 280px">
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 245px">
<input id="txtUserPwd" type="text" onclick="return Text1_onclick()" /></td>
<td style="width: 280px">
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 245px">
<input id="Submit1" type="submit" value="提交" onclick="return Submit1_onclick()" /></td>
<td style="width: 280px">
</td>
</tr>
</table>
</center>
</form>
这个是ASPX页里的,
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String userName = Request["txtUserName"].ToString();
String userPwd = Request["txtUserPwd"].ToString();
//string userName=Request.Form.Get("txtUsername").ToString();
//string userPwd=Request.Form.Get("txtUserPwd").ToString();
Response.Write("登陆的用户名为" + userName + ";密码为" + userPwd);
}
protected void Text1_ServerChange(object sender, EventArgs e)
{
}
}
现在运行调试的时候就会出现 用户代码未处理NullRefrenceExpretion是什么意思? 没将引用对象设置到对象实力 指的是这句:String userName = Request["txtUserName"].ToString();
不大明白什么意思,谢谢大家帮忙下!
<center><table style="width: 470px; height: 185px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 100px">
</td>
<td style="width: 245px">
<input id="txtUserName" type="text" onclick="return txtUserName_onclick()" /></td>
<td style="width: 280px">
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 245px">
<input id="txtUserPwd" type="text" onclick="return Text1_onclick()" /></td>
<td style="width: 280px">
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 245px">
<input id="Submit1" type="submit" value="提交" onclick="return Submit1_onclick()" /></td>
<td style="width: 280px">
</td>
</tr>
</table>
</center>
</form>
这个是ASPX页里的,
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String userName = Request["txtUserName"].ToString();
String userPwd = Request["txtUserPwd"].ToString();
//string userName=Request.Form.Get("txtUsername").ToString();
//string userPwd=Request.Form.Get("txtUserPwd").ToString();
Response.Write("登陆的用户名为" + userName + ";密码为" + userPwd);
}
protected void Text1_ServerChange(object sender, EventArgs e)
{
}
}
现在运行调试的时候就会出现 用户代码未处理NullRefrenceExpretion是什么意思? 没将引用对象设置到对象实力 指的是这句:String userName = Request["txtUserName"].ToString();
不大明白什么意思,谢谢大家帮忙下!
解决方案 »
- 请问我的dropdownlist怎么加载不上去???
- 时不时出现-object reference not set to an instance of an boject,
- 代码模式如何自动生成onclick?
- 请问网站怎么实现中英文转换?
- 问一个比较菜的问题:VS2008罗列最近的项目,能删掉吗!
- GridView控件的使用问题
- gridview中嵌入checkbox无法取得check的值!
- 高分 求asp.net薪资计算公式编辑器 分不够可再加
- 如何在鼠标滑过表格行时,高亮显示滑过的那一行(多行多列的表格)?
- DataGrid的页眉问题:DataGrid页眉的第一行有一个 CheckBox全选按钮,实现全选功能。
- 网页MediaPlayer音乐播放器,如何实现多个选择连续播放??????
- 比较简单的一个问题
if(Request["txtUserName"] != null)
{
String userName = Request["txtUserName"].ToString();
}
{
String userName = Request["txtUserName"].ToString();
String userPwd = Request["txtUserPwd"].ToString();
//string userName=Request.Form.Get("txtUsername").ToString();
//string userPwd=Request.Form.Get("txtUserPwd").ToString();
Response.Write("登陆的用户名为" + userName + ";密码为" + userPwd);}
各位大虾帮看看啊!
对了 是不是VS2005和VS2003有区别啊 我是在VS2005上运行的!