Click here to Skip to main content
15,908,111 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
how can i get client url name while access the my webservice,

Note: code to retrive client url on webservice page only

it's possible...?
Posted
Updated 14-Jun-11 8:51am
v2

You can get the client's IP address. The term URL doesn't make sense for a client. A URL is a resource locator, which what the client uses to find a webpage, service, etc.


I found the following solution here[^]:
C#
string strHostName = System.Net.Dns.GetHostName();
IPAddress clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0);
 
Share this answer
 
Comments
Ed Nutting 14-Jun-11 15:20pm    
Good answer, my 5+ :)
Rick Shaub 14-Jun-11 17:07pm    
Thanks!
pandiing 15-Jun-11 13:43pm    
you can try above mentioned code to retrive only currently running host name, i dnt want that i want which website to access my webservice that website url...hav u got it....
You can use
HttpContext.Current.Request.UserHostAddress


or

HttpContext.Current.Request.ServerVariables("HTTP_X_FORWARDED_FOR")
HttpContext.Current.Request..ServerVariables("REMOTE_ADDR")
 
Share this answer
 
Comments
pandiing 15-Jun-11 13:49pm    
not wrkng....?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900