Extending login webcontrol
-
Hello everybody, I read the excellent article about inserting a captcha control in a webpage, located here[^]. I liked so much the idea, that I wanted to extend the standard Login webcontrol which comes with ASP.NET 2.0, by adding a captcha image to be read and its content typed into a textbox. The solution I found in the article uses the Page Session to generate an unique ID, that is then compared to what the user types. My problem is that when I try to implement the very same solution in the webcontrol, I cannot access the Page object at all! It's like I cannot retrieve the page object my new webcontrol refers to, from within the control itself. Is there some workaround to access the Page property? If not, what could I use to generate an unique ID to be compared? I was thinking of simply generating a random number, but I do not know if it's recommendable. Thanks in advance Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~
-
Hello everybody, I read the excellent article about inserting a captcha control in a webpage, located here[^]. I liked so much the idea, that I wanted to extend the standard Login webcontrol which comes with ASP.NET 2.0, by adding a captcha image to be read and its content typed into a textbox. The solution I found in the article uses the Page Session to generate an unique ID, that is then compared to what the user types. My problem is that when I try to implement the very same solution in the webcontrol, I cannot access the Page object at all! It's like I cannot retrieve the page object my new webcontrol refers to, from within the control itself. Is there some workaround to access the Page property? If not, what could I use to generate an unique ID to be compared? I was thinking of simply generating a random number, but I do not know if it's recommendable. Thanks in advance Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~
Rather than creating your own user control, couldn't use the login control template to include the captcha?
only two letters away from being an asset
-
Rather than creating your own user control, couldn't use the login control template to include the captcha?
only two letters away from being an asset
I could.. but you know, this was not something I needed done for work, it was just to see if I were still able to extend existing cotrols. I liked the "login+captcha" idea, that's all. Anyway, I went with the random number approach, not so elegant but it works. Now I have another problem: How can I tell the control that it first has to check the correctness of the captcha? I tried overriding the event OnLoggingIn, but this seems to happen when the login has already taken place. Any ideas? Thanks in advance Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~
-
I could.. but you know, this was not something I needed done for work, it was just to see if I were still able to extend existing cotrols. I liked the "login+captcha" idea, that's all. Anyway, I went with the random number approach, not so elegant but it works. Now I have another problem: How can I tell the control that it first has to check the correctness of the captcha? I tried overriding the event OnLoggingIn, but this seems to happen when the login has already taken place. Any ideas? Thanks in advance Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~
The random number approach is a failure: since the page seems to reload the control after the loggingin procedure, I cannot have a unique identifier for each login attempt, beside the page session. But how can I access it from the webcontrol itself? Any help would be much appreciated. Thank you. Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~