开发者

Getting the URL of a web service that calls a class library

开发者 https://www.devze.com 2023-02-16 03:36 出处:网络
I have a web serv开发者_开发技巧ice that calls a class library. In this class library i\'m trying to find out the URL of the web service that calls the class library.

I have a web serv开发者_开发技巧ice that calls a class library.

In this class library i'm trying to find out the URL of the web service that calls the class library.

Is there a simple way of doing this??


You should not investigating from the class library what is the URL calling because this bind that library to works only with a web service, and this is not a good design startegy. Why do you need the URL ? Is in order to log the caller ? You can probably move the part of code interested in the URL outside the library.


Try

SoapContext.Current.Actor.AbsoluteUri

This requires WSE 2.0 SP3.


I figured it out in the end

Dim tReq As New System.Web.Services.WebService
Dim tWSURI As String = tReq.Context.Request.Url.OriginalString

this requires you to add a reference to system.web

0

精彩评论

暂无评论...
验证码 换一张
取 消