请帮我在Asp.Net 4.5中配置用户配置文件提供程序 [英] Please help me to configure user profile provider in Asp.Net 4.5

查看:65
本文介绍了请帮我在Asp.Net 4.5中配置用户配置文件提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我在Asp.Net 4.5中配置用户配置文件提供程序



我想配置我项目中的用户个人资料。

web.config中的配置是:

Please help me to configure User Profile Provider in Asp.Net 4.5

I want to configure user profile in my project.
Configuration in web.config is :

<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
      
     
      <anonymousIdentification enabled="true"/>
      <profile enabled="true">       
        <properties>
          <add name="Name" allowAnonymous="true"/>
          <add name="PostalCode" type="System.Int32" allowAnonymous="true"/>
          <add name="ColorPreference" allowAnonymous="true"/>
        </properties>
      </profile>
    </system.web>

</configuration>



我的主页,s,页面加载事件中的代码是


And my code in my Master page,s,page load event is

<pre lang="cs">protected void Page_Load(object sender, EventArgs e)
    {
        if (Profile.Name.Length > 0)
        {
            UserProfileHyperLink.Text = "Welcome, " + Profile.Name;
        }
        else
        {
            UserProfileHyperLink.Text = "Set Profile";
        }

        if (Profile.ColorPreference.Length > 0)
        {
            Panel1.BackColor =
              System.Drawing.Color.FromName(Profile.ColorPreference);
        }
    }
</pre>



构建时间有误。


There is some error in build time.


Error	1	The name 'Profile' does not exist in the current context





请帮帮我解决这个问题。



Please Help me to solve this.

推荐答案

看看这个

http://msdn.microsoft.com/en-us/library/system.web .profile.sqlprofileprovider(v = vs.110).aspx [ ^ ]


http://msdn.microsoft.com/en-us/library/system.web.profile.sqlprofileprovider(v = vs.110).aspx [ ^ ]


这篇关于请帮我在Asp.Net 4.5中配置用户配置文件提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆