Results 1 to 3 of 3

Thread: Network Folder Access in Windows Service

  1. #1
    WAK
    WAK is offline VB.NET Forum Newbie
    .NET Framework
    .NET 1.1 (VS 2003)
    Join Date
    Jun 2006
    Posts
    2
    Reputation
    0

    Network Folder Access in Windows Service

    Hi

    I am writing a windows service which is supposed to write some files on a network shared folder.

    Through my research on net I came to know that I need to run this service under the same NetworkService account which has permission on Network shared folder. I set the UserName and Password in Project Installer File.

    I run the service using UNC convention to access the network shared folder and got Path Not Found error.

    Than I manually mapped the shared folder using the same domain account which I set to run the service and tried to use the Shared Drive path to access the destination folder and got the same Path Not Found error.

    Now reading different posts on net about similar problem I came to know I can map the shared folder programatically in my windows service using WMI. I want to know someone succeeded to access the network resource in Windows service or not? If yes than how?

    I am stuck. Please Help.

    Thanks is advance

    Regards

    Wajid

  2. #2
    WAK
    WAK is offline VB.NET Forum Newbie
    .NET Framework
    .NET 1.1 (VS 2003)
    Join Date
    Jun 2006
    Posts
    2
    Reputation
    0

    No Worries I got it

    Posting solution hope it will be helpfull for others.

    1) Service account will remain same to LocalSystem.

    2) You need to map the shared folder(mapped drive) inside your web service using
    Win32 API mpr.dll

    Method in API --> WNetAddConnection2A

    this method needs parameters like Domain UserName and Password.

    Later use that mapped drive letter to read, write or what ever you are allowed by this Domain User.

    Cheers

  3. #3
    mpals is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Nov 2005
    Posts
    13
    Reputation
    94
    Hello,
    I have the same problem. Can you give a sample code .
    I'm trying to apply what you say in last post.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking