Security :: Link Aspnet_users To Table With UserID As Foreign Key?
Aug 10, 2010
Perhaps this is a simpler VS9 question, but I want to link a SQLServer table with additional user data to the standard SQLServer membership table using the GUID userID as a foreign key. I go into design mode of my table, right-click on relationships, and click add in the dialog. but the left hand column shows me only the tables in my database. How do I get it to show the tables in the ASPNETDB.MDF database? I went through the tutorial (http://www.asp.net/learn/security/tutorial-08-cs.aspx), but it seems to magically appear in there without explanation.
View 3 Replies
Similar Messages:
Apr 14, 2010
If I am going to use the asp.net membership and roles, the asp.net database includes an aspnet_Users table that has the userid and email address. If I have custom fields is it best practice to maintain a separate usert table and link on user id or to add fields to the aspnet_Users table?
View 1 Replies
Oct 26, 2010
I created a project using asp.net in visual studio 2008. In my login database table aspnet_users I noticed under the column UserName there is some usernames that I didn't create such as '668215da-b4d0-4e50-8c97-06586afc07b1' All my usernames are less than 8 characters that are generated by users. How and why was the username '668215da-b4d0-4e50-8c97-06586afc07b1' created? When I query the database table aspnet_users to approve a new user I am not interested in usernames such as '668215da-b4d0-4e50-8c97-06586afc07b1'. How do I avoid them in my query?c = squareroot(e/m)
View 3 Replies
Jun 7, 2010
I want to know that is that the value of last activity date in aspnet_users table is changed when user is logoff from the application.
View 3 Replies
Aug 8, 2010
i am using aspnetdb database and i am using createuserwizard control and i have found that i am able to create user account with same username. as far as i know i think usernames are stored uniquly but i can't figured it out why i am able to create user account with duplicate user names.
View 6 Replies
Oct 13, 2010
I'm using SqlMembershipProvider and SqlRoleProvider for user management.
Users are created by
Dim MCS As System.Web.Security.MembershipCreateStatus
Dim NewUser
As MembershipUser = Membership.CreateUser(TB_UserName.Text, TB_Pw.Text, TB_Email.Text, TB_SecQuestion.Text, TB_SecAnswer.Text,
False, MCS)
later, after email confirmation, I take the user into a specified role
Dim myUser As System.Web.Security.MembershipUser = Nothing
myUser = Membership.GetUser(New Guid(Request("RegID")))Catch
If myUser
IsNot
Nothing
Then
myUser.Comment += " approved "
Membership.UpdateUser(myUser)
Roles.AddUserToRole(myUser.UserName, "role")
End if
After this I have two entries with the same UserName in aspnet_Users table, but with different UserId's. One UserId is referenced in aspnet_Membership table and the other in the aspnet_UsersInRoles table.
View 2 Replies
Aug 31, 2010
For my existing data, both RoleName and LoweredRoleName are same, but some are lower case and some are in same case too.
View 3 Replies
Oct 1, 2010
i'm using asp.net membership for logins/registeration. i have a bookings table with few fields, lets say first_name, last_name, product_name and userID.when the user submits 'buy' i want to get the userID from the membership user tablem that way i know whose made the booking. i'll have these two tables (bookings & user tables) linkedbut how do i get userID from the user table to pass to bookings table? i checked the membership class and it gives options like-Membership.GetUser(), Membership.GetUserNameByEmail(), Membership.GetAllUsers() etcothing for getting user id. user id is stored like this: c1c91682-449f-45dd-b20e-3dac5315bba4
View 2 Replies
Sep 25, 2010
[Code]....
View 9 Replies
Jun 27, 2010
I recently read Scott Mitchell's article series "Examining ASP.NET's Membership, Roles, and Profile". In Part 6 [URL] It says "to store additional, user-specific fields...If you are using the SqlMembershipProvider, this would mean creating an additional database table that had as a primary key the UserId value from the aspnet_Users table and columns for each of the additional user properties."
I created a table named Thread to store some specific users information and comments they make. I set the ThreadId as the primary key and the UserId as the foreign key to the UserId in aspnet_Users table. But when I run the application and use a user's account to submit a comment, there is an error in my Comments.aspx.vb page "Cannot insert the value NULL into column 'UserId', table 'ASPNETDB.dbo.Thread'; column does not allow nulls. INSERT fails.The statement has been terminated."
How can I make the logged-on user's UserId inserted into the Thread table when storing the user's other data information?
View 6 Replies
Apr 8, 2010
I have set up Membership and Roles and can create users and login using the ASp Login control. However I need to associate users with customers (in a Customers table in the database) and display content according to the customer that the user belongs to. Is the best way of doing this to create a foreign key field in the aspnet_Users table relating back to Customers table which would have to be updated manually after creating the user or is there a better way?
View 1 Replies
Mar 31, 2011
I have a confusing question, I have a user table and it stores all the usual data for a user that you would expect but im trying to figure out how a user could add another user?
Sounds strange but each user in the User table has his own UI which is UserID how could I add another table where UserID can have a relationship with another UserID?
i.e how would I right the syntax for the above question if I wanted to display all the UserIDs friends on a page. How would I add a friend.
View 4 Replies
Mar 9, 2010
I am wondering if the aspnet_Users table is always sorted (by UserName) even if I add new users which are alphabetically between two already existing users.
I've noticed that the method Membership.GetAllUsers() always seems to return a sorted collection of MembershipUsers.
Also when I look into SQL Server Management Studio and run a simple SQL query without ORDERBY clause...
SELECT [UserName]
FROM [MyDb].[dbo].[aspnet_Users]
...I get always a sorted result list.
I'm still very unfamiliar with SQL Server but I expected that when I add a new row to a table it is (physically) appended to the end of the table. And when I run a select statement without ORDERBY the rows will be selected in the order they were initially inserted into the database (so without any specific sort order).
I am wrong I guess. But how does it really work? Is it perhaps something special with the aspnet_Users table?
I am happy that the MemberShipUserCollection returned by GetAllUsers() is sorted but is it always guaranteed?
Update
I've just noticed that the database contains a stored procedure called aspnet_Membership_GetAllUsers. This procedure actually contains an ORDER BY clause by UserName. So if this stored procedure is indeed always called when I use Membership.GetAllUsers() in my code (at least if I am using the SqlMembershipProvider) it explains why the collection returned by Membership.GetAllUsers() is sorted by UserName.
Remains the question: Is Membership.GetAllUsers() actually based on this stored procedure?
View 3 Replies
Nov 10, 2010
Our application lets the administrator create new users. Since the administrator is logged in, I have set Logincreateduser = false so that the administrator is not logged out even after creating the new user.
The problem is :I need the userid of the newly created user to store additional details of the user in another database table. I see that i can get the username using Createuserwizard1.username; but how do I get the userID?
View 2 Replies
Aug 10, 2010
I'm working with 2 sites (Intranet and Extranet) that share the same .net membership database (the standard out of the box version). The Intranet and Extranet site users are stored in separate "Applications" within the membership database. I create all users for both sites from within the intranet site. Everything seems to be working except that when i create a user for the extranet site I end up with 2 rows for that user in aspnet_users. One with userID (guid) that I send in and another with a different guid. I'm assusming that .net is creating an anonymous user. The intranet membership provider is the default.
I could delete this row through sql but am hoping for a more elegant solution. Any suggestions?
Dim objUser As MembershipUser
View 6 Replies
Apr 25, 2010
in social networking sites when we login in left side it shows link of our scrapbook and when we open on others persons profile these links open his scrapbook not ours. as i know that it links open according to user_id but how. what will be the code for that link so that link changes according to userid in asp.net. and one other question in our profile it shows link like profile edit, scrapbook, album, many more and when we open others it shows only few links how these link increase or decrease according to userid. Is these links comes from the dtatbase or somthing else. where these coding takes place in webform or in masterpage or any other place using c#
View 4 Replies
Jun 28, 2010
I have used session to the creation of user and led them to the edit page ..But how do I retrieve my userID off from the session, or are there other ways to retrieve userID from?
View 3 Replies
Jun 9, 2010
I have two tables - Student and Advert.
I want to do the following;
1. Student is logged into their account (session is authenticated)
2. StudentID is primary key for that table, it is a foreign key for table Advert
3. When student is logged in, they create advert
What I want is their student Id to be input into the advert table when this new advert is created. How is this possible?
View 1 Replies
Dec 3, 2010
Lets say i create a login and register using the toolbox. i want to create a table where the admin can deleted and ecit the customer details
is it posible to link that table with the custome login and register that was created usingthe toolbox
View 2 Replies
Jan 1, 2010
How i use primary key table & foreign key table data for retriving the data with each other.I had make both table i confuse how to use it.
View 1 Replies
Feb 10, 2011
I'm creating a web project for one of my uni modules using Visual studio 2010. I'm using asp.net membership and have all of my sql-server tables set up correctly (I'm pretty sure).
I have a form that I have created myself that inserts into the database using sqlDataSource.insert(). I had some problems initially with not being able to insert any data into the table at all, but I have cleared that up.
My problem now is that I need to insert the currently logged in user's userID into one of the columns of the table. But every time I hit the submit button, I am told I cannot insert null values in the userID column.
I can retrieve the userID using this snippet:
[Code]....
This is the code behind for the page:
[Code]....
As you can see it is a bit of a mess, I've been frantically trying different variations, as I need to catch up a little with other uni modules.
Here is my SQLDataSource from the .aspx page, The controlparameters work fine for the other data I am inserting. maybe the <asp:parameter name="userID" /> is wrong?
[Code]....
I'm relatively new to vb, and I come from a html & css background.
View 1 Replies
Jan 27, 2011
I have a app that records some jobs and those jobs can have notes attached therefore i connected the table with a foreign key, my notes to a Job.
in the details view of the job i allow the user to view the jobs by sending the id and fulling all the notes that match the id in the index view for the notes table. in the list of notes i have a action link to create a new note, here i sent also the id of the job to the create action of the control and try to insert that intot he note JobId to make the reference. I get this error and the note is not created. the note creats from code but not via the note controller creat action.
i get this - An error occurred while updating the entries. See the inner exception for details. below is the create action in the note controller
public ActionResult Create(int id)
{
// var newnote = db.Jobs.Include("StatusNotes").Single(j => j.JobId == id);[code]...
View 4 Replies
Jul 17, 2010
I have tables two tables, the "book" and the "author", a book can have many authors and vice versa, so there is an intermediate table called "book_author" with two columns as foreign key for those two primary keys
book_author
book_id
author_id
I'm trying to edit the book details and also its author using the entity date model, The controller class method
[Code]....
The HTML edit form
[Code]....
I can only update the book table, but not author that the book has or the book_author, I'm new to asp.net, I can't easily find a tutorial on this issue, I think the logic is to delete the author of the book first and then add the author for that book, but I don't know exactly about that linq and C# code. Can show me? I can only update the book table, but not author that the book has or the book_author, I'm new to asp.net, I can't easily find a tutorial on this issue, I think the logic is to delete the author of the book first and then add the author for that book, but I don't know exactly about that linq and C# code.
View 1 Replies
Jan 21, 2011
I have set up a ASP.net MVC application which uses the default forms authentication. It uses the ASPNETDB.mdf like shown here:
I then set up another database connection which is similar to the NerdDinner.mdf file above.
I have a post that belongs to a user. It has a UserId value which needs to be a foreign key to the information in ASPNETDB.mdf. When I go to add a foreign key, I can only see information with regards to the table I made. How do I go about doing this?
View 1 Replies
Feb 2, 2011
So I have been trying to pull the userid of whoever is currently logged in and match it to another table that it is a fk in. I have some code that should work but I get an error that says specified cast is not valid in line 10.
here is the code I have behind file:
[Code]....
View 4 Replies