Inside some api web controllers, I would like to access the User, as indicated in this answer: https://stackoverflow.com/a/316618/
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 script are on a different database server than the database server on which the application is running. The database for the application has its own Users table with an IDENTITY column as the Primary Key in the Users table, and then other tables, which include the CreatedByUserID and UpdatedByUserID columns, are integers based on the IDENTITY column in the user table.
The problem is that if operations like CRUD depend on updating the user in tables like INTEGER , just one access to the username is not enough; we should still get this username corresponding to UserID .
This can be done with another connection in the Users table, but it seems a bit shabby. What would be the best way to solve this problem?
source share