Results 1 to 2 of 2

Thread: ASP.NET checking existing network folder

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Location
    Phoenx, AZ
    Posts
    15

    ASP.NET checking existing network folder

    I'm using asp.net with visual basic .net as the code behind. I want to be able to check to see if a folder on another computer exists. Now with the code I supplied below it works locally, but I cannot get it to work with a network share. Now I can access the network share from the computer I making the call from by going through network places. Also if I type the foldername that I provided into the address bar of explorer the foldername is brought up in explorer

    This is the code I have been using:

    foldername = "\\ServerName\Share\FolderName"

    <code>
    If Directory.Exists(folderName) = False Then
    'Directory.CreateDirectory(folderName)
    Response.Write("<br> Folder was Not Found <br>")
    Response.Write(Directory.Exists(folderName).ToString)
    Else
    Response.Write("<br> Folder was Found")
    End If
    </code>

    Thanks in advance

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Any web application running ASP.NET by default uses the ASP.NET user account, which is created when the framework is installed (or NETWORK SERVICE on certain OS's).

    This account does not normally have permissions to access network shares. This is a lock-down profile by default. In this manner, someone could not hijack your application and gain access to an internal network.

    When you use Windows Explorer to browse to your Network Places, you are using permissions given to you by your user account assigned to you when you logged in to the Operating System. So you inherently have permissions to see these places.

    Depending on how you handle authentication in your web application, you could have the ASP.NET account impersonate (if you use Windows Authenitcation ) a user account that exists on your internal network.
    So if you logged in to the web application with your user account (that you use when you log in to the OS), and the web application is set to impersonate, then you would be able to access the network shares. This is set in your web.config file under the authentication section.

    The other option, for other types of authentication used by .net web applications is to explicity give to the ASP.NET user account permissions to access the network shares. You would limit this as much as possible, because giving it modify permissions could be a security threat if someone hijacked your .net web application. Therefore you only give it read access if it only needs to read, and so forth.
    These settings are usually done in Computer Management applet in your control panel under groups and users.

Posting Permissions

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



Click Here to Expand Forum to Full Width