I am following this tutorial : http://www.sieena.com/blog/archive/2010/10/05/how-to-add-recaptcha-to-an-asp-net-site.aspx to implement reCaptcha in my ASP.net website from VS2010 ... but i am getting a error like this
What might I have done wrong?
Have you changed keys
PublicKey="Your very own public key here" PrivateKey="Your very own
privat key here"
that you should get from your account?
Related
I'm receiving the following error in browser:
Cannot provide a value for property 'IconService' on type 'Microsoft.Fast.Components.FluentUI.FluentIcon'. There is no registered service of type 'Microsoft.Fast.Components.FluentUI.IconService'.
https://learn.microsoft.com/en-us/fluent-ui/web-components/components/button?pivots=blazor
https://github.com/microsoft/fast-blazor/blob/main/examples/FluentUI.Demo.Shared/Pages/ButtonPage.razor
https://brave-cliff-0c0c93310.azurestaticapps.net/ButtonPage
This is when using example code from Microsoft Blazor:
<h3>With content and icon</h3>
<h4>With start</h4>
<FluentButton>
Button
<FluentIcon Name="#FluentIcons.Globe" Slot="start" Size="#IconSize.Size16" Filled=false />
</FluentButton>
A single button renders fine but when I use FluentIcon I get a runtime error.
I have followed this getting started guide:
https://learn.microsoft.com/en-us/fluent-ui/web-components/integrations/blazor
I have also looked at Icon examples but with no luck:
https://brave-cliff-0c0c93310.azurestaticapps.net/IconPage
You need to add the code below to Program.cs for your Blazor client. For some reason this is only documented on Github but not https://learn.microsoft.com.
builder.Services.AddFluentUIComponents();
https://github.com/microsoft/fast-blazor
I would like to install ReCaptcha to our Umbraco Version 7. But I can't seem to find the correct approach. Basically I want to add the captcha element inside my custom form (not the Umbraco Form). Is there a way to do it? It seems the approach of adding the Recaptcha is not the same as how you add it in PHP application. How should I do this in Umbraco?
Update:
Recaptcha version can either be version 1, 2 or 3
reCaptcha V2 only requires a few simple lines of HTML to be inserted, AFAIK. You should be able to insert both a script tag and an HTML element anywhere inside your form element (inside Html.BeginForm if that's what you're doing) in your custom form, as long as you have an API key. I did this the other day and it just worked.
https://developers.google.com/recaptcha/docs/display
It doesn't need "installation", but it requires some fiddling with code.
I wrote a post about it here a while back, https://www.jondjones.com/learn-umbraco-cms/umbraco-7-tutorials/umbraco-security/how-to-add-a-recapture-within-your-umbraco-website/
The quick option is to install recaptha mvc via Nuget and then decorate your controller with CaptchaValidator and use the Recaptcha in your HTML
In your controller just check the form values and get the captcha value from it like this below, if that value is null then the person hasn't filled it otherwise it will have a value in it.
var formData = Request.Form;
var captchaRequest = formData["g-recaptcha-response"];
if (string.IsNullOrWhiteSpace(captchaRequest))
{
TempData["formError"] = "Fill in the Captcha box.";
return CurrentUmbracoPage();
}
Ok I found a solution with detailed explanation in this Blog
Newbie here, I am experiencing the following error and I have no idea how to resolve the issue. I did change the primary key for users in Identity to int rather than it being stored as a string.(I believe that is what's causing the issue). Besides that, every other page runs perfectly. Any ideas on where to start?
CS1503 Argument 1: cannot convert from 'System.Collections.Generic.ICollection<DraftIntellectualProperty.Models.CustomUserRole>' to 'System.Collections.Generic.ICollection<Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole>'
The error:
The method being called in the code-behind:
Snip from IdentityModel:
Snip from IdentityUserRole class:
I'm running the app in this Microsoft Tutorial and when I try to enter a url in the input box of the app (for instance, http://msdn.com or http://blogs.msdn.com/adonet as shown in the tutorial) and click submit I get the following validation error:
The value 'http://msdn.com' is not valid for Url.
When I debug the application I notice that in the following code of the tutorial the ModelState.IsValid value is showing as 'false'. What is missing here and how can it be fixed?
public IActionResult Create(Blog blog)
{
if(ModelState.IsValid)
{
_context.Blogs.Add(blog);
_context.SaveChanges();
return RedirectToAction("Index");
}
return View(blog);
}
Points to note:
I'm using latest ASP.NET Core 1.0 and VS2015-Update 3 [released on June 27, 2016] on windows 8.1
In the Creat.chtml view of the tutorial, <input asp-for="Url" class="form-control" /> was initially showing as readonly so I added type="text" attribute there and it became read/write
My app is an exact copy of the tutorial (I did copy/past) except that instead of choosing 'No Authentication' I chose 'Individual User Accounts' option when creating the poroject. But that, I think, should not make any difference.
UPDATE
I added var errors = ModelState.Values.SelectMany(v => v.Errors); just above if(ModelState.IsValid) statement and I see the following in the debug window showing the values of error collection but can't figure out the cause of error. Maybe. someone can help:
UPDATE 2:
I found my mistake. I was using int datatype in public int Url { get; set; } property of the Blog class instead of using string. Changed it to string and it's working now. Someone may help what the error in image is saying.
I resolved the issue. There was a mistake on my part. I was using the datatype int in the property public int Url { get; set; } of the Blog class. Changed it to string. Then deleted the database in SQL Server and corresponding migration folder in the project. Re-ran the package manager commands Add-Migration MyFirstMigration -context BloggingContext and Update-Database -context BloggingContext. It's working now. Although the app was a copy/paste from this Microsoft Tutorial, later I tried to test creating a property through a short-cut key as explained here but forgot that the short-cut key creates the datatype as int. Thanks to all the readers who may have tried to help.
I have Googled and looked on SOF for a solution but sadly I'm a little confused on how to resolve this issue,
For Encryption I'm using the following
Simple insecure two-way "obfuscation" for C#
The way I use this the end user choose a category and saves the item, on returning from the DB I select the relevant view to be display.
The view name is then Encrypted and passed to a new action.
Within this Action I then try to decrypt the encrypted view name and pass it to the view to be rendered but when I try to decrypt it I get this error mentioned above, I'm uncertain on how to fix this.
My controller looks like this
return RedirectToAction("Description", "Advert", new{
encryptedView = crypto.Encrypt(advertModel.View),
});
which passes the following encryption
too8kmao3odfbwbhlaod1w==
I then try the following in the action its been redirected to
var decryptView = new Crypto().Decrypt("too8kmao3odfbwbhlaod1w==");
yet with no avail.....
Ok, found the solution as im using a nuget LowercaseRoutesMVC when I encrypt it, it looks like this
Too8KMao3ODfBWBHLaoD1w==
When I try to decrypt its lower case as mentioned above which is what causes the issue.
I'll have to think of another way to resolve this.