1

I am trying to give the ability of creating image galleries for each ASP.Net user, where:

All folders are under a specific sub folder ~\uploads

Each gallery will have a specific folder named by the GalleryID.

Each folder should be modifiable by the admin or the user who created it only.

In code behind i used:

        Dim GPath As String = _
        System.IO.Path.Combine("~\Uploads\", GetGalleryID()))
        System.IO.Directory.CreateDirectory(GPath)

This code throws:

Access to the path '~\Uploads\22' is denied.

a suggested solution Here says :

Grant permission to create directories and files (read/write/modify/...) to the worker process group (sysname\iis_wpg) to the parent directory.

I am using IIS 7.5 under Windows server 2003 and i couldn't find the iis_wpg? I've applied the solution on IIS_IUSERS but it doesn't seem to be working.

Any Solution?

1 Answer 1

3

Your problem is that ~\Uploads\ is a url. You need to map that into a physical path on server file system. Use Server.MapPath for this

Dim GFolder As String = Server.MapPath("~\Uploads\")
Dim GPath As String = System.IO.Path.Combine(GFolder, GetGalleryID()))
Sign up to request clarification or add additional context in comments.

1 Comment

Correct! I don't know how i missed that, iis_wpg confused me. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.