Without Web.config ?

Jan 12, 2009 at 6:35 AM
This seems to be a great thing from everything I've read, but I want to intergrate it into an existing web site that is written in PHP not ASP, so how do I pass the deveoper key to the control without using a web.config ?
Developer
Jan 12, 2009 at 7:32 AM
you could just hard code them into the "DeepEarth.VirtualEarth.Services.TokenService.cs" file

this is where the "DeepEarth.VirtualEarth.Services" .dll is getting the Username and Password for the token from the Web.Config

   22         public TokenService()

   23         {

   24             try {

   25                 commonservice = new CommonService {

   26                     Credentials =

   27                         new NetworkCredential(ConfigurationManager.AppSettings["VETokenUserName"],

   28                             ConfigurationManager.AppSettings["VETokenPassword"])

   29                 };


to 

   22         public TokenService()

   23         {

   24             try {

   25                 commonservice = new CommonService {

   26                     Credentials =

   27                         new NetworkCredential("{YOUR_USERNAME}","{YOUR_PASSWORD}")

   29                 };

Jan 12, 2009 at 10:07 AM
Thanks, I'll try that ...

Wouldn't it be useful for this to be set as an attribute of the control set in XAML ? Seems the easiest way to provide the Key for the control ...


Coordinator
Jan 12, 2009 at 11:03 PM
The reason we use the web.config is that it is the configuration file for a ASP.NET website, you can make changes without recomipling, the file is protected by IIS from hackers and an edit restarts the website.
I have no idea about PHP I'm sorry, only ever hacked templates for wordpress, but I'm sure it has something similar.
The important thing is you do not want your VE service credientials in the silverlight application as this code is public, the user downloads this and can decompile. the token system from VE is perfect for the silverlight scenario, typically you just pass the token as a startup parameter - we made this more complex as a async web service to support only calling the token when you actually need it.
Coordinator
Jan 12, 2009 at 11:46 PM
Put the request out for some PHP VE web service examples - so far an older MapPoint one has come up, may give you some ideas:
http://msdn.microsoft.com/en-us/library/ms980207.aspx

I know someone with a PHP token example but he is asleep, hope to have it soon
Coordinator
Jan 13, 2009 at 11:15 PM
Here is the PHP token example: http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3687.entry
I'll post more if I come across it.
Coordinator
Jan 14, 2009 at 8:49 PM
And some more thanks to the great guys at Earthware: http://www.earthware.co.uk/blog/index.php/2009/01/using-virtual-earth-webservices-with-php/