PageRemote attribute has a bug
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
I'm using .NET 6 and razor pages.
```[PageRemote]``` attribute in ```POST``` method doesn't send ```__requestverificationtoken``` to server and I get error 400.
### Expected Behavior
```PageRemote``` attribute doesn't work and doesn't send ```__requestverificationtoken``` filed on post method.
This is my ViewModel
```
public class AddCategory
{
[PageRemote(PageName = "Category", PageHandler = "CheckForTitle",
HttpMethod = "POST",
AdditionalFields = "__RequestVerificationToken",
ErrorMessage = "This title is duplicate")]
public string Title { get; set; } = null!;
}
```
And this is my handler
```
public class CategoryModel : PageModel
{
[BindProperty]
public AddCategory Category { get; set; }
public void OnGet()
{
}
public IActionResult OnPostCheckTitle(AddCategory category)
{
return new JsonResult(category.Title == "a");
}
}
```
```GET``` method is ok and everything is fine, but in ```POST``` method ```__requestverificationtoken``` doesn't send to the server and I get error 400.
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
6.0.101
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.