关于服务器路径的问题 指定了路径 @"\\192.168.1.252\工作平台\公司大共享\网络部\.. 在本地调试时可以找到这个路径但是发布了之后发现找不到这个路径了?这是怎么回事?另外我想问下我怎么能获得客户端的桌面路径并在客户端创建txt文件?各位大侠帮帮忙… 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 发布后IP不对吧。Server.MapPath("XXX"); 问题理解: 你调试时是在本地,故你的IP地址 就是 :192.168.1.252 可以找到,但是在服务器上找到这个位置找不到的,不知道是否正确,问题:获得客户端的桌面路径using Microsoft.Win32;namespace JPGCompact{ public partial class MainForm : Form { private void Test() { RegistryKey folders; folders = OpenRegistryPath(Registry.CurrentUser, @"\software\microsoft\windows\currentversion\explorer\shell folders"); // Windows用户桌面路径 string desktopPath = folders.GetValue("Desktop").ToString(); // Windows用户字体目录路径 string fontsPath = folders.GetValue("Fonts").ToString(); // Windows用户网络邻居路径 string nethoodPath = folders.GetValue("Nethood").ToString(); // Windows用户我的文档路径 string personalPath = folders.GetValue("Personal").ToString(); // Windows用户开始菜单程序路径 string programsPath = folders.GetValue("Programs").ToString(); // Windows用户存放用户最近访问文档快捷方式的目录路径 string recentPath = folders.GetValue("Recent").ToString(); // Windows用户发送到目录路径 string sendtoPath = folders.GetValue("Sendto").ToString(); // Windows用户开始菜单目录路径 string startmenuPath = folders.GetValue("Startmenu").ToString(); // Windows用户开始菜单启动项目录路径 string startupPath = folders.GetValue("Startup").ToString(); // Windows用户收藏夹目录路径 string favoritesPath = folders.GetValue("Favorites").ToString(); // Windows用户网页历史目录路径 string historyPath = folders.GetValue("History").ToString(); // Windows用户Cookies目录路径 string cookiesPath = folders.GetValue("Cookies").ToString(); // Windows用户Cache目录路径 string cachePath = folders.GetValue("Cache").ToString(); // Windows用户应用程式数据目录路径 string appdataPath = folders.GetValue("Appdata").ToString(); // Windows用户打印目录路径 string printhoodPath = folders.GetValue("Printhood").ToString(); } private RegistryKey OpenRegistryPath(RegistryKey root, string s) { s = s.Remove(0, 1) + @"\"; while (s.IndexOf(@"\") != -1) { root = root.OpenSubKey(s.Substring(0, s.IndexOf(@"\"))); s = s.Remove(0, s.IndexOf(@"\") + 1); } return root; } }}建立文件:百度吧 上面的我就是百度的! 经验丰富的老鸟请进。。。。求解(乐讯面试) DataGrid超连接列多参数问题,请大家帮忙! 如何对DataSet的Rows循环操作 求一正则 如何更新到asp.net 2.0? 关于虚拟目录中asp.net文件不能访问!!! 如何在单击删除按扭后弹出一对话框(询问是否删除?)?? ASP.NET登录代码实现 C# 向javascripts传值的问题 求助 怎么调用另一个项目的页面 js如何判断浏览器是手机的还是PC机? ..这个身份验证权限貌似写死了,该怎么改啊
Server.MapPath("XXX");
namespace JPGCompact
{
public partial class MainForm : Form
{
private void Test()
{
RegistryKey folders;
folders = OpenRegistryPath(Registry.CurrentUser, @"\software\microsoft\windows\currentversion\explorer\shell folders");
// Windows用户桌面路径
string desktopPath = folders.GetValue("Desktop").ToString();
// Windows用户字体目录路径
string fontsPath = folders.GetValue("Fonts").ToString();
// Windows用户网络邻居路径
string nethoodPath = folders.GetValue("Nethood").ToString();
// Windows用户我的文档路径
string personalPath = folders.GetValue("Personal").ToString();
// Windows用户开始菜单程序路径
string programsPath = folders.GetValue("Programs").ToString();
// Windows用户存放用户最近访问文档快捷方式的目录路径
string recentPath = folders.GetValue("Recent").ToString();
// Windows用户发送到目录路径
string sendtoPath = folders.GetValue("Sendto").ToString();
// Windows用户开始菜单目录路径
string startmenuPath = folders.GetValue("Startmenu").ToString();
// Windows用户开始菜单启动项目录路径
string startupPath = folders.GetValue("Startup").ToString();
// Windows用户收藏夹目录路径
string favoritesPath = folders.GetValue("Favorites").ToString();
// Windows用户网页历史目录路径
string historyPath = folders.GetValue("History").ToString();
// Windows用户Cookies目录路径
string cookiesPath = folders.GetValue("Cookies").ToString();
// Windows用户Cache目录路径
string cachePath = folders.GetValue("Cache").ToString();
// Windows用户应用程式数据目录路径
string appdataPath = folders.GetValue("Appdata").ToString();
// Windows用户打印目录路径
string printhoodPath = folders.GetValue("Printhood").ToString();
} private RegistryKey OpenRegistryPath(RegistryKey root, string s)
{
s = s.Remove(0, 1) + @"\";
while (s.IndexOf(@"\") != -1)
{
root = root.OpenSubKey(s.Substring(0, s.IndexOf(@"\")));
s = s.Remove(0, s.IndexOf(@"\") + 1);
}
return root;
}
}
}
建立文件:百度吧 上面的我就是百度的!