国产探花免费观看_亚洲丰满少妇自慰呻吟_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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 上思县| 土默特右旗| 高州市| 章丘市| 海宁市| 天峻县| 长泰县| 荔波县| 固安县| 东台市| 永泰县| 赤水市| 曲阳县| 闵行区| 济宁市| 双峰县| 合阳县| 慈溪市| 闵行区| 海城市| 苏州市| 禄丰县| 蓝山县| 定安县| 财经| 司法| 大新县| 满城县| 无为县| 平罗县| 临朐县| 宁陵县| 边坝县| 开化县| 浮山县| 威宁| 临高县| 合肥市| 泗阳县| 青田县| 尉氏县|