有没有快速的方法来获得方案,主机,端口(只有不是80)和ASP.NET中的应用程序路径?
据我所知,我需要组装下列部分:
> Request.Url.Scheme
> Request.Url.SchemeDelimiter
> Request.Url.Authority(尽管这可能总是包括端口,即使是80)
> Request.ApplicationPath
解决方法
这应该工作:
Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath
请注意,根据您的应用程序是托管在站点的根目录还是在子目录中,这可能或可能不会以尾随“/”结尾.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。