Storing session or GUID in membership profile.

Posted on 2008-10-26
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.
Question by:mathieu_cupryk
  • 5
  • 3
LVL 20

Expert Comment

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.
LVL 20

Expert Comment

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.

Author Comment

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

Expert Comment

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?
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.


Author Comment

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

Expert Comment

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

Author Comment

ID: 22847289
if u need user information?
LVL 20

Accepted Solution

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linq Help 1 35 adjust Screen Resolution 6 41
Data is not showing from images 15 37
WCF Service Application cannot connect from TCP terminal 1 13
Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Sending a Secure fax is easy with eFax Corporate ( First, just open a new email message. In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

21 Experts available now in Live!

Get 1:1 Help Now