I have a VB .NET app that lets you create a DTS Package that copies data from
an SQL Server to a database located in the specified path (it should work
with both local and network drives). You can either run the package from
within the application or as a Windows service. If I specify a network drive
and run the package from the app, the data is being copied fine, but the
service gives me "Table not accessible" error. My understanding is I have to
configure my Windows service to run with the proper domain user account. In
other words, I need to set my service to log in with an account with the
appropriate permissions to the network path I want to access. What's the
syntax for that? What functions do I have to use? I could not find any sample
code.

Thank you for help.

RE: How to access a network drive from a Windows service? by Eve

Eve
Mon Nov 20 10:44:02 CST 2006

My service was able to access the network drive after I unchecked "Local
System account" and specified my network account through Administrative
Tools/Services, but is there a way to let the user specify the account
through the application?

Re: How to access a network drive from a Windows service? by sloan

sloan
Mon Nov 20 11:24:06 CST 2006

Try these:

http://www.codeproject.com/csharp/zetaimpersonator.asp

http://www.codeproject.com/csharp/cpimpersonation1.asp

http://msdn2.microsoft.com/en-us/library/ms731090.aspx

you'll at least see the concepts of impersonation.

Note, impersonate in a asp.net application is easy, but not so with a
winforms, console or service application.




"Eve" <Eve@discussions.microsoft.com> wrote in message
news:810397B0-3C3F-4F64-B2EC-E342895381E8@microsoft.com...
> My service was able to access the network drive after I unchecked "Local
> System account" and specified my network account through Administrative
> Tools/Services, but is there a way to let the user specify the account
> through the application?