Reputation: 4130
Who is the user/identity which executes the function specified within a Task.Run? Is it the application pool?
Upvotes: 1
Views: 111
Reputation: 54628
Is it the application pool?
Yes. There are a few exceptions, but that would be you making it do something different, then you would know because you wrote it. Otherwise:
Task.Run()
Will execute on the current thread or a new thread with the same Credentials (as the thread that spawned the new thread).
Don't confuse the Threads credentials (app pool, or configured otherwise in the web.config) with the HttpContextBase.User Property which is the person who made the request.
All threads run as configured in the web.config, unless you've explicitly change that threads credentials.
(I say otherwise configured as you could use IIS Impersonation to allow the thread to impersonate the HttpContextBase.User
but please don't ever use impersonation).
Upvotes: 1