首 页 | 精品电影 | 音乐天堂 | 在线游戏 | Flash MTV | 三湘书屋 | 幽默笑话 | 三湘图库 | 美女写真 | IT知识库 | QQ贴图 | 加入书签

网页制作网络编程图形图象操作系统冲浪宝典软件教学网络安全认证考试通信技术电子商务业内动态书籍教程原码

最近更新 文章分类 多媒体类 精品软件

本站搜索:
您的位置:三湘时空 -> IT知识库 -> 文章分类 -> ASP教程 -> NET移植案例学习:建造Web站点(6)  
NET移植案例学习:建造Web站点(6)


文章类别:ASP教程 来源: 作者: 发表日期:2005-10-4 字体:[ ]

小游戏 | 在线影院 | 幽默笑话 | 源码下载 | Flash MTV | 音乐试听 | 书屋 | 美女写真

  图3 Config.web文件

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

 <!-- SECURITY
  This section sets the security policies of the application.
  Possible modes are "Windows", "Cookie",
  "Passport" and "None"
 -->

 <!-- Use Cookie Authentication for external users -->


 <security>
  <authentication mode="Cookie">
   <cookie cookie=".PRODAUTH" loginurl="https://
     beta.visualstudio.net/Login.aspx"
    decryptionkey="autogenerate">

    <credentials passwordformat="Clear" />
   </cookie>
  </authentication>
  <authorization>
   <allow users="*" />
  </authorization>
 </security>
</configuration>


  图4 认证代码

Public Sub cmdSubmit_Click(ByVal sender As Object, ByVal e As _
System.EventArgs)
 Dim sUserID As String
 Dim sPassword As String
 Dim sAuthCookie As String

 'External user, take the values from the Login form
 sUserid = system.Convert.ToString(Me.txtUserID.Value)
 sPassword = system.Convert.ToString(Me.txtPassword.Value)

 adoRS = oBetaUser.LoginEx(sUserID, sPassword)

 If adoRS.recordcount = 1 Then
  'login success - get a session
  adoRS = osSession.GetNewSession _
    (adoRS("BetaSiteID").Value.ToString().ToInt32())

  If Not adoRS Is Nothing Then
   If adoRS.Recordcount > 0 Then
    adoRS.movefirst()

    'Set the authentication cookie using the SID
    sAuthCookie = adoRS("SID").Value.ToString()

    'use ASP+ authentication to authenticate the user,
    If Instr(CookieAuthentication.GetRedirectUrl _
       (sAuthCookie, True), "default.aspx") > 0 Then
     CookieAuthentication.SetAuthCookie(sAuthCookie, True)
     Response.Redirect(system.Convert.ToString( _
              oSiteUser.GlobalPath) & "Home.aspx")
    Else
     CookieAuthentication.RedirectFromLoginPage( _
                   sAuthCookie, True)
    End If
   Else
    'login failed
    Response.Redirect("LoginFailed.aspx")
   End If
  Else
   'login failed
   Response.Redirect("LoginFailed.aspx")
  End If
 Else
  'login failed
  Response.Redirect("LoginFailed.aspx")
 End If
End Sub

上一篇:NET移植案例学习:建造Web站点(5) 下一篇:NET移植案例学习:建造Web站点(7)
本栏目热门文章
·ASP进阶学习必经之认识数学函数11种 2005-10-4
·十天学会ASP之第一天 2005-10-4
·初学者必读 ASP运行环境的搭建 2005-10-4
·初看ASP-针对初学者 2005-10-4
·十天学会ASP之第九天 2005-10-4
·十天学会ASP之第二天 2005-10-4
·十天学会ASP之第十天 2005-10-4
·解析asp的脚本语言 2005-10-4
·十天学会ASP之第五天 2005-10-4
·十天学会ASP之第四天 2005-10-4
新近更新文章
·ASP进阶学习必经之认识数学函数11种 2005-10-4
·初学者必读 ASP运行环境的搭建 2005-10-4
·初看ASP-针对初学者 2005-10-4
·解析asp的脚本语言 2005-10-4
·学习使用ASP对象和组件 2005-10-4
·通过启动脚本来感受ASP的力量 2005-10-4
·在ASP中使用数据库 2005-10-4
·使用ASP脚本技术 2005-10-4
·浅析ASP内置组件 2005-10-4
·ASP开发10条经验总结 2005-10-4
首 页 | 软件发布 | 广告联系 | 下载帮助 | 意见反馈 | 网站地图
  CopyRight? 2002-2004 WWW.SXSKY.NET? All Rights Reserved
三湘时空 站长QQ:82675303 Email: