.net 专家

住在上海

导航

动网代码备忘录

loginpassport.asp


Function Main()   // 返回登陆表单

 Dvbbs_ChkLogin   // 自动提交登陆信息
        Dvbbs.Showerr()  //返回错误页面

login.asp
redirect loginpassport.aspx

loginpassport.aspx
private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   if (Request["TxtName"]!=null && Request["TxtPwd"]!=null)
   {
    //Hydl();
   
    string url = null;
   
     if(Request.QueryString["b64ReturnUrl"] != null)
     {
      url = WebHelper.FromBase64(Request.QueryString["b64ReturnUrl"]);       
     }
     else if(Request.QueryString["ReturnUrl"] != null)
     {
      url = Request.QueryString["ReturnUrl"];       
     }

     if (url == null)
      Response.Redirect(string.Format("loginbbs.aspx?rand={0}", Guid.NewGuid()));
     else
      Response.Redirect(string.Format("loginbbs.aspx?rand={0}&ReturnUrl={1}", Guid.NewGuid(), System.Web.HttpUtility.UrlEncode(url)));
     
   }

  }
指向 loginbbs.aspx

loginbbs.aspx html
 

loginbbs.aspx.cs
private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   // Put user code to initialize the page here
   if (!IsPostBack)
   {
    try
    {
     
     Framework.Util.PassportHelper.SignInBBS("bobo");
    }
    catch
    {

    }
   }
  }

生成的登陆代码


<script>var _firstTime=true;function bbsLogin(e){if(_firstTime){e.src = 'http://localhost/bbs/loginPassport.asp?Login=bobo&username=bobo&signMsg=ca2cd2bcc63c4d7c8725577442073dde&chk=true';_firstTime=false; }}</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
 <head>
  <title>正在登陆论坛</title>
  <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
  <meta name="CODE_LANGUAGE" content="C#">
  <meta name="vs_defaultClientScript" content="JavaScript">
  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
  <link href="styles/site_style.css" rel="stylesheet" type="text/css">
  <script src="scripts/site_script.js"></script>
 </head>
 <body ms_positioning="GridLayout" bgcolor="#f0f0f0">
    <form name="Form1" method="post" action="loginbbs.aspx?rand=e4cd30f9-41d0-4277-a3d3-d56d07338c0e&amp;ReturnUrl=http%3a%2f%2flocalhost%2fbbs%2findex.asp" id="Form1">
<input type="hidden" name="__VIEWSTATE" value="dDwtMTUxNTE0ODA3Mzs7PnX6jWfCoS5ggFotDSbqjpK6svPE" />

  登录成功,转入系统,请稍候......
  
  <script>
   var dlg;
   var count = 0;
   var intervalID;
   
   function OnReadyStateChange()
   { 
    if (frm.readyState=="loading")
    {
     count++;
     if (count == 2)
     {
      location.href = "http://localhost/bbs/index.asp"
     }
    }
   }
   
   function OnCheckReady()
   {
    location.href = "http://localhost/bbs/index.asp"
   }
  </script>
  <iframe id="_hiddenFrame" style="display:none" onreadystatechange="OnReadyStateChange()" onload="if(window.bbsLogin != null)window.bbsLogin(this)"></iframe>
     </form>
  <script>
   
   var frm = document.getElementById("_hiddenFrame");
   
   if (window.navigator.appName == "Netscape")
   {
    intervalID = window.setTimeout("OnCheckReady()", 8000);
   }
  </script></body>
</html>

 

posted on 2006-07-03 01:50  bobomail  阅读(677)  评论(4编辑  收藏  举报