[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

how can i run app under specific windows credentials


I have asp.net application which set to authentication as "windows"(integrated) in web.config. I want to give source code to user whose machine is not part of domain. however, there is domain account created for him. How can i make application run under that account under integrated authentication? Can i hard code it somewhere?

1 Solution
Ryan McCauleyCommented:
If your ASP.NET app is using integrated authentication, then it uses the credentials of the app pool that the IIS application is configured to use. If you're running the code from Visual Studio, the app will run as the user who executes it. If you've given the source code to another user who isn't on the domain and they execute it, it will attempt to use their account to execute the code and connect to your domain resources. Since they're not on the domain, their credentials will translate to "Anonymous logon" or "Guest"-type credentials, which likely don't have any rights.

Another option you might have, though, is a handy switch with the RUNAS tool - running it with "/netonly" like this:

RUNAS /netonly /user:ServerDomain\ServerAppUser devenv.exe

Most people don't know about that switch - it does two important things:

1. It launches the process as the currently logged-in user. This allows the app to run normally on the local machine.
2. When the app attempts to access a remote resource, it passes the credentials provided on the command line. In this way, a local process can be set to access other devices as a user of a domain of which they're not even a member.

I use this all the time when I launch SQL Management Studio because we have a few servers on a different domain - using this switch, I can log into those servers using integrated authentication even though they're on a different domain.

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now