how can i run app under specific windows credentials


I have 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?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan McCauleyData and Analytics ManagerCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.