.NET 2.0 Profile variable replaces Session except 'profile' does not exist in the current context er

J

j-in-uk

Hi,

It seems as though Profiles have replaced session variables in visual
studio 2005. The Profile needs to be defined in the web.config :
<anonymousIdentification enabled="true" />
<profile enabled="true">
<properties>
<add name="EmpNum" defaultValue="??" allowAnonymous="true" />
</properties>
</profile>

And accessed from as page as Profile["EmpNum"] = "Test"

except I get the 'profile' does not exist in the current
context.....any ideas?

thanks
 
G

Guest

Profile does not "replace" Session. It's designed for user-specific settings
and information that typically are needed to enhance the user experience.
Custom profile information could include site setting preference, or things
like address and email information.

Profile is not accessed the same way as Session.

Hope this helps.
 
J

j-in-uk

Hi,

Ok thanks, I know the difference now but I still seem to have a problem
accessing the Profile properties setup in the web.config.
Profile does not "replace" Session. It's designed for user-specific settings
and information that typically are needed to enhance the user experience.
Custom profile information could include site setting preference, or things
like address and email information.

Profile is not accessed the same way as Session.

Hope this helps.
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




j-in-uk said:
Hi,

It seems as though Profiles have replaced session variables in visual
studio 2005. The Profile needs to be defined in the web.config :
<anonymousIdentification enabled="true" />
<profile enabled="true">
<properties>
<add name="EmpNum" defaultValue="??" allowAnonymous="true" />
</properties>
</profile>

And accessed from as page as Profile["EmpNum"] = "Test"

except I get the 'profile' does not exist in the current
context.....any ideas?

thanks
 
G

Guest

Example:

protected void Page_Load(object sender, EventArgs e) {



Country.Text = Profile.Country;

Gender.Text = Profile.Gender;

Age.Text = Profile.Age.ToString();



RoleList.DataSource = Roles.GetRolesForUser(User.Identity.Name);

RoleList.DataBind();

}


See this post by Scott Guthrie ("Mr. ASP.NET") for details:

http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx


--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




j-in-uk said:
Hi,

Ok thanks, I know the difference now but I still seem to have a problem
accessing the Profile properties setup in the web.config.
Profile does not "replace" Session. It's designed for user-specific settings
and information that typically are needed to enhance the user experience.
Custom profile information could include site setting preference, or things
like address and email information.

Profile is not accessed the same way as Session.

Hope this helps.
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




j-in-uk said:
Hi,

It seems as though Profiles have replaced session variables in visual
studio 2005. The Profile needs to be defined in the web.config :
<anonymousIdentification enabled="true" />
<profile enabled="true">
<properties>
<add name="EmpNum" defaultValue="??" allowAnonymous="true" />
</properties>
</profile>

And accessed from as page as Profile["EmpNum"] = "Test"

except I get the 'profile' does not exist in the current
context.....any ideas?

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top