Best Way To Check A Setting In All Profiles?
Mar 24, 2011
Using ASP.net, is there a recommended best way to access a particular field of the profile in code. I was looking in my old Problem-Design-Solution 2.0 book, and it does it by pulling all members in the DB and then iterating through each one's profile (see code below). Is there a better way?
for each (MembershipUser user in Membership.GetAllUsers())
{
ProfileCommon userProfile = profile.GetProfile(user.UserName);
if (userProfile.mysetting == desiredValue) [code].....
Edit 1. I found that it can be done a little more efficiently than pulling members and then pulling profiles. It is possible that not all members have a profile, so if you use the following code, you'll pull all the profiles (which may be fewer in number than members, and then can iterate across it:
for each (ProfileInfo theProfile in ProfileManager.GetAllProfiles (ProfileAuthenticationOption.All)
{
ProfileCommon pc = ProfileBase.Create(theProfile.UserName)
if (pc.mysetting == desiredValue)
{
//do something
}
}
It still round trips the DB for each profile, but it may not do it as many as if we used the members...
View 3 Replies
Similar Messages:
Mar 24, 2011
I am using VWD 2010 and building a site on the 3.5 framework. It's a simple site for a school club, and we need user profiles for membership information. I have been looking at This MSDN page about how to go about it. This is my current Web.config:
Code:
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile enabled="true" defaultProvider="AspNetSqlProfileProvider">
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
<properties>
<add name="Name" type="String" serializeAs="String"/>
<add name="Address" type="String" serializeAs="String"/>
</properties>
</profile>
<roleManager enabled="true">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
It is more or less out of the box currently. The issue I am having is that if I try to access say, Profile.Name, I get the error that "Name" is not a member of "Profile". I have had this working before in another site, but this one is getting the better of me.what I may need to do to get this functioning properly?
View 1 Replies
Feb 9, 2011
[Code]....
I get the following error : The SSE Provider did not find the database file specified in the connection string. At the configured trust level (below High trust level), the SSE provider can not automatically create the database file.
View 1 Replies
Jun 17, 2010
Is possible define different profiles a the same time?
I have two type of users in my web site and they have different properties.
Using asp.net profile is possible to define two or more profiles with distinct properties?
View 1 Replies
Aug 22, 2010
I have a simeple web service set up to call from JAVASCRIPT. That works. Can someone tell me how to access profiles from a web seervice. I get arofileCommon could nt be found......I have included the following in the service but it doesn't seem to solve the problem:
View 1 Replies
Aug 2, 2010
I created tables in my database for managing a user's profile.I have the user table (username, password, passwordSalt, etc.) report (1 to 1) with a table ProfiloUser (idprofilouser, iduser, name, sex, DoB, email, etc.), the latter table reports (1 to 1) with the table ProfiloAzienda (idprofilouser, idprofiloutente)
and finally I have another table that is related profilodestinazioni (1 to many) with the table profilouser.
how I can create a custom profile is on web.config, which side code.I've created this in web.config:
[Code]....
The code then I created the following classes
[Code]....
View 5 Replies
Dec 7, 2010
I am trying to apply themes to my site using profiles. So in my web.config file I need to write the code so that once that user logs in, then the theme of the site changes. Right now I just have color themes; yellow, blue, and orange.
If this isn't in the right section feel free to move it.
View 2 Replies
Nov 10, 2010
I have searched for an answer to my problem and could not find an answer anywhere.
I am rebuilding a website (converting it to use masterpages, usercontrols, asp.net memberships, etc using asp.net 4.0 C#) that has two different types of users. The problem is, the two different users have different roles ie. customers and employeers. Depending
on the role the user is assigned to they will have different things that should be stored in their profile.
For instance a customer would have all the basic elements of a profile, name, address, phone, etc. But it would also have some extra stuff like, a little bit about themselves, their resume, where they went to school, etc. On the other hand an employer would
have the basic elements but it would include details such as the position, a description of the position, contact for that position, etc.
Is there any way to have multiple profiles and still use the asp.net sql membership and profile provider?
View 1 Replies
Feb 28, 2010
I am getting to like how to use a profiles in aspnetdb membership
But these profiles are stores in a string.
Q: How does one get this profile data into a table, or get TSQL to show data in a column format.
View 2 Replies
Jan 16, 2011
I am running my application locally -- ie. No external traffic and very low number of queries, fully under my control. I see tons of 'Audit Login' and 'Audit Logout' events. What are these and where are they actually stored (ie. Where is this audit log)? Are these a hint of a problem with connections, because I have only a simple connection string within my app and thought that connections would remain active throughout the operation of my app (ie. a single login at launch, and then a single logout when terminating).
View 2 Replies
Oct 11, 2010
Well I have recently been working with profiles and its been going well. When I load my website within Visual Studio it created an MDB within app_data called aspnetdb.mdb and from then on it uses this database to store data that my users have chosen or entered. When I upload the website it fails because it can't find or create the database above. (even if I upload the mdb that was created on my local machine) I have tried to resolve this issue by changing my web.config file as below
Code:
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=totallyu_profiles;Integrated Security=True;User ID=admin;Password=password;" providerName="System.Data.SqlClient"/>
</connectionStrings>
I also made an SQL database on the server called totallyu_profiles and set up a user for it. I can connect to that database by using ODBC on my local machine. I can't however upload my current database created by Visual studio to the totallyu_profiles database so it is empty, I was wondering if it will fill the tables itself when the connection string is okay. One other thing to note is that my site errors very quickly with the above connection string and if I don't include the string and use the default then it takes ages. Can I somehow just point the connection string to my database within App_Data?
View 28 Replies
Apr 26, 2010
I have a website that needs to store two sets of user data into separate data stores. The first set of data is used by the SiteCore CMS and holds information about the user. The second set of data is used by a personalisation application that stores its own user data. The reason they aren't stored together in the same profile object is because the personalisation application is used across multiple websites that do not all use SiteCore.
I am able to create multiple Profile Providers - I currently have one from SiteCore and a custom provider that I have written and these both work in isolation. The problem exists when you try to configure both in the same web.config file. It seems you can only specify a single Profile object in the web.config file, rather than one for each provider. This means that regardless of which provider is being used the .Net framework sends through the profile object that is specified in the "inherits" parameter in the profile section of the web.config file.
My questions are - Is it possible to specify a different Profile object for each Profile Provider? If so, how and where is this specified?
-edit-
I should point out that there is no duplication of data in the two data sets, they are mutually exclusive (excluding email address). The SiteCore data is used solely for this website, but we have company wide profile data that spans across all of our applications, hence the need for a separate second profile object.
View 2 Replies
May 20, 2010
I have a big probelm that i want to use profiles at godaddy hosting , it didn't work good and make a message said :
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
View 1 Replies
Sep 26, 2010
i working on event managment registration and i need to make a roll for visitors and roll for exhibitors isitor most enter data to visitor profile with data likefirst name,last name , DOB, Mobile Number, tel , fax and exhibitor most enter data to exhibitors profile data with different data .it's easy to make it for visitor or exhibitors with one profile how to make it with different data profiles what the logic to make that
View 2 Replies
Mar 17, 2010
I have a issue im trying to get though where my site while up useing a ajax timer ever 15 seconds to update there time stamp to say there still online and active. Its the best way i could think of to handle the are they online/did they just leave issue i was having. Any ways i dont know how to query the database with linq to sql so i guess i will do psudeo code like stuff and hopefully some one can offer some advice.
[Code]....
View 1 Replies
Mar 8, 2010
I am currently using the ActiveDirectoryMembershipProvider just for authentication on an internal business app built in asp.net. This works like a charm.
I am now looking to add some functionality to handle custom profile information for a user, ideally also stored in Active Directory.
For a simple example let's just say the custom attribute is FavoriteColor. Then the goal would be for my app to be able to read in this custom attribute for the authenticated user.
I have looked into ADAM a bit. That looks like it would be great for a Role Provider, but I haven't really found anything that indicates it would work well for a Profile Provider or if it would even let me store custom attributes like FavoriteColor. Maybe someone knows better?
I'm also pretty new to Active Directory so maybe there is even an option to store custom user attributes (like FavoriteColor) within it? In general I am just looking for ideas about the best way to implement this?
View 1 Replies
Jan 15, 2011
I am using URL Routing for display user profiles. I am using master page and child pages. The profile page is a child page and the master page has a login status control. When I login (say user x) through the modal popup which is in the master page itself, i can browse the site with smoothly and reach the routed page. When I log out from the routed page using the login status i get redirected to my home page as required as my login status also is logged out. If i login from this homepage now with another username say y, i get logged in successfully.
The problem is that when I again use the routed to get to the routed page, I get the previous user x still logged in. When i come to homepage I see user y logged in. So I have two sessions working; one in the routed page, and other in the whole of the website.
View 16 Replies
Jan 29, 2011
I'm modifying Scottgu's tutorial for adding profile information to a login.I have put in a provider tag and the profile tag parts in the web config, and hooked it up to a connection to my SQL Server DB.I have modified the create user wizard step 1 to contain extra controls to capture forename and surname. I then altered the tutorial code to match this.however, though the _CreatedUser event code fires, nothing is stored in the aspnet_Profiles table in my DB.I took the tutorial code for the display profile info page and modified it to displAy the users name, but nothing appears on the page, even though the users username appears using the loginname control.all I would like to do is display message in the master page that says 'welcome, John Doe, you are logged in as doej'
View 8 Replies
Dec 1, 2010
I have just put my first ASP.Net site live on the internet but im having problems with my login. When i try to login my sit is throwing an error.
The SSE Provider did not find the database file specified in the connection string. At the configured trust level (below High trust level), the SSE provider can not automatically create the database file.
I have run my script from visual studio so the profiles are there but i cant login?
View 4 Replies
Jul 26, 2010
If I use System.Web.Profile.ProfileManager.GetAllProfiles, I get all profiles for users that have logged in since I implemented saving a custom profile item. A few problems I need to solve.
1) when I use the GetAllProfiles method listed above, the custom profile items are not available. For the current user, I can get the value using HttpContext.Current.Profile.Item("MyCustomItem"). I need to be able to get to all the profile items programmatically.
2) I also need to programmatically create profile items for other users (a migration to this format).
3) I cannot get to the items like the documentation says like Profile.MyCustomItem.
View 1 Replies
Dec 11, 2010
Currently i have created Anonymous Profiles, i am not knowing whether the data will be saved in SQL database or Cookies, as i do not want to grow the database for Anonymous Profiles ? But in future i may migrate the Anonymous Profiles to Authenticated ProfilesBelow are the clarifications i need related to Profiles1) Do data of Authenticated Profiles saved in SQL database ?
View 4 Replies
Oct 3, 2010
I have been using profiles to store a list of user defined clicks. A user clicks on items and it adds it to my Shopping Cart.
I have managed to enter all the info I need and see that It is there with a count but I can't pull the information back once I have entered it.
First thing I did was add code to my Web.config under System.web
[code]....
Then I created a Class called ShoppingCart.vb
[Code]...
Okay here is my VB code where I need to be able to pull the information back again.
[Code]...
So I may need to give you more information but the basics are:
I can add items to my list with btnAddS and it will update my label with the correct amount of rows (items)
Under my btnView I can iterate through the rows (items) but I can't pull back the information stored within.
View 25 Replies
Oct 25, 2010
I've been using the CreateUserWizard to create my users as well as to assign them roles/permissions. My problem is that, once created, I have no idea how to edit or delete their details without using the Asp.net Website Administration Tool. Where can I get some extensive but easy to understand literature on the subject?
View 4 Replies
Oct 12, 2010
I am trying to populate a gridview control to display the current registered users on the site.
I query various tables from the ASPDOTNET.mdb database in order have a list comprising of UserNames, Email address, LastLoggedOn, etc. This bit is fine and it displays all the details.
The part I'm having a problem with, is I would like to add the FirstName and LastName to each row also. But I'm not sure how to get at the record. In the profile table I have a column with this detail within plus other personal details but I only need to retrieve the names and display that in the gridview.
View 2 Replies
May 21, 2010
I have stored users external profiles e.g twitter,facebook,youtube... in DB
And what i want to do is to show those profiles in form of hyperlink field in gridview..
View 3 Replies