获取ASP.Net页面的URL在code-背后 [英] Get URL of ASP.Net Page in code-behind

查看:126
本文介绍了获取ASP.Net页面的URL在code-背后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在几个不同的服务器托管一个ASP.Net页,我想要得到的页面的URL(甚至更好:所在页面托管的站点)作为在使用字符串code-后面。任何想法?

I have an ASP.Net page that will be hosted on a couple different servers, and I want to get the URL of the page (or even better: the site where the page is hosted) as a string for use in the code-behind. Any ideas?

推荐答案

使用这样的:

Request.Url.AbsoluteUri

这将让你的完整路径(包括http:// ...)

That will get you the full path (including http://...)

这篇关于获取ASP.Net页面的URL在code-背后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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