如下代码:
private void Button1_Click(object sender, System.EventArgs e)
{
StuInfo student = new StuInfo();
student.stuID = this.TextBox1.Text;
student.stuPassword = this.TextBox2.Text;
DataSet thisSet = new DataSet();
thisSet = student.Volidate();
student.Volidate();
try
{
if(Convert.ToInt32(thisSet.Tables[0].Rows[0][0]) == Convert.ToInt32(student.stuID)
&& Convert.ToInt32(thisSet.Tables[0].Rows[0][1]) == Convert.ToInt32(student.stuPassword))
{
Session["StuID"]=this.TextBox1.Text;
Session["StuPassword"] = student.stuPassword;
Response.Redirect("volidgood.aspx");
// Request.QueryString["uid"];
}
// Response.Redirect("volidbad.aspx");
}
catch(Exception ex)
{
Response.Redirect("volidgood.aspx");
}
finally
{
Response.Redirect("volidbad.aspx");
}
}
在这个位置。我如果不加try。。catch的话。输入的数据能正确跳转。如过输入的数据是错误的加上else的话数据会报错。所以我加上了try但是加上之后我再次输入正确的数据的话。异常也会抛出。怎么回事啊?希望能求解!!
private void Button1_Click(object sender, System.EventArgs e)
{
StuInfo student = new StuInfo();
student.stuID = this.TextBox1.Text;
student.stuPassword = this.TextBox2.Text;
DataSet thisSet = new DataSet();
thisSet = student.Volidate();
student.Volidate();
try
{
if(Convert.ToInt32(thisSet.Tables[0].Rows[0][0]) == Convert.ToInt32(student.stuID)
&& Convert.ToInt32(thisSet.Tables[0].Rows[0][1]) == Convert.ToInt32(student.stuPassword))
{
Session["StuID"]=this.TextBox1.Text;
Session["StuPassword"] = student.stuPassword;
Response.Redirect("volidgood.aspx");
// Request.QueryString["uid"];
}
// Response.Redirect("volidbad.aspx");
}
catch(Exception ex)
{
Response.Redirect("volidgood.aspx");
}
finally
{
Response.Redirect("volidbad.aspx");
}
}
在这个位置。我如果不加try。。catch的话。输入的数据能正确跳转。如过输入的数据是错误的加上else的话数据会报错。所以我加上了try但是加上之后我再次输入正确的数据的话。异常也会抛出。怎么回事啊?希望能求解!!
解决方案 »
- 引用图片过宽导致网页被撑坏……
- 如何判断客户端使用什么浏览器
- 如何让事件生效?
- 有没有能够修改DLL文件的方法!高手回答啊!
- 这段程序有点问题 帮忙解决下 谢谢
- 询问在ASP.net中,如何使用xmlhttp获取网页源码
- 我不懂.net,我运行了别人写好的程序,.aspx的,出现这样的错误提示,请大家帮我看看.
- 请问如何回发后如何把客户端的HTML button变灰(不可用)
- 又是datagrid,怎么办啊???
- 为什么在DataGrid的EditItemTemplate中的DropDownList控件显示System.Collections.DictionaryEntry。怎样才行?
- 问一个关于上传的问题
- javascript 如何读数据岛里的内容?
把Session放后面的话。另一张页面得不到值啊??
该怎么办。。谢谢各位说下!!