国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

NET移植案例學習:建造Web站點(6)

2019-11-18 20:33:34
字體:
來源:轉載
供稿:網友
  圖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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 湘乡市| 富裕县| 浦东新区| 邵东县| 乌什县| 东丽区| 阆中市| 民县| 道真| 东海县| 应城市| 蛟河市| 屏南县| 阳山县| 柳州市| 渝中区| 确山县| 襄汾县| 禹城市| 吉林市| 浮山县| 临桂县| 大丰市| 嘉荫县| 巴楚县| 长丰县| 凤庆县| 卢龙县| 石楼县| 湖口县| 谷城县| 诸城市| 永济市| 新平| 克山县| 麦盖提县| 安化县| 纳雍县| 保亭| 壶关县| 新建县|