View Single Post
  #1 (permalink)  
Old November 20th, 2008, 12:09 PM
xile xile is offline
Registered User
 
Join Date: Nov 2008
Location: , , Canada.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default impersonation through web.config and runtime

I should save files on a LAN location through an asp.net 1.1 page. The web app. uses by default NETWORK SERVICE account which is not allowed to access that LAN, but my account domain/userid is can do it. Everything is ok when I impersonate the app using in web config <identity impersonate="true" userName="accountname" password="password" /> my credentials. But having in clear the pwd is not nice, so later I've tried to copy the file in LAN through a runtime impersonation using the code find under http://support.microsoft.com/kb/306158 - Impersonate a Specific User in Code, but doesn't work. Any idea? It looks like the problem is when the function LogonUserA(userName, domain, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, token) fails returning returns code 1385.
Just to mention that I cannot see and modify settings on the web server due to corporate security policy.