怎样在局域网内另一台机器上生成文件?

xingzichu 2004-10-26 01:23:14
我现在这样:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String = "你的字符串"
Dim f As New FileStream("C:\Temp.txt", FileMode.Create)
Dim b() As Byte
b = Encoding.Default.Default.GetBytes(s)
f.Write(b, 0, b.Length)
f.Close()
f = Nothing
b = Nothing
End Sub

能在自己机器上的C盘生成Temp.txt。

但我想将文件都生成在局域网的另一台机器“A1”上“share”文件夹内。

如果这样写:
Dim f As New FileStream("\\A1\share\Temp.txt", FileMode.Create)
会报错:登录失败: 未知的用户名或错误密码。

这怎么解决?
谢谢。
...全文
183 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
2003xp 2004-11-01
  • 打赏
  • 举报
回复
关注!!!
fungchou 2004-11-01
  • 打赏
  • 举报
回复
哈哈,我也遇到过这种情况,参见:
http://community.csdn.net/Expert/topic/3496/3496940.xml?temp=.7555811
xingzichu 2004-11-01
  • 打赏
  • 举报
回复
自顶
xingzichu 2004-10-27
  • 打赏
  • 举报
回复
各位,还是不行啊
xiaomaoworks 2004-10-26
  • 打赏
  • 举报
回复
用户是默认GUEST登陆的~
farrio 2004-10-26
  • 打赏
  • 举报
回复
感觉如果是ntfs系统,需要把那个共享的目录权限设置上,就是这个目录允许你的机器进行操作。如果是fat32系统就不知道了。
P_Niker 2004-10-26
  • 打赏
  • 举报
回复
你需要用Socket连接之后方可操作,例如:
Dim IpHostInfo as IpHostEntry = DNS.Resolve("192.168.0.1")
Dim IpAddress as Ipaddress = Iphostinft.ipaddresslist(0)
Dim RemoteEP as new Ipendpoint(IpAddress,135)
Dim Senders as new Socket(AddressFamily.InterNetwork, SocketType.Stream,_ ProtocolType.Tcp)
Sender.connect(RemoteEP)

这样你就可以连接Internet或者互连网的机器了,当然,如果对方的机器需要你输入用户名和密码的话,你还必须在程序代码中加上,完。
xingzichu 2004-10-26
  • 打赏
  • 举报
回复
to:alexzhang00(三角猫)

不需要啊。我从网上邻居都可以打开,还能新建文档。
DeltaCat 2004-10-26
  • 打赏
  • 举报
回复
另一台机器需要用户名密码才能访问吧

16,555

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧