Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AspNetCore.ReCaptcha/ReCaptchaGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ namespace AspNetCore.ReCaptcha
{
internal static class ReCaptchaGenerator
{
private static string ViewDataKey = "__ReCaptchaGeneratedId";
private const string ViewDataKey = "__AspNetCore.ReCaptcha__GeneratedId";

public static int GenerateId(ViewContext viewContext)
{
var id = 0;
if (viewContext.ViewData.TryGetValue(ViewDataKey, out var value) && value is int _id)
id = _id;
if (viewContext.HttpContext.Items.TryGetValue(ViewDataKey, out var value) && value is int lastUsedId)
id = lastUsedId;

viewContext.ViewData[ViewDataKey] = ++id;
viewContext.HttpContext.Items[ViewDataKey] = ++id;
return id;
}

Expand Down
Loading