diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/FormTagHelper.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/FormTagHelper.cs
index 44622b4aa2..33d398055b 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/FormTagHelper.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/FormTagHelper.cs
@@ -157,10 +157,6 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.CopyHtmlAttribute(nameof(Method), context);
}
- else
- {
- Method = "get";
- }
var antiforgeryDefault = true;
@@ -205,9 +201,16 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
if (string.IsNullOrEmpty(attributeValue))
{
// User is using the FormTagHelper like a normal
. Let it flow to the output as-is and only handle anti-forgery.
+ // A
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs
index 266e9a45c8..9970667ae4 100644
--- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs
@@ -25,6 +25,63 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
public class FormTagHelperTest
{
+ [Fact]
+ public async Task ProcessAsync_ActionAndControllerGenerateAntiforgery()
+ {
+ // Arrange
+ var expectedTagName = "form";
+ var metadataProvider = new TestModelMetadataProvider();
+ var tagHelperContext = new TagHelperContext(
+ tagName: "form",
+ allAttributes: new TagHelperAttributeList()
+ {
+ { "asp-action", "index" },
+ { "asp-controller", "home" }
+ },
+ items: new Dictionary