获得绝对URL在我的asp.net项目中的文件,包括HTTP //等使用外部? [英] Get absolute url for a file in my asp.net project to include HTTP// etc for use externally?

查看:76
本文介绍了获得绝对URL在我的asp.net项目中的文件,包括HTTP //等使用外部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与ResolveClientUrl(〜/ Confirmation.aspx)等方法被玩弄。

我试着去获得页面包括http的完整的绝对网址:..

等等等等

任何人知道如何做到这一点?

感谢


解决方案

  Request.Url.ToString()

获取当前请求的绝对URL。

如果你想获得它的相对路径:

  Request.Url.GetLeftPart(UriPartial.Authority)
                      + VirtualPathUtility.ToAbsolute(relativePath)

been playing around with ResolveClientUrl("~/Confirmation.aspx") and other methods..

I am tryin go get the FULL absolute URL of the page including Http: etc etc..

Anyone knows how to do this?

thanks

解决方案

Request.Url.ToString()

gets the absolute URL for the current request.

If you want to get it for a relative path:

Request.Url.GetLeftPart(UriPartial.Authority) 
                      + VirtualPathUtility.ToAbsolute(relativePath)

这篇关于获得绝对URL在我的asp.net项目中的文件,包括HTTP //等使用外部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆