• ASPNET下的路径辅助类


    using   System;
    using   System.Web;

    namespace   SysClassLibrary.Common
    {
    ///   <summary>
    ///   Application   的摘要说明。
    ///   网站相关路径信息
    ///   </summary>
    public   class   Application   :System.Web.HttpApplication
    {
    public   Application()
    {
    this.Init();
    }
    #region   初始化
    public   override   void   Dispose()
    {
    base.Dispose   ();
    }

    public   override   void   Init()
    {
    base.Init   ();
    }
    #endregion
    #region   相关参数
    ///   <summary>
    ///   应用程序对应物理目录
    ///   </summary>
    public   static   string   PhysicalApplicationPath
    {
    get
    {
    return   HttpContext.Current.Request.PhysicalApplicationPath;
    }
    }
    ///   <summary>
    ///   应用程序文件物理路径
    ///   </summary>
    public   static   string   PhysicalPath
    {
    get
    {
    return   HttpContext.Current.Request.PhysicalPath;
    }
    }
    ///   <summary>
    ///   应用程序虚拟目录名称
    ///   </summary>
    public   static   string   ApplicationPath
    {
    get
    {
    return   HttpContext.Current.Request.ApplicationPath;
    }
    }
    ///   <summary>
    ///   Javascript脚本目录地址   :http://localhost/hwe/cmdjs/
    ///   </summary>
    public   static   string   JsFilesPath
    {
    get
    {
    return   ApplicationPathUrl+ "/cmdjs/ ";
    }
    }

    ///   <summary>
    ///   Style样式表目录地址   :http://localhost/hwe/cmdimg/
    ///   </summary>
    public   static   string   StyleFilePath
    {
    get
    {
    return   ApplicationPathUrl+ "/cmdimg/ ";
    }
    }
    ///   <summary>
    ///   XmlDocument   虚拟目录位置  
    ///   </summary>
    public   static   string   XmlDocumentPath
    {
    get
    {
    return     PhysicalApplicationPath   +@ "XmlDocument\ ";
    }
    }


    ///   <summary>
    ///   应用程序地址   :http://localhost/hwe
    ///   </summary>
    public   static   string   ApplicationPathUrl
    {
    get
    {
    HttpContext   c   =   HttpContext.Current   ;
    if(HttpContext.Current.Server.MapPath( ". ")!= "/ ")
    return   "http:// "+System.Net.Dns.GetHostName()+ApplicationPath;
    else
    return   "http:// "+System.Net.Dns.GetHostName();
    }
    }
    ///   <summary>
    ///   应用程序签名路径
    ///   </summary>
    public   static   string   IdiographPath
    {
    get
    {
    return   ApplicationPathUrl+ "/qm/ ";  
    }
    }

                    #endregion
    }
    }

    魔兽就是毒瘤,大家千万不要玩。
  • 相关阅读:
    使用InstelliJ IDEA创建Web应用程序
    别了WindowsXP
    在MyEclipse中搭建Spring MVC开发环境
    iPhone中国移动收不到彩信,联通不用设置都可以,具体设置方法:
    WebLogic 服务器配置
    c# 第五课 string
    c# 第五课 regex
    c# 第四课 Arrays
    c# 第四课 interfaces
    c# 第五课 async await
  • 原文地址:https://www.cnblogs.com/tracy/p/1782277.html
Copyright © 2020-2023  润新知