Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 993151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:22:31+00:00 2026-05-16T06:22:31+00:00

We are developing a service layer for a new system that will handle all

  • 0

We are developing a service layer for a new system that will handle all interactions with the MSSQL (2005) database. We are a bit perplexed as to how to capture all of the ‘who done it’ information that is required by our users in some of our legacy audit tables. While we could pass in the users name that was modifying data and log the call, we have some legacy tables that we will be using which have triggers to capture the system_user on record inserts, updates, and deletes. We also enlist some row level security in some places that we would also like to leverage without changing the code if possible. I have read that some are using contextinfo to store the user, but that seems a little less than secure in this situation.

The option that I like best is using the execute as user on a per stored procedure call basis

execute sp_myproc @foo as user = 'username'

The problem that we are running into is that within the entity framework it does not appear to be possible to add the execute as commands to the stored procedure calls.

Thanks for any input.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:22:32+00:00Added an answer on May 16, 2026 at 6:22 am

    “EXECUTE AS” does not support procedure calls (it would be in the actual proc definition). Only remote or dynamic SQL.

    Options:

    • Any middle tier has to pass the end user as a parameter.
      We do this for our web services and GUIs where there is no direct connection to the database

    • Enable server delegation so each server can pass through the end user credentials. Basically “impersonation” in asp.net.

    • Issue a separate command first

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an application with a service layer that operates on a domain model.
I'm developing Web Service that has access to database via JDBC. I'm using DAO
I'm new to MVVM. Currently I'm developing a WPF project in C# that will
I am developing a new business application which will require a business layer and
We're developing a service that will accept a POST request. Some of the POST
I'm developing a Rest service. Some external system sends me an XML file which
I am developing a WCF service which will be consumed by multiple different client
My team is developing a service layer in java and a GUI in dot-net,
I am developing a WCF service which follows MSDN's service archetype . That said,
We are developing an 3-tier application where presentation layer communicates with service layer, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.