From: Flyx on
Hi

I created a web service in C# at http://localhost:3342/WS/servizio.asmx
How can I know inside the code in servizio.asmx the URL where it is running
( http://localhost:3342/WS)?

Thanks



--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: Alberto Poblacion on
"Flyx" <flyxylf(a)hotmail.com> wrote in message
news:hu0qpr$1os3$1(a)adenine.netfront.net...
> I created a web service in C# at http://localhost:3342/WS/servizio.asmx
> How can I know inside the code in servizio.asmx the URL where it is
> running ( http://localhost:3342/WS)?

You can use HttpContext.Current.Request.Url. This returns an object of
type System.Web.Uri which has many properties that let you extract the
various parts of your original URL.


From: Mr. Arnold on
Flyx wrote:
> Hi
>
> I created a web service in C# at http://localhost:3342/WS/servizio.asmx
> How can I know inside the code in servizio.asmx the URL where it is running
> ( http://localhost:3342/WS)?
>

If the Web service is actually running/hosted by the Web server and the
Web service is listening on port 3342, then you start up a browser local
on the machine where the Web service is supposedly running, and you
enter http://localhost:3342/WS/servizio.asmx in the browser's address line.

If the Web service is running on the on the machine, then the Web
service page will be displayed, and if it's not running, then you'll get
an error about connection on port 3342 was actively refused.


The Web service Reference.cs shows the URL the Web service client is
expecting the Web service to be running/listening on. So you can go to
the Web service client project and search Reference.cs for HTTP:\, and
that will give you the URL the Web service is located.