根据给出的相对地址获取网站绝对地址
来源:互联网 发布:大数据分析平台架构 编辑:程序博客网 时间:2024/06/05 06:40
如标题给出示例,例如:给出 /login.aspx 可以返回http://www.onewill.com,cn/login.aspx 的绝对地址结果。
/// 根据给出的相对地址获取网站绝对地址
/// </summary>
/// <param name="localPath">相对地址</param>
/// <returns>绝对地址</returns>
public string GetWebPath(string localPath)
{
string path = HttpContext.Current.Request.ApplicationPath;
string thisPath;
string thisLocalPath;
//如果不是根目录就加上"/" 根目录自己会加"/"
if (path != "/")
{
thisPath = path + "/";
}
else
{
thisPath = path;
}
if (localPath.StartsWith("~/"))
{
thisLocalPath = localPath.Substring(2);
}
else
{
return localPath;
}
return thisPath + thisLocalPath;
}
- 根据给出的相对地址获取网站绝对地址
- 绝对地址相对地址
- 服务器端的相对地址与绝对地址
- 绝对地址与相对地址的区别
- 绝对地址与相对地址
- 绝对地址与相对地址
- 相对地址转化绝对地址的一种简单办法
- PHP中从相对地址返回绝对地址的函数
- [转]绝对地址和相对地址的区别,为什么要采用绝对地址?
- 什么是绝对地址和相对地址?
- 什么是绝对地址和相对地址?
- 什么是绝对地址和相对地址?
- URI、URL、URN,相对地址、绝对地址
- 内存空间 逻辑地址空间 相对地址 绝对地址
- 获取Java项目的绝对根地址
- js获取图片src的相对地址
- 获取网站的IP地址
- 判断是否为链接地址的正则表达式(包括相对和绝对地址)
- 百度地图高度自适应
- Windows 7 系统的旧版IE浏览器升级到IE11
- tomcat中配置mime类型
- Android图片加载框架Glide
- kvm下虚机使用dimm内存设备
- 根据给出的相对地址获取网站绝对地址
- Android 开发小工具之:Tools 属性
- Eclipse svn提交代码的一般步骤(对比、解决冲突、更新、提交)
- AngularJS+FileReader实现图片上传
- 关于iOS的多线程
- 阿里driud数据库连接池的使用
- js中获得当前的时间
- SCI、UART与RS232区别
- Windows 7 Apache下计算机无法访问局域网网站的问题