Solved

Storing session or GUID in membership profile.

Posted on 2008-10-26
8
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 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