C# - Retrieve UserId From Membership Users Table?

Jun 6, 2010

i'm new to membership. i have a table named contact, with a field, userId that must get its data from the membership users table. so when a user is created i have to get the userId from membership users table. how can i do that?

View 1 Replies


Similar Messages:

Security :: Pass Membership UserID To Db Table?

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

Security :: How To Retrieve UserID Off From The Session, Or Are There Other Ways To Retrieve UserID From

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

VB - Adding UserId To Custom Table After Membership.CreateUser?

Nov 18, 2010

There are lots of posts about this issue but I can't work out the answers as most of them are for C# or similar. I'm trying to automatically insert the UserId generated by Membership into a custom table. I have membership working correctly, as well as the custom table (I'm able to insert other things from the registration form). But I can't get it to extract the generated UserId and insert it into the custom table. Here's my code:

[Code]....

As you can see I've experimented with the parameters for inserting the record, but that doesn't work (I get an error about ProviderKey not being a part of system.web.security.membershipuser).

View 3 Replies

How To Create Users In A Membership Table Without Using CreateUser

Jun 2, 2010

I want to migrate users and posts from an existing forum I am using to a ASP.NET membership table without using CreateUser. Basically I want to maintain userIDs so that when I migrate posts they continue to associate with the correct users. Is there a way to do this or would I be better off just using CreateUser and then finding a way to re-assign the post-by-UserIDs to the correct new IDs?

View 3 Replies

Security :: Add Foreign Key Field To Membership Users Table

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

C# - Migrate Users From Custom Table To Membership Tables?

Mar 9, 2011

I'm creating a new middle tier where all of our client calls will go through a WCF service. We're using ASP.NET membership with the service in order to authenticate users. The middle tier will be hitting an existing database in which we already have an InetUsers table containing usernames and passwords.This is where it starts to get messy. This new middle tier will be used by our web application, but not by our existing desktop application, which will - until we rewrite it at some point in the future - be using the old COM+ middle tier. Administration of the users for the web application takes place in the desktop application. In other words, users will be created and passwords set and changed from within the desktop application, which in turn hits the already existing InetUsers table.Ideally, what will happen is when we deploy the new middle tier, we'll take all of the users from the InetUsers table and create records for them in aspnet_Users and aspnet_Membership. Then we'll set a trigger on the InetUsers table to keep aspnet_Users and aspnet_Membership up-to-date.There's a whole bunch of questions wrapped up in this, so I'll try and list them all out here:Is this the right approach? Obviously having this data in two places isn't ideal, but bear in mind here that I'm not the final decision maker here and we're kinda stuck with some legacy stuff here, at least for now. Still - maybe there's a better way.In the same vein - would we be better off coding our own membership provider rather than using the SqlMembershipProvider? How difficult/easy is it to do so?If we use this approach, I plan on using the aspnet_Membership_XXXX stored procedures for the initial population of the tables as well as in the triggers. Having done some research into this, it appears that if I want to call aspnet_Membership_CreateUser directly from SQL (ie in a trigger...) rather than using the API, I have to store clear text passwords since I can't get the salt and the hash right otherwise. Is this true?Does any of this even make sense or am I going about this the wrong way to begin with?

View 2 Replies

C# - Adding Another Table Where UserID Can Have A Relationship With Another UserID?

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

Membership Provider Get UserName By UserId?

Jan 17, 2011

I have seen a lot of question asking about known user name and how to retrieve UserId accordingly. How about the other way around?

For some reason I have UserId, but I don't want to include aspnet_User table into my data entities. Is there any way I can retrieve the user name without querying against aspnet_User table?

View 1 Replies

How To Get Current Logged In UserID In Aspnet Mvc Membership

May 7, 2010

i am trying to show a list of users of my application "school", when admin logs in then he can view all the users in list but when school principals logins, he should get only users of his school, So i thought to get the current loggedIn userId first and then by that userId i'll get schoolId since userId is foreign key in school table...once i'll get the schoolId i can show the members of that school.

But my problem is how to get the UserID of currently loggedIn. I'm using MVC 1.0 Asp.Net -- "Membership" if my logic above is wrong then tell me the alternate good idea, so that principal can see only his users list.

View 3 Replies

Security :: Membership Create Double UserId?

Jan 2, 2011

I'm using the membership class in my application, but when I assign a Role to a User it create again the same user with other ID.

This is my Web.Config:

<?xml version="1.0"?>

View 2 Replies

Databases :: Use GUID As Userid When Using MySql For Membership?

Apr 23, 2010

I have followed this tutorial which provides me with Membership, Role, Profile etc.

[URL]

Everything is working fine, but I noticed that the userid is in standard INT, not GUID. Is it possible to get around this? I want the userid as GUID.

View 4 Replies

Web Service And Membership - Get UserID Of User When Not Logged In

Jul 21, 2011

I am creating a few web services for use with a mobile application. My current site uses asp .net membership and one of the web services will validate username and password.

In the web service I get passed uname and pword and just use

Code:
If Membership.ValidateUser(username, password) = True Then
Return "True"
Else
Return "false"
End If

Is there a similar way to get the userid without logging the user on or do I need to create a Stored procedure?

View 2 Replies

DataSource Controls :: How To Retrieve The USERID That Is Being Used To Make Connection

Mar 18, 2010

If I m using Windows Auth in my connectionstring i.e Integrated Security = SSPI / Trusted_Connection = Yes,

Is there any way to retrieve the USERID that is being used to make connection?

View 3 Replies

Active Directory/LDAP :: Retrieve Users From The "Domain Users" Group?

Jul 7, 2010

I want to use the Domain Users group to show all the users in a dropdown box. For some or other reason I cannot return all the users when looking for everyone under the domain so instead I was thinking of using the domain users group.This is part of my code:

[Code]....

[Code]....

View 1 Replies

Can't Insert A Guid (userID) Into Table!

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

Web Forms :: Matching Logged In Userid To ID In Another Table?

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

Web Forms :: Custom Table Profile Provider Has Different UserID?

Feb 11, 2010

I created the Table Profile Provider with the VB.NET and it works perfectly but I have one issue with it.. My Table (UserProfile) can't be linked with any other tables because the UserID on userprofile is different than any other table yet when I do profile.firstname on the vb code it works perfectly. Say for example I have a username called john If I do select * from aspnet_users where username = 'john' The results would come to 2 rows, 1 which has a userid and applicationid that is used on ALL the tables in my database EXCEPT for userprofile The second one would have a applicationid and userid that is only use on my userprofile table.

View 1 Replies

Security :: Best Way To Insert Newly-created UserId Into A Second Table Also?

Sep 25, 2010

[Code]....

View 9 Replies

Security :: How To Automatically Insert UserId Into A Custom Table

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

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

C# - Trying To Select UserID, FirstName, SecondName, PicturePath(from Pictures Table)?

Apr 2, 2011

I'm trying to select UserID, FirstName, SecondName, PicturePath(from Pictures table) LIKE FirstName (string search = textbox.text)

OdbcCommand("SELECT UserID, FirstName, SecondName, p.PicturePath FROM User LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE FirstName LIKE '%" + search + "%' ORDER BY UserID DESC", cn))

My syntax is way messed up. My table structure:

View 4 Replies

C# - Track And Identify Users With Memcached - Keep The "userId"

Jun 14, 2010

I have social network website that contains thousands of users. Until now I used the classic way of storing user's details in the session object. Now, I want to upgrade it, so it will work against Memcached, and the key value is the "userId". My question is: What is or where is the best place to keep the "userId" so I can use it constantly for querying the user's details from Memcached?

View 1 Replies

Web Forms :: Table Profile Provider Writes UserID Twice In Query - Causes Error

May 21, 2010

I get this error while trying to run my project: "Column name 'UserID' appears more than once in the result column list." Indeed, the query generated in my SqlTableProfileProvider.vb is the following (text in brackets [] has been changed):

"IF EXISTS (SELECT 1 FROM [table] WHERE UserId = @UserId) BEGIN UPDATE [table] SET UserID=@Value0, LastUpdatedDate=@LastUpdatedDate WHERE UserId = '[Guid]'END ELSE BEGIN INSERT [table] (UserId, UserID, LastUpdatedDate ) VALUES ('[Guid]', @Value0,
@LastUpdatedDate) END"

I'll emphasize that the above statement is generated in SqlTableProfileProvider.vb, which was written by .Net people. While I have little control over its source, I've apparently given the fodder whereby the mistake can be generated. Any clues as to why UserID is being written twice in the statement?

View 2 Replies

IPrincipal Or Membership To Retrieve Username?

Jan 21, 2010

What is the difference when retrieving username for the view?

<%= Page.User.Identity.Name %>

or

<%= Membership.GetUser().UserName %>

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved