获取 ASMX 中的当前域
在 C# 中的 asmx Web 服务中,如何获取调用 Web 服务的当前域? HttpContext.Current.Request.Url.Host 返回我想要的内容,但不是 http://mydomain.com/文件夹/Mywebservice.asmx 我只需要http://mydomain.com。 我知道我可以把那根绳子剪断,但它看起来真的很不优雅。 谢谢
In C# in an asmx web service how do I get the current domain that the webservice was called on?
HttpContext.Current.Request.Url.Host returns kindof what I want but instead of http://mydomain.com/Folder/Mywebservice.asmx I just need http://mydomain.com.
I know i could just cut that string up but it seems really in-elegant.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Uri.GetLeftPart
帮助这里:Uri.GetLeftPart
helps here:在 VB.Net 中我使用过...
或者如果您关心端口那么...
应该很容易转换为 C# ;)
In VB.Net I have used...
Or if you care about the Port then...
Should be easy to convert to C# ;)