Getting full URL from URL with tilde(~) sign

后端 未结 4 2002
醉酒成梦
醉酒成梦 2020-12-08 13:45

I am trying to get a typical asp.net url starting with the tilde sign (\'~\') to parse into a full exact url starting with \"http:\"

I have this string \"~/PageB.asp

4条回答
  •  轮回少年
    2020-12-08 14:00

    If you're in a page handler you could always use the ResolveUrl method to convert the relative path to a server specific path. But if you want the "http://www.yourserver.se" part aswell, you'll have to prepend the Request.Url.Scheme and Request.Url.Authority to it.

提交回复
热议问题