错误:找不到网络路径 [英] Error : The network path was not found
本文介绍了错误:找不到网络路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我提供的代码是通过连接lan网络将txt文件从服务器m/c复制/读取到客户端m/c.但是出现错误消息,即(未找到网络路径.)我该如何解决此问题.请给我尽快提供正确的答复.我的代码如下...
My supplied code is that to copy/read the txt file from server m/c to client m/c through connecting lan Network. But arrise error message i.e.(The network path was not found.) how can i solve this problem. Please give me to supply currect response as early as possible.My code is given below...
Imports System
Imports System.Runtime.InteropServices
Imports System.Security.Principal
Imports System.Security.Permissions
Public Class Form1
<dllimport("advapi32.dll",> _
Public Shared Function LogonUser(ByVal lpszUsername As String, ByVal lpszDomain As String, _
ByVal lpszPassword As String, ByVal dwLogonType As Integer, ByVal dwLogonProvider As Integer, _
ByRef phToken As IntPtr) As Integer
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim admin_token As IntPtr
Dim wid_current As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim wid_admin As WindowsIdentity = Nothing
Dim wic As WindowsImpersonationContext = Nothing
Try
MessageBox.Show("Copying file...")
' ''If LogonUser("Local Admin name", "Local computer name", "pwd", 9, 0, admin_token) <> 0 Then
If LogonUser("SNEHASIS\Administrator", "SNEHASIS", "", 9, 0, admin_token) <> 0 Then
wid_admin = New WindowsIdentity(admin_token)
wic = wid_admin.Impersonate()
System.IO.File.Copy("C:\file.txt", "\\192.168.1.10\c\right.txt", True) ''157.60.113.28
MessageBox.Show("Copy succeeded")
Else
MessageBox.Show("Copy Failed")
End If
Catch se As System.Exception
Dim ret As Integer = Marshal.GetLastWin32Error()
MessageBox.Show(ret.ToString(), "Error code: " + ret.ToString())
MessageBox.Show(se.Message)
Finally
If wic IsNot Nothing Then
wic.Undo()
End If
End Try
End Sub
End Class
我正在等待响应,因为这对我来说非常重要.
I waiting for response because it is very important for me.
推荐答案
除非您为共享指定了特定名称,否则应使用以下名称:
\\192.168.1.10\c
Unless you gave your share a specific name, this is what you should use:
\\192.168.1.10\c
\right.txt
您忘记了驱动器号后的
\right.txt
You forgot the
.
这篇关于错误:找不到网络路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文