当前位置:编程学习 > C#/ASP.NET >>

如何获取虚拟路径?

比如我现在将www文件夹设置为虚拟路径,然后我在www文件夹下面家里ss文件夹,里面有个文件为index.aspx,访问的时候通过localhost/www/ss/index.aspx访问,那么如何获得index.aspx的路径的虚拟路径,也就是www/ss/?关键是文件所在地不相同,因此能否有一个通用的办法或者通用的函数?? --------------------编程问答-------------------- 如何做呢? --------------------编程问答-------------------- 也正为这个烦恼,顶! --------------------编程问答-------------------- Server.MapPath 用这个取物理路径 --------------------编程问答-------------------- 怎样获取虚拟路径 --------------------编程问答-------------------- 登录 sql plus 时提示这样的错误
invalid username/password;logon denied
这是什么原因…… --------------------编程问答--------------------         /// <summary>
        /// 获取虚拟路径
        /// </summary>
        public static string VirtualPath
        {
            get
            {
                string virtualPath = System.Web.HttpContext.Current.Request.ApplicationPath;

                if (virtualPath == "/")
                {
                    return "";
                }
                else
                {
                    return virtualPath;
                }
            }
        }
--------------------编程问答-------------------- 获取网页的虚拟路径: Request.RawUrl; --------------------编程问答--------------------  Request.ApplicationPath --------------------编程问答-------------------- 在oracle中怎样设置主键,然后让他自动增长 --------------------编程问答-------------------- identity(1,1) --------------------编程问答-------------------- 看看这个类 Request.Url


AbsoluteUri 就是虚拟路径
--------------------编程问答-------------------- Request.ApplicationPath
Server.Mappath
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,