|
hi guys,i would like to know how to create a captcha application using c# which must show the user a picture of a shape eg,circle etc,and this shape must be generated randomly each time the web page is loaded.
the application will require the user to identify the picture by typing in the name of the shape, than click the submit button.
|
|
|
|
|
This wouldn't be a good captcha ... it would only have a small number of possible results so it would be easy to spam past.
|
|
|
|
|
Some good samples here[^], note the second one is a CodeProject article.
|
|
|
|
|
Why not just use reCAPTCHA[^] - it's free, it's easy to use and people are familiar with it. Plus, it helps digitize books...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I second the reCaptcha recommend!
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
1. Have the image files named Captcha00.png ... Captcha09.png
2. Generate a random number from 0 to 9
3. Append that number to the string "Captcha0" then append ".png" to it.
4. output the resulting string to the webpage
5. compare the input text to what was computed in step 2
But as someone else said, this may not be a very secure Captcha.
A better one is to generate a simple equation with an "infinite" number of permutations. Such as a + b * c = where a, b & c are random integers between 2 and 99.
The best one is to implement with open source reCaptcha.
Good luck.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
Hi,
In windows application how can i validate the ip address in a textbox on key press event.
I have used masked text box but still no solution.
Can anyone give me a solution ?
Thanks in advance.
|
|
|
|
|
|
Your regex is broken (but then so is mine - I'm about to fix it and explain why). You don't want \b before and after. Also, yours would accept 345.567.678.789, which is not a valid IP address!
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I agree with you, my regex would accept 999.999.999.999 as well. I will update that.
Thanks....
I quit being afraid when my first venture failed and the sky didn't fall down.
|
|
|
|
|
Use a regular expression, such as
^(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)$ (wrap it in whatever delimiters you need.)
If you can't read this, get a copy of Expresso and paste the expression into the expression window.
[edit]I thought it was broken, but it's not... It's just smarter than I am feeling right now. Need coffee! Forget the edit.[/edit]
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Regex is NOT necessary.
Just use IPAddress.Parse(myIPAddress) , and handle the FormatException exception.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
And there we have the correct answer. Regexes are good - when used in appropriate cases. Reinventing the wheel is not the case though.
|
|
|
|
|
Oh John....you wouldn't be using exception handling as program flow control now would you? Naughty boy - go sit in the corner... Perhaps using IPAddress.TryParse() would be less "expensive"?
C# has already designed away most of the tedium of C++.
|
|
|
|
|
The cost in a GUI (per the OP) would be difficult to measure and certainly not significant.
Actually I am not sure what sort of application it would take where this would be expensive. It would require all of the following.
1. IPs arrive as strings.
2. A signficant number are invalid.
3. There are a lot of them.
|
|
|
|
|
I merely mentioned it to avoid being pinged for not doing so. It seems one cannot win.
Besides that, I'm sure intellisense works in his copy of VS, so he may have discovered it on his own.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Depending on the situation, it may be appropriate (i.e. if the vast majority are valid and an invalid one really is exceptional). For UI validation it frankly doesn't matter but from a perspective of style you are correct.
|
|
|
|
|
TextBlock wrapping of text in Silverlight XAML file.
I have a wierd and annoying problem. I have a textblock that is inside a stackpanel that is Oriented horizontal. It would be nice if I could have the textblock appear in multiple lines nicely wrapped. How could I do that?
|
|
|
|
|
Set the textbox textwrapping to wrap
TextWrapping="Wrap"
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I use this code to send files to the FTP server :
FtpWebRequest myRequest = (FtpWebRequest)FtpWebRequest.Create(ftp:
myRequest.Credentials = new NetworkCredential(TEST,HEROS);
myRequest.Method = WebRequestMethods.Ftp.UploadFile;
FileStream stream = File.OpenRead(@"c:\test.txt");
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
stream.Close();
Stream reqStream = myRequest.GetRequestStream();
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Close();
How i can receive the reponse, the server ftp return an ID of commande, i can see this number in FilZilla, bu i need to retrieve this id on C#, thank you verry mutch.
|
|
|
|
|
Use GetResponse[^].
(Also, learn to search, and use the documentation. I found that just from looking at the FtpWebRequest page on MSDN.)
|
|
|
|
|
how i can read cell value when i move up and down with the arrows key in datagridview
using C# code ?
thanks in advance
|
|
|
|
|
as always with Windows programming, split the problem in smaller pieces you can manage:
1.
what events are available that could suit your needs? use MSDN to browse the DataGridView events. Maybe there is something related to the current cell having changed? or the selection having changed?
2.
if such event doesn't offer a specialized EventArgs holding the required information (such as RowIndex and ColumnIndex), then go look for the Control's properties that may help you out.
3.
and finally, try it to see it works in all relevant scenarios.
|
|
|
|
|
Hello,
i am on a little player project in C# i like to give it away for some friends but without this wmp.dll i would just like to give the *.exe and refer to the already existing dll in system32 folder any idea maybe how to can do that?
it works all fine if i import it over the visual studio references (right mouseclick, add..) but than it have to be next to the *.exe file when i wanna start the prog
please give advise
Regards,
Sep
|
|
|
|
|