Inside some web api controllers, I would like to access the User as indicated in this answer: https://stackoverflow.com/a/12705062/538962
sample code from answer...
[Authorize]
public List<Product> GetProductsFromId()
{
string username = User.Identity.Name;
return _productService.GetProductsFromUsername(username);
}
The asp_net membership tables in my scenario are on a different database server than then the database server the application runs on. The database for the application has its own Users table with an IDENTITY column
as the Primary Key
on the Users table, and then other tables that include a CreatedByUserID
and UpdatedByUserID
columns are integers
based off the IDENTITY column
in the users table.
The issue is that if CRUD type operations depend on the user being updated in tables as an INTEGER
, just accessing the username alone is not sufficient; we still have to get to that username's corresponding UserID
.
This could be done with another join to the Users table, but this seems a bit kludgy. What would be the best way to go about handling this issue?