如何设置根路径? [英] How Can I Set Root Path?

查看:67
本文介绍了如何设置根路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:

System.Diagnostics.Process.Start(D:\\ MyFiles \\ MyNotepad.txt);



这是从本地系统获取根路径



但我需要从服务器获取根路径



例如:





System.Diagnostics.Process.Start(192.168.1.10:\ \ RTest \\MyFiles \\ MyNotepad.pdf);





但显示错误系统无法找到指定的文件





提前致谢。

解决方案

你的路径不正确,应该如 https://social.msdn.microsoft.com/Forums/en-US/fb527e4b-87cb-42f0-8965-a78cb0ba3204/what-is-the-network-path?forum=winforms [ ^ ]。


使用

 Process.Start(Server.MapPath(  RTest / MyFiles / MyNotepad.pdf)); 



希望它有效。快乐编码! :)


example:
System.Diagnostics.Process.Start("D:\\MyFiles\\MyNotepad.txt");

This is for get the root path from a local system

but i need to get the root path from server

for eg:


System.Diagnostics.Process.Start("192.168.1.10:\\RTest\\MyFiles\\MyNotepad.pdf");


but showing error "The system cannot find the file specified"


Thanks in advance.

解决方案

Your path is not correct, it should be as described in https://social.msdn.microsoft.com/Forums/en-US/fb527e4b-87cb-42f0-8965-a78cb0ba3204/what-is-the-network-path?forum=winforms[^].


Use

Process.Start(Server.MapPath("RTest/MyFiles/MyNotepad.pdf"));


Hope it works.Happy Coding! :)


这篇关于如何设置根路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆