Permissions to save files in servicor from program in Visual Studio

0

It turns out that I can not save files automatically from my program on the server since I lack the permissions to access it, because I guess I have a password. The error says: "Login failed: the user does not have permissions for the type of login requested on the computer".

Here the code:

Dim cancelado As Boolean = False
    Dim openFD As New OpenFileDialog

    With openFD
        .Title = "Seleccionar archivo"
        .Filter = "Todos los archivos (*.*)|*.*"
        .Multiselect = False
        .InitialDirectory = My.Computer.FileSystem.CurrentDirectory
        If .ShowDialog = Windows.Forms.DialogResult.OK Then
            txtArchivo.Text = IO.Path.GetFileName(.FileName)
            Dim pathDefinitivo As String = "\192.168.1.251\prueba\"
            Dim fichero As New System.IO.FileInfo(pathDefinitivo & "\" & txtArchivo.Text)
            If fichero.Exists Then
                If MessageBox.Show("El archivo seleccionado ya está incluido" & ControlChars.NewLine & "¿Desea sobreescribirlo?", "Atención", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
                    cancelado = True
                Else
                    System.IO.File.Delete(fichero.FullName)
                End If
            End If
            If Not cancelado Then
                System.IO.File.Copy(.FileName, fichero.FullName)
            End If
        End If
    End With
    
asked by Pancho 16.05.2018 в 19:09
source

0 answers