Rename form-action -> handler
This commit is contained in:
parent
cacee2a837
commit
04fd762943
|
|
@ -429,11 +429,11 @@ namespace Microsoft.AspNetCore.Mvc
|
|||
routeValues["page"] = CalculatePageName(urlHelper.ActionContext, pageName);
|
||||
}
|
||||
|
||||
if (!routeValues.ContainsKey("formaction") &&
|
||||
ambientValues.TryGetValue("formaction", out var formaction))
|
||||
if (!routeValues.ContainsKey("handler") &&
|
||||
ambientValues.TryGetValue("handler", out var handler))
|
||||
{
|
||||
// Clear out formaction unless it's explicitly specified in the routeValues.
|
||||
routeValues["formaction"] = null;
|
||||
// Clear out handler unless it's explicitly specified in the routeValues.
|
||||
routeValues["handler"] = null;
|
||||
}
|
||||
|
||||
return urlHelper.RouteUrl(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
|
|||
|
||||
public string HttpMethod { get; set; }
|
||||
|
||||
public string FormAction { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public IList<HandlerParameterDescriptor> Parameters { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
|
|||
{
|
||||
public class DefaultPageHandlerMethodSelector : IPageHandlerMethodSelector
|
||||
{
|
||||
private const string FormAction = "formaction";
|
||||
private const string Handler = "handler";
|
||||
|
||||
public HandlerMethodDescriptor Select(PageContext context)
|
||||
{
|
||||
|
|
@ -65,12 +65,12 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
|
|||
var handlers = context.ActionDescriptor.HandlerMethods;
|
||||
List<HandlerMethodDescriptor> handlersToConsider = null;
|
||||
|
||||
var formAction = Convert.ToString(context.RouteData.Values[FormAction]);
|
||||
var handlerName = Convert.ToString(context.RouteData.Values[Handler]);
|
||||
|
||||
if (string.IsNullOrEmpty(formAction) &&
|
||||
context.HttpContext.Request.Query.TryGetValue(FormAction, out StringValues queryValues))
|
||||
if (string.IsNullOrEmpty(handlerName) &&
|
||||
context.HttpContext.Request.Query.TryGetValue(Handler, out StringValues queryValues))
|
||||
{
|
||||
formAction = queryValues[0];
|
||||
handlerName = queryValues[0];
|
||||
}
|
||||
|
||||
for (var i = 0; i < handlers.Count; i++)
|
||||
|
|
@ -81,8 +81,8 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
|
|||
{
|
||||
continue;
|
||||
}
|
||||
else if (handler.FormAction != null &&
|
||||
!handler.FormAction.Equals(formAction, StringComparison.OrdinalIgnoreCase))
|
||||
else if (handler.Name != null &&
|
||||
!handler.Name.Equals(handlerName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
|
|||
|
||||
private static int GetScore(HandlerMethodDescriptor descriptor)
|
||||
{
|
||||
if (descriptor.FormAction != null)
|
||||
if (descriptor.Name != null)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!TryParseHandlerMethod(method.Name, out var httpMethod, out var formAction))
|
||||
if (!TryParseHandlerMethod(method.Name, out var httpMethod, out var handler))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
var handlerMethodDescriptor = new HandlerMethodDescriptor()
|
||||
{
|
||||
MethodInfo = method,
|
||||
FormAction = formAction,
|
||||
Name = handler,
|
||||
HttpMethod = httpMethod,
|
||||
Parameters = parameters,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ namespace Microsoft.AspNetCore.Mvc
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RedirectToPage_DoesNotUseAmbientFormAction()
|
||||
public async Task RedirectToPage_DoesNotUseAmbientHandler()
|
||||
{
|
||||
// Arrange
|
||||
var expected = "path/to/this-page";
|
||||
|
|
@ -192,7 +192,7 @@ namespace Microsoft.AspNetCore.Mvc
|
|||
Values =
|
||||
{
|
||||
["page"] = expected,
|
||||
["formaction"] = "delete",
|
||||
["handler"] = "delete",
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ namespace Microsoft.AspNetCore.Mvc
|
|||
},
|
||||
value =>
|
||||
{
|
||||
Assert.Equal("formaction", value.Key);
|
||||
Assert.Equal("handler", value.Key);
|
||||
Assert.Null(value.Value);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1264,7 +1264,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Page_SetsFormActionToNull_IfValueIsNotSpecifiedInRouteValues()
|
||||
public void Page_SetsHandlerToNull_IfValueIsNotSpecifiedInRouteValues()
|
||||
{
|
||||
// Arrange
|
||||
UrlRouteContext actual = null;
|
||||
|
|
@ -1273,7 +1273,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
Values =
|
||||
{
|
||||
{ "page", "ambient-page" },
|
||||
{ "formaction", "ambient-formaction" },
|
||||
{ "handler", "ambient-handler" },
|
||||
}
|
||||
};
|
||||
var actionContext = new ActionContext
|
||||
|
|
@ -1306,13 +1306,13 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
},
|
||||
value =>
|
||||
{
|
||||
Assert.Equal("formaction", value.Key);
|
||||
Assert.Equal("handler", value.Key);
|
||||
Assert.Null(value.Value);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Page_UsesExplicitlySpecifiedFormActionValue()
|
||||
public void Page_UsesExplicitlySpecifiedHandlerValue()
|
||||
{
|
||||
// Arrange
|
||||
UrlRouteContext actual = null;
|
||||
|
|
@ -1321,7 +1321,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
Values =
|
||||
{
|
||||
{ "page", "ambient-page" },
|
||||
{ "formaction", "ambient-formaction" },
|
||||
{ "handler", "ambient-handler" },
|
||||
}
|
||||
};
|
||||
var actionContext = new ActionContext
|
||||
|
|
@ -1335,7 +1335,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
|
||||
// Act
|
||||
string page = null;
|
||||
urlHelper.Object.Page(page, new { formaction = "exact-formaction" }, "https", "mytesthost", "#toc");
|
||||
urlHelper.Object.Page(page, new { handler = "exact-handler" }, "https", "mytesthost", "#toc");
|
||||
|
||||
// Assert
|
||||
urlHelper.Verify();
|
||||
|
|
@ -1344,8 +1344,8 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
Assert.Collection(Assert.IsType<RouteValueDictionary>(actual.Values),
|
||||
value =>
|
||||
{
|
||||
Assert.Equal("formaction", value.Key);
|
||||
Assert.Equal("exact-formaction", value.Value);
|
||||
Assert.Equal("handler", value.Key);
|
||||
Assert.Equal("exact-handler", value.Value);
|
||||
},
|
||||
value =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,27 +21,27 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
|||
public HttpClient Client { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task Page_Handler_FormActionFromQueryString()
|
||||
public async Task Page_Handler_HandlerFromQueryString()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = await Client.GetStringAsync("http://localhost/HandlerTestPage?formaction=Customer");
|
||||
var content = await Client.GetStringAsync("http://localhost/HandlerTestPage?handler=Customer");
|
||||
|
||||
// Assert
|
||||
Assert.StartsWith("Method: OnGetCustomer", content.Trim());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Page_Handler_FormActionRouteDataChosenOverQueryString()
|
||||
public async Task Page_Handler_HandlerRouteDataChosenOverQueryString()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = await Client.GetStringAsync("http://localhost/HandlerTestPage/Customer?formaction=ViewCustomer");
|
||||
var content = await Client.GetStringAsync("http://localhost/HandlerTestPage/Customer?handler=ViewCustomer");
|
||||
|
||||
// Assert
|
||||
Assert.StartsWith("Method: OnGetCustomer", content.Trim());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Page_Handler_FormAction()
|
||||
public async Task Page_Handler_Handler()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = await Client.GetStringAsync("http://localhost/HandlerTestPage/Customer");
|
||||
|
|
@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Page_Handler_AsyncFormAction()
|
||||
public async Task Page_Handler_AsyncHandler()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = await Client.GetStringAsync("http://localhost/HandlerTestPage/ViewCustomer");
|
||||
|
|
@ -114,7 +114,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task PageModel_Handler_FormAction()
|
||||
public async Task PageModel_Handler_Handler()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = await Client.GetStringAsync("http://localhost/ModelHandlerTestPage/Customer");
|
||||
|
|
@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task PageModel_Handler_AsyncFormAction()
|
||||
public async Task PageModel_Handler_AsyncHandler()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = await Client.GetStringAsync("http://localhost/ModelHandlerTestPage/ViewCustomer");
|
||||
|
|
@ -800,13 +800,13 @@ Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1[AspNetCore._InjectedP
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RedirectDoesNotIncludeFormActionByDefault()
|
||||
public async Task RedirectDoesNotIncludeHandlerByDefault()
|
||||
{
|
||||
// Arrange
|
||||
var expected = "/Pages/Redirects/RedirectFromFormActionHandler";
|
||||
var expected = "/Pages/Redirects/RedirectFromHandler";
|
||||
|
||||
// Act
|
||||
var response = await Client.GetAsync("/Pages/Redirects/RedirectFromFormActionHandler/RedirectToPage/10");
|
||||
var response = await Client.GetAsync("/Pages/Redirects/RedirectFromHandler/RedirectToPage/10");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
|
||||
|
|
@ -817,10 +817,10 @@ Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1[AspNetCore._InjectedP
|
|||
public async Task RedirectToOtherHandlersWorks()
|
||||
{
|
||||
// Arrange
|
||||
var expected = "/Pages/Redirects/RedirectFromFormActionHandler/RedirectToPage/11";
|
||||
var expected = "/Pages/Redirects/RedirectFromHandler/RedirectToPage/11";
|
||||
|
||||
// Act
|
||||
var response = await Client.GetAsync("/Pages/Redirects/RedirectFromFormActionHandler/RedirectToAnotherHandler/11");
|
||||
var response = await Client.GetAsync("/Pages/Redirects/RedirectFromHandler/RedirectToAnotherHandler/11");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
|
||||
|
|
|
|||
|
|
@ -136,19 +136,19 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Select_ReturnsNullWhenNoHandlerMatchesFormAction()
|
||||
public void Select_ReturnsNullWhenNoHandlerMatchesHandler()
|
||||
{
|
||||
// Arrange
|
||||
var descriptor1 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Add",
|
||||
Name = "Add",
|
||||
};
|
||||
|
||||
var descriptor2 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Delete",
|
||||
Name = "Delete",
|
||||
};
|
||||
|
||||
var pageContext = new PageContext
|
||||
|
|
@ -165,7 +165,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
{
|
||||
Values =
|
||||
{
|
||||
{ "formaction", "update" }
|
||||
{ "handler", "update" }
|
||||
}
|
||||
},
|
||||
HttpContext = new DefaultHttpContext
|
||||
|
|
@ -186,19 +186,19 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Select_ReturnsHandlerThatMatchesFormAction()
|
||||
public void Select_ReturnsHandlerThatMatchesHandler()
|
||||
{
|
||||
// Arrange
|
||||
var descriptor1 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Add",
|
||||
Name = "Add",
|
||||
};
|
||||
|
||||
var descriptor2 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Delete",
|
||||
Name = "Delete",
|
||||
};
|
||||
|
||||
var pageContext = new PageContext
|
||||
|
|
@ -215,7 +215,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
{
|
||||
Values =
|
||||
{
|
||||
{ "formaction", "Add" }
|
||||
{ "handler", "Add" }
|
||||
}
|
||||
},
|
||||
HttpContext = new DefaultHttpContext
|
||||
|
|
@ -236,19 +236,19 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Select_FormActionFromQueryString()
|
||||
public void Select_HandlerFromQueryString()
|
||||
{
|
||||
// Arrange
|
||||
var descriptor1 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Add",
|
||||
Name = "Add",
|
||||
};
|
||||
|
||||
var descriptor2 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Delete",
|
||||
Name = "Delete",
|
||||
};
|
||||
|
||||
var pageContext = new PageContext
|
||||
|
|
@ -267,7 +267,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
Request =
|
||||
{
|
||||
Method = "Post",
|
||||
QueryString = new QueryString("?formaction=Delete"),
|
||||
QueryString = new QueryString("?handler=Delete"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -281,19 +281,19 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Select_FormActionConsidersRouteDataFirst()
|
||||
public void Select_HandlerConsidersRouteDataFirst()
|
||||
{
|
||||
// Arrange
|
||||
var descriptor1 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Add",
|
||||
Name = "Add",
|
||||
};
|
||||
|
||||
var descriptor2 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Delete",
|
||||
Name = "Delete",
|
||||
};
|
||||
|
||||
var pageContext = new PageContext
|
||||
|
|
@ -310,7 +310,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
{
|
||||
Values =
|
||||
{
|
||||
{ "formaction", "Add" }
|
||||
{ "handler", "Add" }
|
||||
}
|
||||
},
|
||||
HttpContext = new DefaultHttpContext
|
||||
|
|
@ -318,7 +318,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
Request =
|
||||
{
|
||||
Method = "Post",
|
||||
QueryString = new QueryString("?formaction=Delete"),
|
||||
QueryString = new QueryString("?handler=Delete"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -332,19 +332,19 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Select_FormActionMultipleTimesInQueryString_UsesFirst()
|
||||
public void Select_HandlerMultipleTimesInQueryString_UsesFirst()
|
||||
{
|
||||
// Arrange
|
||||
var descriptor1 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Add",
|
||||
Name = "Add",
|
||||
};
|
||||
|
||||
var descriptor2 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Delete",
|
||||
Name = "Delete",
|
||||
};
|
||||
|
||||
var pageContext = new PageContext
|
||||
|
|
@ -363,7 +363,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
Request =
|
||||
{
|
||||
Method = "Post",
|
||||
QueryString = new QueryString("?formaction=Delete&formaction=Add"),
|
||||
QueryString = new QueryString("?handler=Delete&handler=Add"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -377,13 +377,13 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Select_ReturnsHandlerWithMatchingHttpMethodWithoutAFormAction()
|
||||
public void Select_ReturnsHandlerWithMatchingHttpMethodWithoutAHandler()
|
||||
{
|
||||
// Arrange
|
||||
var descriptor1 = new HandlerMethodDescriptor
|
||||
{
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Subscribe",
|
||||
Name = "Subscribe",
|
||||
};
|
||||
|
||||
var descriptor2 = new HandlerMethodDescriptor
|
||||
|
|
@ -405,7 +405,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
{
|
||||
Values =
|
||||
{
|
||||
{ "formaction", "Add" }
|
||||
{ "handler", "Add" }
|
||||
}
|
||||
},
|
||||
HttpContext = new DefaultHttpContext
|
||||
|
|
@ -426,7 +426,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Select_WithoutFormAction_ThrowsIfMoreThanOneHandlerMatches()
|
||||
public void Select_WithoutHandler_ThrowsIfMoreThanOneHandlerMatches()
|
||||
{
|
||||
// Arrange
|
||||
var descriptor1 = new HandlerMethodDescriptor
|
||||
|
|
@ -478,21 +478,21 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Select_WithFormAction_ThrowsIfMoreThanOneHandlerMatches()
|
||||
public void Select_WithHandler_ThrowsIfMoreThanOneHandlerMatches()
|
||||
{
|
||||
// Arrange
|
||||
var descriptor1 = new HandlerMethodDescriptor
|
||||
{
|
||||
MethodInfo = GetType().GetMethod(nameof(Post)),
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Add",
|
||||
Name = "Add",
|
||||
};
|
||||
|
||||
var descriptor2 = new HandlerMethodDescriptor
|
||||
{
|
||||
MethodInfo = GetType().GetMethod(nameof(PostAsync)),
|
||||
HttpMethod = "POST",
|
||||
FormAction = "Add",
|
||||
Name = "Add",
|
||||
};
|
||||
|
||||
var descriptor3 = new HandlerMethodDescriptor
|
||||
|
|
@ -515,7 +515,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
{
|
||||
Values =
|
||||
{
|
||||
{ "formaction", "Add" }
|
||||
{ "handler", "Add" }
|
||||
}
|
||||
},
|
||||
HttpContext = new DefaultHttpContext
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
public void CreateHandlerMethods_ParsesMethod()
|
||||
{
|
||||
// Arrange
|
||||
var type = typeof(PageModelWithFormActions).GetTypeInfo();
|
||||
var type = typeof(PageModelWithHandlerNames).GetTypeInfo();
|
||||
|
||||
// Act
|
||||
var results = DefaultPageLoader.CreateHandlerMethods(type);
|
||||
|
|
@ -387,13 +387,13 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
|
|||
results.OrderBy(h => h.MethodInfo.Name),
|
||||
handler =>
|
||||
{
|
||||
Assert.Same(type.GetMethod(nameof(PageModelWithFormActions.OnPutDeleteAsync)), handler.MethodInfo);
|
||||
Assert.Same(type.GetMethod(nameof(PageModelWithHandlerNames.OnPutDeleteAsync)), handler.MethodInfo);
|
||||
Assert.Equal("Put", handler.HttpMethod);
|
||||
Assert.Equal("Delete", handler.FormAction.ToString());
|
||||
Assert.Equal("Delete", handler.Name.ToString());
|
||||
});
|
||||
}
|
||||
|
||||
private class PageModelWithFormActions
|
||||
private class PageModelWithHandlerNames
|
||||
{
|
||||
public void OnPutDeleteAsync()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@page "{formaction?}"
|
||||
@page "{handler?}"
|
||||
|
||||
@using Microsoft.AspNetCore.Mvc.Internal
|
||||
@using RazorPagesWebSite
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@page "{formaction?}"
|
||||
@page "{handler?}"
|
||||
@model RazorPagesWebSite.ModelHandlerTestModel
|
||||
|
||||
Method: @Model.MethodName
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@page "{formaction?}"
|
||||
@page "{handler?}"
|
||||
@functions
|
||||
{
|
||||
public IActionResult OnGet() => RedirectToPage();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@page "{formaction?}/{id:int?}"
|
||||
@page "{handler?}/{id:int?}"
|
||||
@functions
|
||||
{
|
||||
public IActionResult OnGetRedirectToPage(int id)
|
||||
|
|
@ -8,6 +8,6 @@
|
|||
|
||||
public IActionResult OnGetRedirectToAnotherHandler(int id)
|
||||
{
|
||||
return RedirectToPage(new { formaction = "RedirectToPage", id = id });
|
||||
return RedirectToPage(new { handler = "RedirectToPage", id = id });
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
@page "{formaction?}"
|
||||
@page "{handler?}"
|
||||
@functions
|
||||
{
|
||||
public IActionResult OnGetRedirectToIndex() => RedirectToPage("Index");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
@page
|
||||
|
||||
<form method="post" asp-page="../../HelloWorld" asp-antiforgery="false"></form>
|
||||
<a asp-page="../Redirects/Index" asp-route-formaction="RedirectToIndex" />
|
||||
<a asp-page="../Redirects/Index" asp-route-handler="RedirectToIndex" />
|
||||
<input type="image" asp-page="../Admin/Index" asp-fragment="my-fragment" />
|
||||
Loading…
Reference in New Issue