[英]SharePoint 2007: Use SqlProfileProvider with Windows Integrated Authentication?
我試圖弄清楚是否可以使用SqlProfileProvider(aspnetdb)為通過Windows Integrated Authentication驗證到SharePoint 2007網站的用戶存儲某些配置文件信息。 目標是能夠開發ASP.NET代碼,該代碼為每個用戶存儲一些個性化字符串,並將在ASP.NET或SharePoint網站中運行。 我希望可以使用SqlProfileProvider,然后將它提供給ASP.NET或SharePoint,只要我向web.config中添加了正確的提供程序即可。
這是我在SharePoint Web應用程序的web.config中擁有的內容,但是在ASP.X的Context.Profile背后的代碼中始終為null:
<profile automaticSaveEnabled="true" defaultProvider="AspNetSqlProfileProvider">
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
connectionStringName="aspnetdb"
applicationName="simple_test"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
<properties>
<add name="TestName" type="System.String" allowAnonymous="false"/>
</properties>
(請注意,aspnetdb是web.config中其他位置的有效連接字符串)。
任何人都具有將aspnetdb Profile提供程序與Windows身份驗證結合使用的經驗,或者只有在窗體/成員身份驗證有效的情況下才有效? 關於如何在不使用Cookie或從頭開始編寫數據模型和訪問層的情況下將用戶設置保存在ASP.NET/SharePoint中的其他建議?
經過更多的搜索和原型制作后,由於有了MSDN Forum的帖子,我才設法找到了解決方案。 SharePoint刪除了ASP.NET配置文件模塊,因此您必須將其重新添加到Web.config httpModules部分中:
<add name="Profile" type="System.Web.Profile.ProfileModule" />
訪問web.config中定義的Profile屬性還需要一些變通辦法,這樣就不會出現編譯時錯誤。 您可以按照Becky的帖子所述為基於表單的身份驗證開發自定義Provider,也可以調用Profile.GetPropertyValue和Profile.SetPropertyValue來獲取和設置當前用戶的配置文件值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.