在asp.net中获取绝对网址 [英] Get absolute Url in asp.net

查看:63
本文介绍了在asp.net中获取绝对网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Visual Studio运行网站时,其根URL为: http://localhost:4657

When I'm running my website with visual studio, its root url is: http://localhost:4657

我有一些字符串,其中包含〜/Login.aspx 之类的路径,我需要将它们连接起来,这样返回的内容将是 http://localhost:4657/Login.aspx .

I have strings containing paths like ~/Login.aspx and I need to concatenate them so that the return will be http://localhost:4657/Login.aspx.

我可以看到很多方法,但是正确的方法是什么?

I can see a lot of ways to do this, but what is the right way?

推荐答案

尝试

如果您需要完整的URL,比如说通过电子邮件发送它或其他东西,请查看

If you need a complete URL, say to email it or something, take a look at this blog post.

这篇关于在asp.net中获取绝对网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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