• asp.net路劲相关


    ResolveClientUrl返回相对于当前页面下文件的地址
    ResolveUrl则返回页面所在应用程序下的相对地址
    在使用相对URL地址时一定要在前面加上(~)或(~/)

      

    /// <summary>
            /// 获得根路径
            /// </summary>
            /// <returns></returns>
            public static string GetRootPath()
            {
                string path = HttpContext.Current.Request.Url.AbsoluteUri;
                path = path.Substring(0, path.IndexOf(HttpContext.Current.Request.Url.LocalPath));
                path += HttpContext.Current.Request.ApplicationPath;
    
                if (!path.EndsWith("/"))
                {
                    path += "/";
                }
                return path;
            }
    
            /// <summary>
            /// 获得物理根路径
            /// </summary>
            /// <returns></returns>
            public static string GetRootServerPath()
            {
                string path = HttpContext.Current.Server.MapPath("~");
                if (!path.EndsWith("\\"))
                {
                    path += "\\";
                }
                return path;
            }
    
    
    

         

     function GetUrlParas(paras) {
      	var url = location.href;
      	var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
      	var paraObj = {}
      	for (i = 0; j = paraString[i]; i++) {
      		paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
      	}
      	var returnValue = paraObj[paras.toLowerCase()];
      	if (typeof (returnValue) == "undefined") {
      		return "";
      	} else {
      		return returnValue;
      	}
      }
      //GetPara
      function GetParasByUrl(url,paras) {
    
      	if (url.indexOf("?") < 0 ) {
      		return "";
      	}
      	var paraString = url.substring(urls.indexOf("?") + 1, url.length).split("&");
      	var paraObj = {}
      	for (i = 0; j = paraString[i]; i++) {
      		paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
      	}
      	var returnValue = paraObj[paras.toLowerCase()];
      	if (typeof (returnValue) == "undefined") {
      		return "";
      	} else {
      		return returnValue;
      	}
      }
      function GetRootPath() {
      	var urlPart = window.location.href;
      	var filePart = window.location.pathname;
      	var paraPart = window.location.search;
      	var retV = urlPart.replace(filePart, "").replace(paraPart, "");
      	return retV;
      } //function-end
    
  • 相关阅读:
    IsDefined的问题
    设计匠艺模型
    真实案例引起的对系统健壮性的思考
    软件系统的稳定性
    LA工作第二周体会
    LA工作第一周体会
    https://blog.csdn.net/qq_26264237/article/details/90575165
    Maven项目配置logback
    Java 工具 Hutool4.0.0 正式发布:从懵懂到成熟
    IDEAidea中解决Java程序包不存在问题
  • 原文地址:https://www.cnblogs.com/fuhui/p/1942845.html
Copyright © 2020-2023  润新知