Solved

how to add the following to membership table in aspnetdb.mdf

Posted on 2008-10-25
7
463 Views
Last Modified: 2012-08-13
I have the following:

<profile defaultProvider="OL_ProfileProvider">
      <providers>
        <add name="OL_ProfileProvider" connectionStringName="LocalSqlServer" type="System.Web.Profile.SqlProfileProvider"/>
      </providers>
      <properties>
        <add name="Email"/>
        <add name="UserName"/>
        <add name="Password"/>
        <add name="FullName"/>
        <add name="Gender"/>
        <add name="DOB" type="System.DateTime"/>
        <add name="City"/>
        <add name="Region"/>
        <add name="Country"/>
      </properties>
    </profile>
how do are these created. I think they are binaries that I cannot see.

0
Comment
Question by:mathieu_cupryk
  • 4
  • 3
7 Comments
 
LVL 12

Expert Comment

by:techExtreme
Comment Utility
Hello,
I see you have created few profile properties. Actually you cannot see them directly just by looking at profile table in say the SQL diagram or so. So in a way they are hidden. Actually the names are stored in the rows internally. You do not need to create the required fields in database, they get created automatically once you define them in web.config.

When you enable Personalization in your ASP.NET 2.0 website you can set up a collection of properties that will be maintained for each user of your website (even for the anonymous visitors), which  is exactly what you did.

 Personalization Profiles are often used to store personal data of website users, their personal preferences, visual themes, language settings etc.
 
 Here is a sample Profile setup in web.config:
    <system.web>
    ...
    <anonymousIdentification enabled="true" />
    <profile>
      <properties>
        <add name="UserCulture" defaultValue="en-US"></add>
      </properties>
    </profile>
    ...
  </system.web>

So we have added property to be stored for each user (to keep their language preferences) and here is how we can access them in our code:
 
      this.Culture = this.Profile.UserCulture;
This is because the profile class is generated dynamically (on the fly) using the properties you define in web.config.  You just simply have to use them in your code as required to fetch user specific information.

Hope this helped.

Enjoy Coding!
0
 

Author Comment

by:mathieu_cupryk
Comment Utility
if i have a datetimepicker of type string.
I cannot convert it. before it goes into the table.
So should i just leave this type string.
0
 
LVL 12

Expert Comment

by:techExtreme
Comment Utility
Hia, yet it will work if you leave it as type string but remember that you will get it as a string too.
I myself follow a common rule regarding date if it is to be stored in string format which is tht always pass it in format dd-MON-yyyy and retrieve accordingly, that way you need not to worry about the backend, for example how the sql server requires date to be in specific format or not etc..
Anyways hope i solved the doubt, let me know of any issues.
Enjoy Coding!
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:mathieu_cupryk
Comment Utility
here now I need to pass a datetime
Profile.DOB needs to be of datetime.
   lblZodiacSign.Text = ZodiacSign(Profile.DOB);
    lblAge.Text = getAge(Profile.DOB);
0
 
LVL 12

Accepted Solution

by:
techExtreme earned 500 total points
Comment Utility
Yes I don't see any problem in it.
Assuming your Profile.DOB holds valid datetime value as  a string, you can do Convert.ToDatetim Profile.DOB) and you'll get the datetime.
Is there any problem with the code you posted? have you tried convert.todatetime as I suggested?
let me know of any issues.
Thanks,

Enjoy Coding!
0
 

Author Closing Comment

by:mathieu_cupryk
Comment Utility
very well answered question. detailed, and write to the point.
0
 
LVL 12

Expert Comment

by:techExtreme
Comment Utility
Thanks. Enjoy Coding!
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

Suggested Solutions

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

771 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

13 Experts available now in Live!

Get 1:1 Help Now