如何获取服务器的文件夹,例如: 170.1.1.1在C:\中有一个文件夹信息,使用c#有办法获取服务器的C:\信息驱动器吗?
我不能得到它的权利吗?
发布于 2010-07-31 04:58:34
如果此文件夹或c:\上没有共享,但运行应用程序的用户拥有管理员权限,请尝试打开\\IP-Address\c$\info\filename.txt
string path = @"\\IP-Address\c$\info\filename.txt"
if (File.Exists(path)){
using (StreamReader sr = File.OpenText(path)){
string s = "";
while ((s = sr.ReadLine()) != null)
{
Console.WriteLine(s);
}
}}
发布于 2010-07-31 04:56:58
只有在该服务器以某种方式共享该文件夹的情况下。你是在说将其作为网络共享进行浏览吗?从web服务器获取目录列表?
发布于 2017-05-30 11:24:15
使用工具folderBrowseDialog和into属性将SelectedPath更改为所需的IP地址。
如果您使用按钮激活代码,请插入此内容。
private void button1_Click_1(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
txtfilename.Text = folderBrowserDialog1.SelectedPath;
}
}希望它能帮上忙。
https://stackoverflow.com/questions/3375292
复制相似问题