日期:2014-05-19  浏览次数:20760 次

C#中如何做到登录失败后跳转到错误提示界面,而登陆成功后可以进入相应用户名的界面
<%@   Page   Language= "C# "   ContentType= "text/html "   ResponseEncoding= "gb2312 "   %>
<%@import   namespace= "System.Web.Security "%>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<script   language= "C# "   runat=server>
void   login(object   serder,EventArgs   e)
{
if(FormsAuthentication.Authenticate(txtuserid.Text,txtuserpsw.Text))
      FormsAuthentication.RedirectFromLoginPage(txtuserid.Text,true);
else
      Response.Redirect( "inputerror.aspx ");
}
</script>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 无标题文档 </title>
<script   language= "JavaScript "   type= "text/JavaScript ">
<!--


function   MM_reloadPage(init)   {     //reloads   the   window   if   Nav4   resized
    if   (init==true)   with   (navigator)   {if   ((appName== "Netscape ")&&(parseInt(appVersion)==4))   {
        document.MM_pgW=innerWidth;   document.MM_pgH=innerHeight;   onresize=MM_reloadPage;   }}
    else   if   (innerWidth!=document.MM_pgW   ||   innerHeight!=document.MM_pgH)   location.reload();
}
MM_reloadPage(true);

function   MM_preloadImages()   {   //v3.0
    var   d=document;   if(d.images){   if(!d.MM_p)   d.MM_p=new   Array();
        var   i,j=d.MM_p.length,a=MM_preloadImages.arguments;   for(i=0;   i <a.length;   i++)
        if   (a[i].indexOf( "# ")!=0){   d.MM_p[j]=new   Image;   d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<style   type= "text/css ">
<!--
.style2   {
font-family:   "宋体-方正超大字符集 ";
font-size:   18px;
font-weight:   bold;
}
-->
</style> </head>
<body>
<div   id= "Layer1 "   style= "position:absolute;   width:567px;   height:426px;   z-index:1;   left:   140px;   top:   26px; ">
    <div   align= "center ">
        <p> <img   src= "&#30331;&#38470;&#30028;&#38754;.jpg "   width= "600 "   height= "400 "> </p>
        <div   id= "Layer2 "   style= "position:absolute;   width:455px;   height:138px;   z-index:2;   left:   143px;   top:   248px; ">
            <div   align= "left ">
                <form   action= " "   method= "post "   name= "form1 "   class= "style2 "   runat= "server ">
                    用户名