欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
DotNetNuke與MemberShip的結合 -- 博客園
DotNetNuke與MemberShip的結合
Posted on 2006-07-13 15:05二十四畫(huà)生 閱讀(3015)評論(4)  編輯  收藏 所屬分類(lèi):DotNetNuke(DNN)
DotNetNuke(以下簡(jiǎn)稱(chēng)DNN)采用與MemberShip結合的方式實(shí)現身份驗證功能。DNN4.3.x和DNN3.3.x版本相對于以前版本對用戶(hù)部分進(jìn)行了很大的改進(jìn)。具體結合MemberShip實(shí)現身份認證,從數據庫上分析如下:
關(guān)系圖如下:
相關(guān)表含義:
aspnet_Users:用戶(hù)信息表
字段名稱(chēng)
含義
類(lèi)型
備注
ApplicationId
應用程序ID
Uniqueidentifier
UserId
用戶(hù)ID
Uniqueidentifier
Username
用戶(hù)名
Nvarchar(256)
LoweredUserName
Nvarchar(256)
LastName
Nvarchar(50)
MobileAlias
Nvarchar(16)
IsAnonymous
Bit
LastActivityDate
Datetime
aspnet_Membership:成員信息表
字段名稱(chēng)
含義
類(lèi)型
備注
ApplicationId
應用程序ID
Uniqueidentifier
UserId
用戶(hù)ID
Uniqueidentifier
Password
密碼
Nvarchar(128)
PasswordFormat
密碼加密方式
Int
PasswordSalt
密碼散列
Nvarchar(128)
----------------
其余的字段關(guān)系不大,主要是結合Membership功能的
-----------------
Users:DNN用戶(hù)表
字段名稱(chēng)
含義
類(lèi)型
備注
UserID
用戶(hù)ID
Int
Username
用戶(hù)名
Nvarchar(100)
FirstName
Nvarchar(50)
LastName
Nvarchar(50)
IsSuperUser
是否是超級用戶(hù)
Bit
AffiliateId
聯(lián)盟商ID
Int
會(huì )員介紹人ID
Email
電子郵件地址
Nvarchar(256)
DisplayName
昵稱(chēng)
Nvarchar(128)
UpdatePassword
是否要求用戶(hù)定期更新密碼
Bit
UserProfile:用戶(hù)資料表(存儲用戶(hù)詳細資料,如:地址信息,聯(lián)系方式等)
字段名稱(chēng)
含義
類(lèi)型
備注
ProfileID
用戶(hù)資料ID
Int
UserID
用戶(hù)ID
Int
PropertyDefinitionID
用戶(hù)資料信息定義ID
Int
PropertyValue
用戶(hù)資料信息值
Nvarchar(3750)
PropertyText
---------
Visibility
可見(jiàn)性
Int
0:公開(kāi);1:保密;2:管理員可見(jiàn)
LastUpdatedDate
最后更新時(shí)間
Datetime
ProfilePropertyDefinition:個(gè)人資料屬性定義
字段名稱(chēng)
含義
類(lèi)型
備注
PropertyDefinitionID
個(gè)人資料屬性定義ID
Int
PortalID
站點(diǎn)ID
Int
ModuleDefID
模塊定義ID
Int
指定該屬性可以屬于一個(gè)的制定的模塊,不指定值為-1
Deleted
是否刪除
Bit
DataType
數據類(lèi)型
Int
DefaultValue
默認值
Nvarchar(50)
PropertyCategory
屬性分類(lèi)
Nvarchar(50)
PropertyName
屬性名稱(chēng)
Nvarchar(50)
Length
屬性值長(cháng)度
Int
Required
是否必添
Bit
ValidationExpression
驗證規則
Nvarchar(100)
ViewOrder
排序號
Int
Visible
是否可見(jiàn)
Bit
DotNetNuke與MemberShip的結合(五年版)
Posted on 2007-08-13 21:01五年 閱讀(1597)評論(3)  編輯  收藏 所屬分類(lèi):DotNetNuke
24畫(huà)生有一篇同名文章(http://www.cnblogs.com/esshs/archive/2006/07/13/449888.html),但他只是列一下數據庫表與字段,并沒(méi)有展開(kāi)講述.
下面我以DNN4.5.5為源碼版本站在24畫(huà)生的肩旁上再展開(kāi)講述.
由上面三圖可見(jiàn),DNN系統設計中的MemberShip是完全獨立于DNN其他表的,那么能不能將整個(gè)MemberShip獨立放一個(gè)表中,或直接使用已經(jīng)存在的MemberShip表?由于上面的表是相對獨立的,沒(méi)有直接關(guān)系,所以理論上是可以的.實(shí)際上可以嗎?做個(gè)實(shí)驗.
在web.config中增加一個(gè)數據連接字符串.SiteSqlServer1,并且指向已經(jīng)存在的MemberShip數據庫ASPNETDB,其中DNN4_5_5是空數據庫,即DNN并未安裝,ASPNETDB是一個(gè)現存系統的MemberShip數據庫.
<connectionStrings>
<!-- Connection String for SQL Server 2005 Express
<add
name="SiteSqlServer"
connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;"
providerName="System.Data.SqlClient" />
-->
<!-- Connection String for SQL Server 2000/2005 -->
<add name="SiteSqlServer" connectionString="Data Source=(local);Initial Catalog=DNN4_5_5;User ID=sa;Password=" providerName="System.Data.SqlClient" />
<add name="SiteSqlServer1" connectionString="Data Source=(local);Initial Catalog=ASPNETDB;User ID=sa;Password=" providerName="System.Data.SqlClient" />
</connectionStrings>
將AspNetSqlMembershipProvider的配置connectionStringName="SiteSqlServer"改成 connectionStringName="SiteSqlServer1"如下.
<membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<!-- Configuration for DNNSQLMembershipProvider:
connectionStringName="string"               Name corresponding to the entry in <connectionStrings> section where the connection string for the provider is specified
passwordAttemptThreshold="int"              The number of failed password attempts, or failed password answer attempts that are allowed before locking out a user?s account
passwordAttemptWindow="int"                 The time window, in minutes, during which failed password attempts and failed password answer attempts are tracked
enablePasswordRetrieval="[true|false]"      Should the provider support password retrievals
enablePasswordReset="[true|false]"          Should the provider support password resets
requiresQuestionAndAnswer="[true|false]"    Should the provider require Q & A
minRequiredPasswordLength="int"                  The minimum password length
minRequiredNonalphanumericCharacters="int"  The minimum number of non-alphanumeric characters
applicationName="string"                    Optional string to identity the application: defaults to Application Metabase path
requiresUniqueEmail="[true|false]"          Should the provider require a unique email to be specified
passwordFormat="[Clear|Hashed|Encrypted]"   Storage format for the password: Hashed (SHA1), Clear or Encrypted (Triple-DES)
description="string"                        Description of what the provider does
-->
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="SiteSqlServer1" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="false" passwordFormat="Encrypted" applicationName="/" description="Stores and retrieves membership data from the local Microsoft SQL Server database" />
</providers>
</membership>
這樣運行的結果是:
DNN成功安裝,DNN4_5_5數據庫中有MemberShip的所有表,但是里面全為空,host,admin的賬號在A(yíng)SPNETDB的MemberShip表中,用host,admin賬號登錄成功.DNN運行一切正常.
這面意味著(zhù):DNN可以很方便地與其他同樣以MemberShip為身份驗證的系統整合.
再分析相關(guān)代碼:
舉例: 刪除用戶(hù)方法
Public Overrides Function DeleteUser(ByVal user As UserInfo) As Boolean
Dim retValue As Boolean = True
Dim dr As IDataReader
Try
dr = dataProvider.GetRolesByUser(user.UserID, user.PortalID)
While dr.Read
dataProvider.DeleteUserRole(user.UserID, Convert.ToInt32(dr("RoleId")))
End While
dr.Close()
‘check if user exists in any other portal
dr = dataProvider.GetUserByUsername(-1, user.Username)
dr.Read()
If Not dr.Read Then
dataProvider.DeleteUser(user.UserID) ‘ 刪除dnn_User表中的用戶(hù)記錄
‘Delete AspNet MemrshipUser
retValue = DeleteMembershipUser(user)  ‘刪除Membership表中的用戶(hù)記錄(至于Membership相關(guān)表在哪里,在這里是透明的,DNN并不在意他在哪里.)
Else
dataProvider.DeleteUserPortal(user.UserID, user.PortalID)
End If
dr.Close()
Catch ex As Exception
retValue = False
End Try
Return retValue
End Function
Private Function DeleteMembershipUser(ByVal user As UserInfo) As Boolean
Dim retValue As Boolean = True
Try
‘刪除Membership表中的用戶(hù)記錄(至于Membership相關(guān)表在哪里,在這里是透明的,DNN并不在意他在哪里.)
AspNetSecurity.Membership.DeleteUser(user.Username, True)
Catch ex As Exception
retValue = False
End Try
Return retValue
End Function
我比較喜歡這樣的設計,因為這樣,不管多少系統,只要基于MemberShip就可以很方便地整合在一起.實(shí)現單點(diǎn)登陸.
本文發(fā)布于:http://shiningrise.cnblogs.com轉載請保留此簽名.
添加membership用戶(hù)到DNN數據庫
Posted on 2007-08-22 00:47五年 閱讀(1241)評論(4)  編輯  收藏 所屬分類(lèi):DotNetNuke
在我的 <<DotNetNuke與MemberShip的結合(五年版)>>中提出將DNN的身份認證指出現在的membership數據庫.而且,admin,host用戶(hù)可以正常登錄.但我們用membership數據庫中現在有的用戶(hù)登錄,就會(huì )發(fā)現不能成功登錄.
看相關(guān)源碼:Provider.Membership.AspNetProvider(AspNetMembershipProvider.vb)
Public Overrides Function UserLogin(ByVal portalId As Integer, ByVal username As String, ByVal password As String, ByVal verificationCode As String, ByRef loginStatus As UserLoginStatus) As UserInfo
‘For now, we are going to ignore the possibility that the User may exist in the
‘Global Data Store but not in the Local DataStore ie. A shared Global Data Store
‘Initialise Login Status to Failure
loginStatus = UserLoginStatus.LOGIN_FAILURE
‘Get a light-weight (unhydrated) DNN User from the Database, we will hydrate it later if neccessary
Dim user As UserInfo = Nothing
user = GetUserByUserName(portalId, username, False)
If Not user Is Nothing Then
‘Get AspNet MembershipUser
Dim aspnetUser As AspNetSecurity.MembershipUser = Nothing
aspnetUser = GetMembershipUser(user)
‘Fill Membership Property from AspNet MembershipUser
FillUserMembership(aspnetUser, user)
‘Check if the User is Locked Out (and unlock if AutoUnlock has expired)
If aspnetUser.IsLockedOut Then
Dim intTimeout As Integer = Null.NullInteger
If Not HostSettings("AutoAccountUnlockDuration") Is Nothing Then
Dim strTimeout As String = Convert.ToString(HostSettings("AutoAccountUnlockDuration"))
If Not String.IsNullOrEmpty(strTimeout) Then
intTimeout = Convert.ToInt32(strTimeout)
End If
End If
If intTimeout <> 0 Then
If intTimeout = Null.NullInteger Then
intTimeout = 10
End If
If aspnetUser.LastLockoutDate < Date.Now.AddMinutes(-1 * intTimeout) Then
‘Unlock User
user.Membership.LockedOut = False
‘Persist to Data Store
aspnetUser.UnlockUser()
Else
loginStatus = UserLoginStatus.LOGIN_USERLOCKEDOUT
End If
End If
End If
‘Check in a verified situation whether the user is Approved
If user.Membership.Approved = False And user.IsSuperUser = False Then
‘Check Verification code
If verificationCode = (portalId.ToString & "-" & user.UserID) Then
‘Approve User
user.Membership.Approved = True
‘Persist to Data Store
UpdateUser(user)
Else
loginStatus = UserLoginStatus.LOGIN_USERNOTAPPROVED
End If
End If
‘Verify User Credentials
Dim bValid As Boolean = False
If loginStatus <> UserLoginStatus.LOGIN_USERLOCKEDOUT And loginStatus <> UserLoginStatus.LOGIN_USERNOTAPPROVED Then
If user.IsSuperUser Then
If ValidateUser(Null.NullInteger, username, password) Then
loginStatus = UserLoginStatus.LOGIN_SUPERUSER
bValid = True
End If
Else
If ValidateUser(portalId, username, password) Then
loginStatus = UserLoginStatus.LOGIN_SUCCESS
bValid = True
End If
End If
End If
If Not bValid Then
‘Clear the user object
user = Nothing
End If
End If
Return user
End Function
其中有三句關(guān)鍵
Dim user As UserInfo = Nothing
user = GetUserByUserName(portalId, username, False)
If Not user Is Nothing Then
意思就是,要先讀取DNN用戶(hù)數據表中的用戶(hù)即dnn_Users中的用戶(hù).而以<<DotNetNuke與MemberShip的結合(五年版)>>辦法安裝的DNN數據庫,在membership中原有的用戶(hù),在dnn_Users中卻并不存在相應的用戶(hù),所以出現用membership中原有的用戶(hù)無(wú)法登錄DNN.
我作了下面修正,讓登錄DNN的用戶(hù)如果只存在于membership中而不存在于dnn_Users中的數據自動(dòng)添加.
改到處關(guān)鍵原碼
Public Overrides Function UserLogin(ByVal portalId As Integer, ByVal username As String, ByVal password As String, ByVal verificationCode As String, ByRef loginStatus As UserLoginStatus) As UserInfo
‘For now, we are going to ignore the possibility that the User may exist in the
‘Global Data Store but not in the Local DataStore ie. A shared Global Data Store
‘Initialise Login Status to Failure
loginStatus = UserLoginStatus.LOGIN_FAILURE
‘Get AspNet MembershipUser
Dim aspnetUser As AspNetSecurity.MembershipUser = Nothing
aspnetUser = GetMembershipUser(username)
If aspnetUser Is Nothing Then
Return Nothing
End If
‘Get a light-weight (unhydrated) DNN User from the Database, we will hydrate it later if neccessary
Dim user As UserInfo = Nothing
user = GetUserByUserName(portalId, username, False)
If (user Is Nothing) Then
按照一個(gè)AspNetMembershipProvider新建一個(gè)項目
Public Class AspNetMembershipProviderFiveYears
Inherits DotNetNuke.Security.Membership.MembershipProvider
改web.config增加一個(gè)AspNetMembershipProvider,并設置為defaultProvider
<members defaultProvider="AspNetMembershipProviderFiveYears">
<providers>
<clear />
<add name="AspNetMembershipProvider" type="DotNetNuke.Security.Membership.AspNetMembershipProvider, DotNetNuke.Provider.AspNetProvider" providerPath="~\Providers\MembershipProviders\AspNetMembershipProvider\" />
<add name="AspNetMembershipProviderFiveYears" type="DotNetNuke.Security.Membership.AspNetMembershipProviderFiveYears, DotNetNuke.Provider.AspNetProviderFiveYears" providerPath="~\Providers\MembershipProviders\AspNetMembershipProviderFiveYears\" />
</providers>
</members>
源碼下載:點(diǎn)擊下載
相關(guān)文章: <<DotNetNuke與MemberShip的結合(五年版)>>
http://www.cnblogs.com/shiningrise/archive/2007/08/13/854297.html
本文發(fā)布于:http://shiningrise.cnblogs.com轉載請保留此簽名.
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
DNN系統構架圖 - m2land-專(zhuān)注DNN(DotNetNuke) - 博客園
我的未來(lái)學(xué)習方向
掌握 asp.net 之路:自定義實(shí)體類(lèi)簡(jiǎn)介
使用membership(System.Web.Security)來(lái)進(jìn)行角色與權_2009...
DNN模塊開(kāi)發(fā)系列文章(2)——建立模塊開(kāi)發(fā)項目
搭建基于A(yíng)SP.NET 2.0的DNN 4.X模塊開(kāi)發(fā)環(huán)境及模塊實(shí)例
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久