?
Solved

SimpleMembershipProvider UserID / Program Database UserID Translation Table?

Posted on 2013-11-04
3
Medium Priority
?
334 Views
Last Modified: 2013-11-06
Problem: I'm dealing with 2 different databases,
  1 -  membership & roles
  2 -  My program database

The 1st database is the MVC4 SimpleMembershipProvider. Very simple login and very little user info stored. I know how to get the current logged-in user name like so:

string userName = HttpContext.User.Identity.Name;

The 2nd database contains actual Program data and some user info used in the actual web site for our Products inventory. It has  the UserID i really need to persist for use in several controllers. Inserts, Updates, Deletes all rely on this UserID.

So the logged-in UserID or Username and Role is not the same as our actual Program database.

Q. Do need a 'translation table' to cross-reference the WebMatrix User Info to our 'Products' User Info?

I hope this post is making sense, it's a bit difficult to explain...
0
Comment
Question by:WorknHardr
[X]
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
  • 2
3 Comments
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 2000 total points
ID: 39623249
Probably the easiest way to do it is store your db2 UserId in db1. This link explains how to add custom data to bd1 http://stackoverflow.com/questions/12435252/how-to-create-custom-additional-fields-in-userprofile-in-mvc4.

The tricky bit is creating both records either at the same time, or linking them (by email address maybe, but beware of security implications) later.

Once they are linked you can either access the db2 UserId you need directly from the user profile. Or you can store it in a session variable or similar to allow you easy access to it. Or course if you do this you need to take into account the situation when you session variables get purged.
0
 

Author Closing Comment

by:WorknHardr
ID: 39628064
Works great, thx
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

752 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