正文
asp.net获取本地文件路径,aspnet get提交 获取
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
ASP.NET如何获取文件夹路径(注意不是文件)
Path.GetDirectoryName(string pathName);方法可以获取指定的完整物理路径的文件夹名称。
string str5=Application.StartupPath;//获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。string str6=Application.ExecutablePath;//获取启动了应用程序的可执行文件的路径,包括可执行文件的名称。
用这个控件就可以了FileUpload 你也可以选择用个button来触发他。
首先用Server.MapPath(~)得到网站根目录,也就是web.config所在目录,然后用相对目录定位到其他目录。
我现在又显示它的方法了 ,就是要传个文件路径的参数进来。
怎样在ASP.NET中获取物理路径
1、方法HttpRuntime.AppDomainAppPath.ToString();//获取承载在当前应用程序域中的应用程序的应用程序目录的物理驱动器路径。
2、Path.GetDirectoryName(string pathName);方法可以获取指定的完整物理路径的文件夹名称。
3、Server.MapPath 所获得的路径都是服务器上的物理路径,也就是常说的绝对路径。
4、Server.MapPath(文件夹名称)将指定的虚拟路径映射到物理路径。
5、我现在又显示它的方法了 ,就是要传个文件路径的参数进来。
6、在类中这样写:当前项目的物理路径嘛:strPath = this.Server.MapPath(Request.PhysicalApplicationPath);你要说明什么“类文件”。任何PAGE、CONTROL代码也是在类中的。
asp.net获取控制台应用程序路径
Server.MapPath 所获得的路径都是服务器上的物理路径,也就是常说的绝对路径。
aspx配置文件路径一般指的是web.config文件,它是ASP.NET应用程序的配置文件,包含了应用程序的各种配置信息,如连接数据库的字符串、错误处理页面、Session状态设置等等。
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase-获取和设置包括该应用程序的目录的名称。 System.Windows.Forms.Application.StartupPath-获取启动了应用程序的可执行文件的路径。效果和5一样。
不是路径的问题,是ASP.NET安全问题。在IIS环境下,客户端与服务器之间不能直接地相互调用任何一种EXE(无论是WinForm还是Console,同样不能在CMD.EXE中调用他们)。
在Visual Studio 2005中开发;步骤;1)利用Visual Studio 2005创建一个web站点。2)利用Visual Studio 2005工具箱中的控件,根据程序的要求合理的设计应用程序界面。3)设置相关控件的属性。4)编写有关控件的事件代码。
asp.net获取本地文件路径的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于aspnet get提交 获取、asp.net获取本地文件路径的信息别忘了在本站进行查找喔。