Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在mvc中构建一个rest api。使用 API 时,我需要能够获取调用服务的引用 URL。我已经尝试过 Request.UrlReferer 并且它返回 null。如何获取使用服务的 url?
您确定您的意思不是在消费者中您需要知道进行 REST 调用的客户端的引用者吗?
如果是这种情况,您需要做的是查看request header并从中提取Referer.
request header
Referer