文件上传 路径 获取的问题
错误信息:http://192.168.1.13:8080/Sound' is not a valid virtual path
我想向这个目录http://192.168.1.13:8080/Sound上传文件 ,如何获得这个目录的绝对路径呢?
用Server.MapPath()总是报错告诉我不是有效的虚拟路径 --------------------编程问答-------------------- 1.Server.MapPath("/") 应用程序根目录所在的位置 如 C:\Inetpub\wwwroot\
2.Server.MapPath("./") 表示所在页面的当前目录
注:等价于Server.MapPath("") 返回 Server.MapPath("")所在页面的物理文件路径
3.Server.MapPath("../")表示上一级目录
4.Server.MapPath("~/")表示当前应用级程序的目录,如果是根目录,就是根目录,如果是虚拟目录,就是虚拟目录所在的位置 如:C:\Inetpub\wwwroot\Example\
注:等效于Server.MapPath("~")。
5.Server.MapPath("abc/")表示当前站点目录下的abc目录 --------------------编程问答-------------------- Request.PhysicalApplicationPath取到绝对路径 --------------------编程问答-------------------- Server.mapPath("~/") --------------------编程问答-------------------- Server.MapPath(@"~/Sound/" + "abc.gif") --------------------编程问答-------------------- Server.MapPath("/") Server.MapPath("~")得到当前应用程序根目录的物理路径
Server.MapPath(".")得到当前目录的物理路径
Server.MapPath("..")得到父目录的物理路 --------------------编程问答-------------------- 网站绝对路径VirtualPathUtility.ToAbsolute("~/");
HttpRuntime.AppDomainAppVirtualPath;
Request.ApplicationPath;
Page.ResolveUrl("~");
--------------------编程问答-------------------- 上传的web程序 和 目的地址 不是一个 不是一个程序,能传么?
也就是说 知道另个网站的路径http://192.168.1.13:8080/Sound,能否向别的网站目录下传文件
绝对地址获取的问题
--------------------编程问答-------------------- 上传程序和目的地址 是2个网站,可能在同一台机器上 --------------------编程问答-------------------- http://192.168.1.135:8080
也就是说,上传程序不是在这个ip和端口下运行的。不知道说明白了没有? --------------------编程问答--------------------
真详细 --------------------编程问答--------------------
++ --------------------编程问答-------------------- --------------------编程问答-------------------- Request.ApplicationPath;
--------------------编程问答-------------------- HttpContent.Current.server.Mappath()
补充:.NET技术 , ASP.NET