Having a Global Key for your Site

Feb 13, 2008 at 3:13 PM
Instead of having to pass in the key all over the place, I have ammended the source of GoogleMap.cs to change the Key property like so:

public string Key {
get {
if (System.Web.Configuration.WebConfigurationManager.AppSettings"GoogleMapKey" != null)
{
return System.Web.Configuration.WebConfigurationManager.AppSettings"GoogleMapKey".ToString();
}
return _key;
}
set { _key = value; }
}

This allows you specify the Google Map key once, in the Web.Config and forget about it.
Coordinator
Feb 13, 2008 at 4:54 PM
Good tip. I'm going to use it in the code too.
Regards,
Velio
Feb 13, 2008 at 5:13 PM

velio wrote:
Good tip. I'm going to use it in the code too.
Regards,
Velio


Thank you. The thing that I like about this solution is that is also lets you still override the key in the page or user control it is on. This is optimal for sites that might have multiple URL identities.