Reputation: 1164
Basically I'm needing to do this in app.config:
<system.web>
<identity impersonate="true" userName="Username" password="Password"/>
</system.web>
How do I accomplish this? Currently been researching this with no luck? any help would be very much appreciated
Upvotes: 0
Views: 1339
Reputation: 11063
USe NetworkCredential
class:
NetworkCredential myCred = new NetworkCredential(
SecurelyStoredUserName,SecurelyStoredPassword,SecurelyStoredDomain);
It will allow you to enter websites, access remote shared folders , etc...
By the way, what are you trying to achieve?
Upvotes: 1
Reputation: 56697
You can not impersonate another user like that in a desktop application. Look into impersonation. One question that might help you is this one. This entry on CodeProject implements a C# class that helps you impersonate another user.
Upvotes: 0