ASP.Net Profiles/Session Variables

aothomas42
aothomas42 used Ask the Experts™
on
So i'm trying to move away from Session Variables. In this site I am trying to optimize it uses too many of them. I have been looking into using ASP.Net Profiles instead. I have this example I found but can't seem to get it to work for me. Am hoping someone has seen it or something like it and knows what I can do get it working.

http://www.asp.net/downloads/sandbox/table-profile-provider-samples

In the default.aspx file in the page_load event the below line gives me the error
'The name 'Profile' does not exist in the current context'

txtFirstName.Text = Profle.FirstName;
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Also if anyone has a better alternative to session variables other than profiles i'd love ot hear it

Commented:
Session itself is not bad. I would suggest the following.

1) Have a disciplined session variables which are serializable so that they can be used with Inproc, StateServer and SqlServer.

2) Instead of storing just any variable, group those into the modules struct and then save it in the session.

Author

Commented:
Currently I am using Inproc and i believe this is what is causing the worker process to recycle so quickly. I am thinking of using State or SqlServer.

Could you explain your second part a little further
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Systems Development / Support Specialist
Commented:
To use Profiles in the manner you describe requires a Web Site project. Your question implies that you have a Web Application project.

Using profiles in a Web Application project is a little more work than with a Web Site as the dynamic ProfileCommon class is not generated for you.

Here are some references to help you understand the differences.

http://weblogs.asp.net/anasghanem/archive/2008/04/12/the-differences-in-profile-between-web-application-projects-wap-and-website.aspx

http://murrayon.net/2009/02/aspnet-profile-and-web-application.html

And here is a tool that can make using profiles in Web Applications easier.

http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-web-application-projects.aspx
Anuradha GoliSystems Development / Support Specialist

Commented:
Problem might be because of back up copy from the same file (copy of default.aspx) that you need  to exclude from the project.
Anuradha GoliSystems Development / Support Specialist

Commented:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial