Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2008

Tip: Looking for answers? Try searching our database.

how do I get my own Web Service URL??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rogelio - 20 Mar 2008 18:08 GMT
hey, I have a web service here, with a few aspx pages too. I want it to
display the current web service URL.

now the first example I have found is
System.Net.Dns.Resolve(System.Net.Dns.GetHostName()).AddressList[0].ToString()

but this gets the local IP addres of the computer. if I were running this
computer on a server, would this IP address be static and be the one I'm
looking for??

another sample I have here merely asks whatismyip.com for the external
internet IP address

               // Create a new WebClient instance.
               WebClient webClient = new WebClient();

               // Download the Web resource and save it into a data buffer.
               byte[] myDataBuffer =
webClient.DownloadData("http://www.whatismyip.com/automation/n09230945.asp");

               // Display the downloaded data.
               string download = Encoding.ASCII.GetString(myDataBuffer);

this returns the web IP address. is this possibly the right IP addres if the
server was a static IP web server?

can someone help clear this confusion?

thanks.
John Saunders [MVP] - 21 Mar 2008 12:00 GMT
> hey, I have a web service here, with a few aspx pages too. I want it to
> display the current web service URL.

Are you sure that there _is_ such a thing? What if the web service is
running in a server farm? The same service could have multiple urls
associated with it. What if there is more than one virtual path leading to
the same service? What if there are multiple copies of the service running
on multiple web sites on the same machine?

You can try HttpContext.Current.Request.CurrentExecutionFilePath, and see if
that is what you want, in the scenarios you want it in.
Signature

--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.