I'm looking for solution how to integrate WPF desktop application with reCaptcha! Anyone knows the solution?
I'm working on registration module to my application, and need good and simple captcha.
Thanks!
See https://developers.google.com/recaptcha/docs/display and https://developers.google.com/recaptcha/docs/verify.
You could make an request to http://www.google.com/recaptcha/api/challenge?k=your_public_key and parse the ChallengeValue. This value can be used to get the recaptcha image via http://www.google.com/recaptcha/api/image?c=challenge_value. Afaik URL Images can be displayed in WPF directly.
Let the user input into a TextBox (or similar) control.
For verification, use this input and make a request to http://www.google.com/recaptcha/api/verify (see documentation above).
Have you tried this - http://code.google.com/apis/recaptcha/docs/aspnet.html. It says it works in any .Net language, including C#. There is also this page although it is 2 years old.
Related
I want to know if I will be able to control a web browser using a C# program. What I want to do is the following:
I want to create a windows desktop application which will allow me to Open a web-browser (google chrome), input a webpage address, go to a web page, type something in a specific field or click something.
All of the above would have to be done automatically by the C# application without any user intervention after he opens up the application.
I want to know is it possible doing it in C# ? and if it isn't I would like some suggestions guiding me how would I go about creating this app, what programming language should I take a a look at or what should I research.
I only want a guidance for how I should go about creating this application.
Thanks to anyone who is going to answer ;)
There are a few possibilities to achieve this:
Use WatIn http://www.codeproject.com/Articles/17064/WatiN-Web-Application-Testing-In-NET
Or Selenium http://docs.seleniumhq.org/
Use WebClient, HttpRequest, HttpResponse classes
I want to run my WPF application on asp.net web application. Actually I have a WPF page.xaml which contain the image viewer, which actually open image and edit it as required.
Now I want to embed that in my Asp.net Web application. I have a asp.net web application user control on which I want that WPF stuff. I research on it on the internet, I find a way that we first publish the WPF application on the IIS server and then past the URL in asp.net web application page iframe. as I follow this below link:
http://msdn.microsoft.com/en-us/library/aa970060.aspx#deploying_a_xbap
now I not want to follow this approach. I want an alternate way of this. Is there any way to handle this scenario. If yes then how can we achieve this?
Yes there's a better way: you can use Silverlight (basically it's a C# equivalent to Flash).
Even if Silverlight is quite the same as WPF, there is some differences due to the fact that silverlight is made for web. So you'll have to make some changes to your application.
About integrating it in your page, it seems quite simple:
You can use an object html element (as you would do with Flash)
Here are some links about that:
http://msdn.microsoft.com/fr-fr/library/cc838145(v=vs.95).aspx
http://www.c-sharpcorner.com/uploadfile/raj1979/host-silverlight-in-Asp-Net/
2 years later, a possible answer appears! Maybe someone else will see this and get some use out of it.
I have been hearing rumors that it is possible to run your WPF application in a browser, it's called an XBAP?
https://msdn.microsoft.com/en-us/library/aa970060%28v=vs.110%29.aspx
I am about to give this a try myself, I'll update this answer with any limitations I find.
The Problem
In the .NET Framework, it would just be a matter of setting a property true and hooking to the link clicked event. But how would I do this in WinRT using the limited .NET framework.
Why Is This Necessary?
Well I want to create a text based web browser (like Lynx but with a GUI), that is designed with people who don't want to use a fancy web browser or just need accessibility. Some of the features would be to display the URLs for instance 'http://stackoverflow.com/' to a URL in which I hookup the link clicked event and then redirect within the program and display the text.
Conclusion
Requesting the HTML and converting it to text, was simple, and I already have it done and working fine. So the only thing I need from the Stack Overflow community. Is whether the RichTextBox support hyper-links? and how can it be done? No code examples necessary, but pointers will just do. I have already done research, but Metro Style applications are just fresh out of the oven; not a lot of articles out there.
The Windows-8 App style way of doing this is to put a button inside an InlineUIContainer inside a textblock.
See here for some related discussion.
I have some problem using default WebBroswer with C#.
I'm making program in C# WindowsForm. I would have multiple "tabs" of "Broswer" and i need to change many things like UserAgent .
I had problem to do this with default WebBrowser becouse the trick(found on stackoverflow) worked only for 1 page and dont for all session.
Olso i need JavaScript support.
My Question is :
Is there another webBroswer that emulate multiple "tabs" of webBrowser , support javaScript (This is very important : i need disable Javascript for a website page that have Location Header ), and that it's possible change UserAgent and so emulate all existing Browsers ?
If answer it's not What kind of "real" browser could i use with My c# WinForm Program?
Regards
Edit: I already used GeckoFX but without good result (with JavaScript)
You could try awesomium.
You'll have to write some code yourself (including tabs) as it's just a framework.
However, I haven't come across anything on for .net that comes close and it should meet your requirements.
There is a free license for "Indie Companies" (if you made less than $100k), non-commercial use or evaluation & dev purposes.
Downside is, you wont get access to the source for free, I don't know if that's a deal-breaker for you or not.
Pricing
How to use C# to capture a image of a specific url?
I want to use C# to automatically capture a image of a webpage based on a specific url.
For example, I have a page contains a txtUrl.Text = "http://www.some.com/index.aspx" , then I click a button, how can I capture a image of that Url?
I assume you want to do this from ASP.NET (as opposed to from a WinForms application).
In your web project, add a reference to System.Windows.Forms (yes, this is a bad thing to do). In your code-behind, you can then create an object of type System.Windows.Forms.WebBrowser:
WebBrowser browser = new WebBrowser();
// this will load up a URL into the web browser:
browser.Navigate(#"http://www.stackoverflow.com");
Next, just use the BitBlt API function (sorry, I don't have a link handy) to copy the WebBrowser control's graphical display to a Bitmap (which you can then display or save or whatever). With this function, the WebBrowser's Handle property is one of the parameters to pass.
Update: here's a link to some code that does exactly what you need: http://www.developerfusion.com/code/4712/generate-an-image-of-a-web-page/
If you mean a visual of the webpage, one approach is to integrate IE to your application and programmatically taking a screenshot. This (for the integrated web browser) and this (for taking screenshots with C#) may be of use. This is of course IE dependent.
Another option is using the shotserver and shotfactory projects used for browsershots.org. They can be found here, though I'm not sure if there's a .NET API for it.
I don't think that is really possible only using C#. That is because C#, or the .NET framework for that matter, don't offer any kind of HTML markup rendering capabilities. The closest you can get - in my opinion - would be to use a WebBrowser control and then try to somehow capture it's graphical output (which would be the rendered page).
The other way to do it would be to look for a .NET component that might do what you want.. Although I don't know of any that do.