![](/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.