I’m not sure how to formulate that question but:
-
you have a webpage
-
the webpage got a specific user/pass in the web.config for the connection string
-
on a webpage you ask for a user/pass that is connected to a table (id, name, pass)
-
the user is recognized with a valid user/pass and now you know the id from the table above
-
the user change some data in a table and that table got a trigger
from that trigger, how to retrieve the user id from step 4
Let’s say the user is logged using the asp.net membership table
Use
SET CONTEXT_INFOandCONTEXT_INFO()to pass out-of-band parameters. Your Web layer must ensure it sets this correctly on each connection it uses prior to calling into the database, which means one extra additional round-trip to the database.