Dreaded Access to path is denied message

Results 1 to 2 of 2

Thread: Dreaded Access to path is denied message

  1. #1
    Join Date
    Dec 1969

    Default Dreaded Access to path is denied message

    Hello,<BR><BR>I&#039;m getting the that dreaded message as above - I&#039;ve read up in the FAQs (no 205) and follows its advice. Basically I have given the ASPNET machine account full control of the appropriate directories but still having problems. My code goes like this:<BR><BR><BR>Private Function chkFileExists(ByVal filespec) As Boolean<BR> Dim fso<BR> fso = CreateObject("Scripting.FileSystemObject")<BR> If fso.fileexists((filespec)) Then<BR> chkFileExists = True<BR> Else<BR> chkFileExists = False<BR> End If<BR> End Function<BR><BR><BR> Private Function GetFileName(ByVal strPath)<BR> Dim fso<BR> fso = CreateObject("Scripting.FileSystemObject")<BR> GetFileName = fso.GetFileName(strPath)<BR> End Function<BR><BR> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<BR> Dim strPath As String<BR> Dim strFileName As String<BR> Dim strFullFileName As String<BR> Dim strSavePath As String<BR> &#039; This sets the path where the image is to be saved<BR> strSavePath = Server.MapPath("RockinghamImages\" + strSuppCode + "\")<BR> If Not (File1.PostedFile Is Nothing) Then<BR> Try<BR> &#039; Get the path of posted file<BR> strPath = File1.PostedFile.FileName<BR> &#039; Get the filename of posted file<BR> strFileName = GetFileName(strPath)<BR> &#039; Check if file exists on server<BR> If chkFileExists(strSavePath + strFileName) = True Then<BR> &#039; Run sub-routine t update tblImages as appropriate<BR><BR> SaveFileName(strFileName, "Update")<BR> Else<BR> SaveFileName(strFileName, "Append")<BR> End If<BR><BR> &#039; Save the posted file in Images directory<BR> File1.PostedFile.SaveAs((strSavePath + strFileName))<BR><BR> <BR> Response.Write(strSavePath + strFileName)<BR> Catch exc As Exception<BR> Response.Write("Fail" & exc.Message & exc.StackTrace)<BR> End Try<BR> End If<BR> End Sub<BR><BR>Is there anything obvious that I am doing wrong?<BR><BR>Many Thanks<BR><BR>Dan

  2. #2
    Join Date
    Dec 1969

    Default RE: Dreaded Access to path is denied message

    Have only scanned your text, but shouldn&#039;t this:<BR>strSavePath = Server.MapPath("RockinghamImages\" + strSuppCode + "\") <BR><BR>be this.<BR><BR>strSavePath = Server.MapPath("/Rockingham/Images/" + strSuppCode + "/") <BR><BR>?

Posting Permissions

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