Is there any other place that makes sense to store credentials for third party APIs that you use to make API calls for Facebook, PayPal, etc.? I'm tempted to store sets of credentials (Sandbox, Live), etc. in my web.config and the in a Profile.cs class create a couple methods to go out and populate the profile custom object's properties with the values from my web.config based on an enum that holds the type of Profile account I want to get details for.
So for example I have an enum for PayPal called PayPalProfileTyp开发者_开发技巧e that has value ExpressCheckoutSandbox and ExpressCheckoutLive
In the constructor I'm passing in one of these values then calling a method SetSandboxValues() or SetLiveValues() dependong in what value was passed into my constructor. The SetSandBoxValues for example would set my Profile.cs's properties like ApiUserName, ApiPassword, ApiSignature with the values grabbed from my web.config in a section that has all sandbox values in my web.config.
I know this sound hacky but thought I'd throw it out there.
In my opinion, this is exactly the sort of thing you would use the web.config for. Also with DPAPI, you could secure the config. I guess you could use the registry but that is not the recommended way of things as far as I know.
Depending on money availability you could use PasswordWord Vault.
You could also use the web.config and just encrypt it. Here's a good link for it: http://weblogs.asp.net/scottgu/archive/2006/01/09/434893.aspx
精彩评论