recaptcha plugin for .net shows error on postback - asp.net-mvc-4

I am trying to set up a captcha in MVC; I am following the steps in this article to the letter. While testing I found that the application gets an "Unable to connect to remote server" error. Clicking submit on a form with the captcha field empty works fine, it goes through the controller method with no problems. It's only when there's stuff typed on the captcha field that an error comes up regardless of if the verification is not correct. Also, VS 2013 says that a class from the Recaptcha library - RecaptchaControlMvc.cs -is not found.

Related

Powershell connect-microsoftteams mfa via userform generates unhandled exception

Powershell connect-microsoftteams mfa via userform generates unhandled exception
Hi, I'm trying to create a gui frontend to a number of scripts to make them easier to access and use for colleagues . Some of the scripts require connections to O365 admins like connect-microsoftteams. At first the MFAs for the connects wouldn't even appear. Uncle google advised to use Powershell 7 when connecting through userforms. Which we installed and that did make the MFAs appear. However, when authenticating the MFA, I get a unhandled exception (an issue with the parameter 'session') and MFA browser window says 'Can't reach this page'. And the url of the MFA browser window is calling an odd localhost:..... url. clicking Continue on the unhandled exception does nothing
Outside of the gui, the connections work fine.
I've tried:
try-catch block, no change
&
netsh winhttp reset proxy, no change
thumbnail image 1 of blog post titled
Powershell connect-microsoftteams mfa via userform generates unhandled exception
Any ideas how I can get passed this?
I think I found the answer.
Simply switch the default browser to MS Edge

VB. Net - How to automatically reload web page on server error

Im developing a web browser. Whenever I try to navigate to a particular site, if there's a server error like "page taking too long to respond", "server busy/overloaded" etc. I want the error to get displayed in a message box and then the page I had tried to navigate must automatically refersh, as a second attempt.
I know the web browser itself displays the error message in the browser form but I want to diplay the error message in a messge box for some reason and then reload the page. Is there any way to do it?
If there's no way to copy the error to a message box, at least is there any way my program can automatically refresh the page if there's a server error?

Umbraco cms backoffice postlogin 500 error

The umbraco version Im currently using is 7.5.14, have been uppgraded from 7.3.x. The presentation part of umbraco is always working without any problems, but the backoffice is acting strange.
When sign in to the backoffice all of a sudden the backoffice stops working and in the web browser console 500 errors are thrown. There is nothing in the umbraco log about the errors or in the event log. When I or any other user is trying to sign in after this has occurred, we cant. In the web browser console there is nothing useful. The only thing it says is that postLogin is throwing 500 error with the message "an error has occurred".
Even when no one is signed in to the backoffice and doing stuff, when a user is trying to sign in the backoffice is throwing 500 erros. The only solution is to recycle the application pool, after restarting the pool we are able to sign in and work in the backoffice again. But the problem can occurre again briefly after restarting the app pool or within an hour or two.
I have been trying to find a solution in many ways but simple cant get rid of the problem.
Edit
I discovered that if Im signed in to umbraco backoffice while the problem occurres. There is a Get request to "umbraco/backoffice/UmbracoApi/Authentication/GetCurrentUser" that returns http 500 code. But there is nothing in the logs about the error...
After decompiling the umbraco controller (AuthenticationController), I noticed a connection in the PostLogin function and GetCurrentUser function. They both use Automapper when mapping user information.
Another project that my web application has reference to has a AutoMapper configuration that is used when a certain class is instantiated. The class calls Mapper.Initialize and after that the umbraco backoffice will fail to map its users. Thats why the error occurs arbitrarily.

Issue with Podio's ASP.NET sample application authoring

Whenever I run the Podio ASP.NET Sample Application, it displays me the 'Authentication' page asking for either my Podio credentials or to choose the "Server side flow" with "Sign in to Podio"-button. However, once I try to authenticate with either method, Visual Studio prompts me with a "SqlException was unhandled by user code - An exception of type 'System.Data.SqlClient.SqlException' occurred in NPoco.dll but was not handled in user code" warning (image), referring to line 20 on PodioOAuthData.cs. I've followed the instructions on the GitHub readme page but I can't get it to work. Any idea if I'm missing something?
It seems the readme is a little light on details when it comes to an out-of-the-box experience.
You actually need a running SQL server somewhere. And then edit PodioAspNetSample/Web.config (https://github.com/podio/asp-net-sample/blob/master/PodioAspNetSample/Web.config#L22) to contain the right connection string.
Good luck.

Anti forgery token and web testing

I am trying to do a web test in VS2012 for an MVC site.
One of the scenarios is to login and go through a list of products, select the one you want and follow through to the purchase page.
Problem is that when the web test is run, I get an error about the anti forgery token and that it does not match.
How on earth is it possible to do the testing with the anti forgery token? The user must login - there will be thousands of users for the load test (eventually) but need to make it work for 1 user first.
the login view/action does do an AntiForgeryToken in the view and validation on the controller.
any advice and tips are appreciated.
Once you run your script and it fails, go to the call proceeding the one that fails.
Go to the response tab
In the body, find the __RequestVerificationToken name which is in an input tag and extract everything in between the value attribute.
Select the value and right click > add extraction rule and press OK.
You will find an Extraction rules folder and underneath it, the Extraction rule we just created. Feel free to rename the Context Parameter Name.
Go to the next page , which should be the one that failed, and find the Form Post Parameter named "__RequestVerificationToken". View it's properties
Bind it to the Context Parameter Name created previously. To do so, view the properties of this post parameter and set the "Value" to be:
{{Name Of Context Parameter}}
(Include the 2x curly braces)
Press enter to confirm/save
Next time you run the script - all works
This is how it worked for me...
I was seeing a similar problem. After recording a web test script, the script would fail at the point of log-in on with the following message:
The provided anti-forgery token was meant for user "Domain\UserName", but the current user is "".
The solution was to set the PreAuthenticate property to false in the test properties. By default the web tests will pass an authentication header to the server which was being used in the generation the token.
I am not familiar with "web testing in VS2012" but as I know "Anti-Forgery Token" requires sending the token from browser to the server back.
I had an experience with Selenium-Webdriver and suggest you use it because it provides an API to interact with supported browsers as real user does.
You can easily start using Selenium WebDriver if you add Selenium WebDriver 2.37.0 NuGet package to you test project.
Selenium-WebDriver makes direct calls to the browser using each
browser’s native support for automation. How these direct calls are
made, and the features they support depends on the browser you are
using.
Selenium-webdriver currently supports the following drivers:
Chrome
Internet Explorer
Firefox
Opera
HtmlUnit
Android