我想用if else endif  做一个页面定向,页面上是一个登录介面,当用户名是“ADMIN”,密码是“123”时,定向到一个页面,其它的都定向到另一个页面,
我前面写好的程序是<table border=0><tr>
<td>用户名:</td>
<td><input type="text" name="LoginName" size="20" maxlength="20"></td>
</tr>
<tr>
     <td>密&nbsp;&nbsp;码:</td>
     <td><input type="Password" name="Password" size="20" maxlength="20"></td>
</tr>
<td align="center" colspan="2"><input type="submit" name="Submit" value="用户登录"></td>
</tr>
                                                   </table>
</form>

解决方案 »

  1.   

    那你就可以在Page_load世间中来处理呀。例如:
    if(userName == "ADMIN")
    {
       Response.write("<script>windows.location = "Page1.aspx"</script>")
    }
    else
    {
      Response.write("<script>windows.location = "Page2.aspx"</script>")}或者if(userName == "ADMIN")
    {
      response.redirect("Page1.aspx");}
    else
    {
     response.redirect("Page2.aspx");