I have an ASP.Net MVC controller action that instantiates a DataContext object and I am currently passing the connection string directly into the constructor. I am using Impersonation and I have verified the current user in the controller action is the current Windows Auth. user of the web app, however when running a SQL Trace the query always runs as Network Service. The data context object is referenced in another project from the web application but I am passing the connection string directly into the constructor so this should not be an issue. Here is what is currently in the controller action:
// verified the user is the current Windows Auth. user of the web app
var user = this.User;
var connectionString = "Data Source=serverName;Initial Catalog=dbName;Integrated Security=true";
var context = new CustomDataContext(connectionString);
var test = context.Customers.Select(i => i.fullname).ToList();
Everything is getting to the database fine except for the fact that the query always runs as Network Service instead of the current user. Any ideas on why this is the case and how to resolve?