![](/img/trans.png)
[英]newbie to ASP.NET need help configuring wsaspnet websockets server
[英]I need help configuring ASP.net Profiles
我正在嘗試使用ASP.net配置文件,我已經按照一些說明進行操作,這意味着我已經
但是我似乎無法使用類似的代碼(即Intellisense不喜歡它)
Profile.UserCustomContent = "Hi Mom";
很明顯,我錯過了一些重要的事情,但是我看不到,請幫助我...
這是我的web.config
中的一些片段
<connectionStrings>
<add name="SqlServices"
connectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalogue=aspnetdb" />
</connectionStrings>
<system.web>
<authentication mode="Windows" />
<authorization>
<deny users="?"/>
</authorization>
<profile enabled="true" defaultProvider="SqlServices">
<providers>
<clear/>
<add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider"
connectionStringName="SqlServices" applicationName="MyInternalApplication" />
</providers>
<properties>
<add name="UserSearchFilterOptions" type="String" />
<add name="UserCustomContent" type="String"/>
</properties>
</profile>
</system.web>
添加配置文件后,您將其稱為SqlProvider而不是SqlServices。 (您在上面使用的默認配置文件提供程序名稱)
這就是我的做法。.也許您的情況有另一種方法。
VB-新用戶。(正確是IsAuthenticated的值)
Dim profile As ProfileCommon = ProfileCommon.Create(myUser.UserName, True)
profile.UserCustomContent = "customcontent"
VB-現有用戶...
Dim profile As ProfileCommon
profile = Profile.GetProfile(myUser.UserName)
profile.UserCustomContent = "customcontent"
C#-新用戶
ProfileCommon profile = (ProfileCommon) ProfileCommon.Create(myUser.UserName, true);
profile.UserCustomContent = "customcontent";
profile.Save();
C#-現有用戶
ProfileCommon profile;
profile = Profile.GetProfile(myUser.UserName);
profile.UserCustomContent = "customcontent";
profile.Save();
如果使用的是Web應用程序項目,則需要自己實施概要文件。 配置文件只能與“網站”選項一起使用。 與Web站點項目一樣,Web應用程序項目沒有將Profile對象自動添加到每個頁面,因此我們無法獲得對web.config文件中定義的Profile屬性的強類型編程訪問。
因此,如果您使用的是Web應用程序項目,則應該會有所幫助:
http://code.msdn.microsoft.com/WebProfileBuilder
但是,如果您使用的是Web站點項目,那么Scott Guthrie的這篇文章應引導您朝正確的方向發展:
http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx
我自己的一篇博客文章的更多詳細信息:
http://www.codersbarn.com/post/2008/06/01/ASPNET-Web-Site-versus-Web-Application-Project.aspx
:-)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.