Click here to Skip to main content
15,888,176 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
profile defaultprovider="MyProfileProvider">
providers>
<add> name="MyProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="dbconnection" />
/add>
/providers
/profile>
Posted
Updated 9-Oct-14 2:20am
v3
Comments
Afzaal Ahmad Zeeshan 9-Oct-14 8:27am    
I don't understand, what is the question?
vermanishad 9-Oct-14 8:31am    
question is web config under profile
<profile defaultProvider="MyProfileProvider">
<providers>
<add name="MyProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionstringname="dbconnection">
</providers>
<properties>
<add name="ShoppingCart" type="ShoppingCart" serializeas="Binary" allowanonymous="true">
</properties>
</profile>
i want to use profile. in server page call
Afzaal Ahmad Zeeshan 9-Oct-14 8:32am    
See my answer, I have added some details information to resources.
vermanishad 9-Oct-14 8:33am    
link
Afzaal Ahmad Zeeshan 9-Oct-14 8:34am    
See my answer please.

You can look for resources on MSDN, they have a great library of resources for their products. The profile Element is defined and described here,

http://msdn.microsoft.com/en-us/library/ms164644(v=vs.85).aspx[^]

You can also get a tutorial on this topic, at http://msdn.microsoft.com/en-us/library/vstudio/d8b58y5d(v=vs.100).aspx[^]

Sample code is like this, if you're having your profile defined as

HTML
<profile defaultProvider="AspNetSqlProfileProvider">
  <properties>
     <add name="Name" />
     <add name="Weight" type="System.Int32" />
     <add name="BirthDate" 
          type="System.DateTime" />
  </properties>
</profile>


You can get its value in your ASP.NET code as

C#
// if the programming language is C#, then
DateTime bday = Profile.BirthDate;


You must always at least once Google your problems, there is a solution ready for you to work with. Good luck!
 
Share this answer
 
v2
The Differences in Profile between Web Application Projects (WAP) and website
Saturday, April 12, 2008 ASP.NET WAP
The profile services is a very helpful and easy way to add custom properties for your users which is not contained in the Standard MembershipUser Properties...

for example , you may need to add the Marital status , Date of Birth, Address.... all of these are custom properties that you may need them while developing your projects ...

If you are familiar with Profile .. you will know that the first thing that must done when working with profiles is to set the Profile properties in web.config File ,

for example ,you can add the Date of Birth, address, Marital status for the user profile as follows,

<profile>
<properties>
<add name="DateOfBirth" type="DateTime">
<add name="Address" type="String">
<add name="MaritalStatus" type="String">



after saving the file , and working under a website project ,

you will notice that if you typed profile in the page code behind , you will see the properties generated for you as in the picture below:



this happened because the Visual studio created a new class called ProfileCommon Thats inherits ProfileBase , and adds the new properties to it ..

Note that visual studio will always update that class when you change the Profile properties in web.config ...

Now , if you are working with web application projects , you will notice that adding the Profile properties to web.config will not add any properties to Profile object in the code behind of the page.... this is because Visual studio doesn't generate a profileCommon class ...

instead you need to access the properties using ProfielBase.GetPropertyValue(PropertyName)

for example , to access the DateOfBirth property , you need to use this code

Dim DOB As DateTime = CDate(HttpContext.Current.Profile.GetPropertyValue("DateOfBirth"))

In this post , I talked about the Differences in Profile between the normal website and WAP projects , Note that there is a lot of other differences between them, for example ,

when working with resource files , the website will provide a strong typing for resources properties which is also handled by Visual studio ...

that a reason so plz if used profile in asp.net using website
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900