Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2008-10-25
Medium Priority
Last Modified: 2012-08-13
I have the following:

<profile defaultProvider="OL_ProfileProvider">
        <add name="OL_ProfileProvider" connectionStringName="LocalSqlServer" type="System.Web.Profile.SqlProfileProvider"/>
        <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"/>
how do are these created. I think they are binaries that I cannot see.

Question by:mathieu_cupryk
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
  • 4
  • 3
LVL 12

Expert Comment

ID: 22802382
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:
    <anonymousIdentification enabled="true" />
        <add name="UserCulture" defaultValue="en-US"></add>

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!

Author Comment

ID: 22804402
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.
LVL 12

Expert Comment

ID: 22804445
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!
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!


Author Comment

ID: 22804892
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);
LVL 12

Accepted Solution

techExtreme earned 2000 total points
ID: 22804993
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.

Enjoy Coding!

Author Closing Comment

ID: 31509908
very well answered question. detailed, and write to the point.
LVL 12

Expert Comment

ID: 22806081
Thanks. Enjoy Coding!

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

715 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