Solved

Storing session or GUID in membership profile.

Posted on 2008-10-26
8
156 Views
Last Modified: 2013-11-08
When the user enters the profile information.
Should I add this to the membership profile.

                string sConfirmationGUID = System.Guid.NewGuid().ToString("N");
                string sUserIP = Request.UserHostAddress;
                string sSessionID = this.Session.SessionID;

MembershipUser user = Membership.CreateUser(txtUserName.Text, txtPassword.Text, txtEmail.Text);

                ProfileCommon pc = Profile.GetProfile(user.UserName);
                pc.Email = txtEmail.Text;
                pc.FullName = txtFullName.Text;
                pc.DOB = Datepicker.Selected_Date.ToString();
                pc.Gender = Gender.ToString();

                pc.City = ddlCity.SelectedValue;
                pc.Region = ddlRegion.SelectedValue;
                pc.Country = ddlCountryRegister.SelectedValue;
====> put the information here for example.
                pc.Save();
0
Comment
Question by:mathieu_cupryk
  • 5
  • 3
8 Comments
 
LVL 20

Expert Comment

by:Juan_Barrera
ID: 22810371
In web.config, you can use allowAnonymous="true" in each profile property that you want to be able to store for anonymous users. Then, ASP.NET automatically does the job for you.
0
 
LVL 20

Expert Comment

by:Juan_Barrera
ID: 22810452
To add to my previous comment:
Obviously, if you want to store only authenticated user's profile information, there is no even need for setting the property.
0
 

Author Comment

by:mathieu_cupryk
ID: 22812537
This is authenticated users. What should I store from a programmer's point of view.
0
 
LVL 20

Expert Comment

by:Juan_Barrera
ID: 22816182
I'm not sure if I understand you question.
You can store whatever information you want, depending on your needs.
What I'm saying is that, in order for the Profile provider to work, is not necessary to store session IDs or user IPs, like in your exapmple.
Could you please clarify why you want to store that kind of information in the profile?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:mathieu_cupryk
ID: 22817957
what does one usually store as information?
0
 
LVL 20

Expert Comment

by:Juan_Barrera
ID: 22817982
There is no "usually" I think. It depends on your needs.
0
 

Author Comment

by:mathieu_cupryk
ID: 22847289
if u need user information?
0
 
LVL 20

Accepted Solution

by:
Juan_Barrera earned 500 total points
ID: 22847618
The Proflie class is mainly used for that purpose.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now