5 Replies - 510 Views - Last Post: 28 February 2019 - 04:34 PM Rate Topic: -----

#1 lukeman   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 23-January 19

Access is Denied for shared folder

Posted 26 February 2019 - 02:15 AM

I'll try to copy my application using a shared folder and verify that application have a latest version or not. Anyone can help me what kind of error that I face because I don't know what to do!!! I just want to know how to fix it and it related in code or not?

Imports System.IO

Public Class Update
    Private Sub Update_Load(sender As Object, e As EventArgs) Handles MyBase.Load


    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        FileCompare(filename:="stop")
    End Sub

    Private Sub FileCompare(filename As String)
        Dim FilePath As String = ""

        Dim versionNow As String = "11"
        filename = "auto_" & versionNow & ".exe"
        Dim patha As String = "\\Cem-pc-110\luqman\MyApp\Updater\" & filename
        'Dim dir As String = "C:\Users\Administrator\Desktop\MyProject"

        FilePath = System.IO.Path.GetFileName(patha)
        'Dim savePath As String = Path.Combine(dir, FilePath)
        'Dim deru As String = Path.GetFileNameWithoutExtension(filename)
        If System.IO.File.Exists(patha) Then
            MsgBox("you have a latest version")

        Else
            MessageBox.Show("You have a new version!!!!")
            System.IO.File.Delete(" \\CEM-PC-092\Users\Administrator\Desktop\auto.exe")

            Try
                System.IO.File.Copy("\\Cem-pc-110\luqman\MyApp\Updater\auto.exe", " \\CEM-PC-092\Users\Administrator\Desktop\auto.exe")
                MsgBox("Update success")
            Catch ex As Exception
                MsgBox("error")
            End Try


        End If



    End Sub
End Class



Is This A Good Question/Topic? 0
  • +

Replies To: Access is Denied for shared folder

#2 andrewsw   User is offline

  • quantum multiprover
  • member icon

Reputation: 6776
  • View blog
  • Posts: 27,943
  • Joined: 12-December 12

Re: Access is Denied for shared folder

Posted 26 February 2019 - 02:19 AM

Please quote the exact error details and tell us what line(s) they refer to.

What have you discovered when searching the error message?
Was This Post Helpful? 0
  • +
  • -

#3 lukeman   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 23-January 19

Re: Access is Denied for shared folder

Posted 26 February 2019 - 05:13 PM

This error I face it and error show Access Path " \\CEM-PC-092\Users\Administrator\Desktop\auto.exe" is denied
Was This Post Helpful? 0
  • +
  • -

#4 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 209
  • View blog
  • Posts: 1,182
  • Joined: 05-December 13

Re: Access is Denied for shared folder

Posted 27 February 2019 - 11:23 AM

See this line of text in the signature above :: debug your VB code? Read it.

Second, I assume this is some form of auto updater?

If so, how are you distributing your application to your users? Network, internet, what? Where do your users acquire the new file?

Version now doesn't actually get the version...

This will be of help https://docs.microso...framework-4.7.2

Its obvious you are completely clueless to what you're doing. Please buy a book and read over the basics.

What do you think this is doing? System.IO.File.Copy("\\Cem-pc-110\luqman\MyApp\Updater\auto.exe", " \\CEM-PC-092\Users\Administrator\Desktop\auto.exe")

Why are you not getting the path of your users special folders? https://docs.microso...framework-4.7.2

Consider rewriting this from scratch after you've read up on what you're trying to do.
Was This Post Helpful? 0
  • +
  • -

#5 lukeman   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 23-January 19

Re: Access is Denied for shared folder

Posted 27 February 2019 - 07:50 PM

Yaa, finally someone get it what i want to do. Actually, I try to compare the version that I write myself and try to update the latest version using network with the all application version I put all of them in shared folder. The problem is,user cannot update the new version because access is denied. I'm new in vb.net and this is my task.
Was This Post Helpful? 0
  • +
  • -

#6 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 209
  • View blog
  • Posts: 1,182
  • Joined: 05-December 13

Re: Access is Denied for shared folder

Posted 28 February 2019 - 04:34 PM

Why do you want to use a version other than that provided by the executables? I can't think of any logical reason for doing so, and so you should use the version numbers of the application. They can be incremented with each release of your application. See for more information on versions :: https://docs.microso...framework-4.7.2

Since you want to get your new updated executable from a network, Add a reference to System.DirectoryServices and then implement some way to loop through the connected computers or if you know which network its on, specify it. Something like this might get you started :: https://www.dreaminc...ost__p__1176250

Post back with your updated code, when you've changed it if you still need help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1