<html>
<head>
<title>重定向浏览器示例</title>
<script Language="c#" runat="server">
private void btnOK_Click(object sender, System.EventArgs e){
if (Page.IsValid){
	if (Text1.Text=="ok")
	{
	 	Response.Redirect("http://www.whpu.edu.cn");
	}
	else
	{
		lblMsg.Text="用户名不对!";
	}
}
}

</Script>
</Html>
</head>
<body>
   <h3>重定向浏览器示例</h3>
   <form runat="server">
  <table border=0 width=250>
 <tr><td>
   用户名: 
</td><td>
      <asp:TextBox id="Text1" runat="server"/>
</td><td>
      <asp:RequiredFieldValidator id="RequiredFieldValidator1"  
           ControlToValidate="Text1"
         ErrorMessage="用户名、"
           Text="＊" 
           runat="server"/><br>
</td></tr>
</table>
      <asp:Button id="Button1" 
           runat="server" 
           Text="提交"
OnClick="btnOK_Click"/>
<ASP:Label Id="lblMsg" Runat="Server"/>
   </form>
</body>
</html>
