I’m trying to figure out a way to get a Silverlight Client to be aware of the IP address of the current user. I’ve seen this information similarly before, but in reference to passing it back to the server, which is different from my purpose.
I’m trying to write a simple app that changes the source of the MediaElement depending on the IP address of the user. Hence, the IP address is only needed on the client side.
Is there a way to find out the IP address without using a webservice? If I must use a webservice, which one would be good to use?
After working on this project for a while, I think I found a simpler solution when hosted within an ASP.net page.
I much prefer using initParams with the ASP
<%=Request… directly in the code than messing with the JavaScript to modify a control within the Silverlight App. After passing it into InitParams, you can load the values into the Resource Dictionary of the application. I go into detail of all of this on my blog post: Pass the IP Address of a User to Silverlight as a Parameter (NOTE: If the link to my website at benmccormack.com doesn’t work, you may have to go to the site directly and find it. I posted the write-up on 9/26/2009).