thiagocavaloti / recaptcha

Automatically exported from code.google.com/p/recaptcha
0 stars 0 forks source link

Could Public and Private Key properties to be populated in a later page lifecycle, e.g. Load or Pre_Render... not Init #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. When I put recapture control in some other web user control and exposed 
Public & Private Keys properties and then trying to populate them on the 
Page_Load or Page_Init of the web page I get "reCAPTCHA needs to be configured 
with a public & private key" error.

Original issue reported on code.google.com by microsof...@gmail.com on 22 Jan 2011 at 5:13

GoogleCodeExporter commented 9 years ago
We can't, because Page Validation happens, IIRC, during Page Load. That way, we 
have to have the keys set before it is validated (otherwise, it won't validate 
at all).

Any specific reason why you need the keys populated at a later time?

Original comment by adrian.g...@gmail.com on 23 Jan 2011 at 3:48

GoogleCodeExporter commented 9 years ago
I just wanted to set them up imperatively, by reading from config file, but 
looks like it can be done declaratively only. 

I have 4 recaptchas in my web controls project. Just see how users will be 
surprised when they won't be able to fulfil keys on page init event. 

Original comment by microsof...@gmail.com on 23 Jan 2011 at 8:12

GoogleCodeExporter commented 9 years ago
In control constructor, you can specify AppSettings key to populate the keys 
without declaring it.

this.publicKey = ConfigurationManager.AppSettings["RecaptchaPublicKey"];
this.privateKey = ConfigurationManager.AppSettings["RecaptchaPrivateKey"];

I still don't understand your problem. Can you post a sample code that 
illustrates what you're trying to achieve? Any configuration value should be 
available to use during Page_Init.

Original comment by adrian.g...@gmail.com on 24 Jan 2011 at 1:57