[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 603
  • Last Modified:

Access to the path is denied.

I have a webpage with the following process that executes during a page load:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim writer As New StreamWriter("\\websrv\Inetpub\wwwroot\kmlTest\hello.txt")
        writer.Write("Why hullo thar")
        writer.Close()
    End Sub

As you can see, I'm attempting to write to folder being held on another server in my local network. When I access the page, I get the following error:

Access to the path '\\websrv\Inetpub\wwwroot\kmlTest\hello.txt' is denied.

I immediately knew this would be corrected by going to the folder kmlTest on the webSrv and granting the correct permission(s). I granted the user "Network Service" permission with full control and no luck. I have tried to add so many different users but I still can't figure out way it is denying.

I would sincerely appreciate any efforts to help with this problem!
0
dcmorrell
Asked:
dcmorrell
1 Solution
 
Tray896Commented:
If you are using anonymous access then the issue is probably due to the anonymous account you are running under does not have sufficient permissions to the location you are writing to.  You can try running the anonymous account as a domain account rather than the default IUSR, and give that account write permissions to the network location.  Or, if you aren't using anonymous and are instead using integrated authentication, give the Authenticated Users group (or limit to a select domain group) write permissions to that location.

Another thing you may want to play around with is giving write permissions within IIS.  This is done by going to the properties of your website-->home directory tab.
0
 
liorfrCommented:
Actually it is not the "Network Service" that need's the permission it is your computer.
Try giving "full control" to your computer name on that folder.
0
 
Springy555Commented:
Two things to do to get this working.

Assume the IIS server that hosts this webpage is called iisserver.

On the other server (websrv in your example), you have shared out the inetpub directory.  You need to ensure that the iisserver computer account has full control to this share.  Do this by modifying the share permissions and add computer account iisserver$

Also add this account (iisserver$) to the ntfs permissions of the kmlTest folder.  Remember, when adding this computer account, you need to select the 'Object Types...' button and tick the computer checkbox, otherwise it wont find the computer account.

This also assumes iisserver and websrv are on the same domain.
0
 
waltersnowslinarnoldCommented:
Give full control to kmlTest folder which is in the following path specified.,

\\websrv\Inetpub\wwwroot\kmlTest\hello.txt"

now you application creeps fine..
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now