zoukankan      html  css  js  c++  java
  • 如何用c#获得当前站点的根路径

            public string GetRootPath()
            
    {
                
    // 是否为SSL认证站点
                string secure = HttpContext.Current.Request.ServerVariables["HTTPS"];
                
    string httpProtocol = (secure == "on" ? "https://" : "http://");

                
    // 服务器名称
                string serverName = HttpContext.Current.Request.ServerVariables["Server_Name"];
                string port = HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
                   
                
    // 应用服务名称
                string applicationName = HttpContext.Current.Request.ApplicationPath;

                
    return httpProtocol + serverName + (port.Length > 0 ? ":" + port : string.Empty) + applicationName;
            }
  • 相关阅读:
    洛谷P1865 A%B Problem
    树状数组的操作
    树状数组的基础知识
    卡常优化中最为奇怪的操作
    inline的用法
    快速读入的方法
    P1059 明明的随机数及unique去重的用法
    P3376 网络最大流 【模板】
    Gym
    HDU
  • 原文地址:https://www.cnblogs.com/syveen/p/292489.html
Copyright © 2011-2022 走看看