关于form验证的问题???
web.config
<authentication mode= "Forms ">
<forms loginUrl= "Default.aspx " name= ".ASPXUSER "/>
</authentication>
<authorization>
<deny users= "? "/>
</authorization>
default.aspx中
//----
string strconn = ConfigurationManager.ConnectionStrings[ "js "].ConnectionString;
string ls_sql = "select * from sysuser where user_name=:user_name and user_password=:user_password ";
OracleConnection cn = new OracleConnection(strconn);
cn.Open();
OracleCommand cmd = new OracleCommand(ls_sql,cn);
cmd.Parameters.Add( ":user_name ", OracleType.VarChar, 20);
cmd.Parameters[ ":user_name "].Value = ls_name;
cmd.Parameters.Add( ":user_password ", OracleType.VarChar, 8);
cmd.Parameters[ ":user_password "].Value = ls_pass;
OracleDataReader dr = cmd.ExecuteReader();
if (!dr.Read())
{
Label_mess.Text = "用户名和口令错误 ";
return;
}
Response.Redirect( "procedure.aspx ");
验证通过,为什么不跳转到procedure.aspx (文件肯定在)
一直是http://127.0.0.1/vs2005_oracle/Default.aspx?ReturnUrl=%2fvs2005_oracle%2fprocedure.aspx
------解决方案--------------------当然,如果你一定要用Response.Redirect()
那验证通过了以后就这样写
System.Web.Security.FormsAuthentication.SetAuthCookie(this.Txt_UserName.Text,false);
Response.Redirect( "procedure.aspx ");
------解决方案-------------------- <forms loginUrl= "Default.aspx " defaultUrl= "procedure.aspx "/>
defaultUrl里面才是验证成功后要导向的页面