I have an action method that accepts a userid (Guid) and token (url encoded string) as a web api end point in a Asp.net Core 2.2 project as shown below:
[HttpGet]
[Route("{userId}/confirm/{token}")]
public async Task<IActionResult> GetConfirmationAsync([BindRequired, FromRoute] string userId, [BindRequired, FromRoute] string token)
{
var result = await _userService.GetConfirmationAsync(userId, token);
if (!result.Success) return StatusCode((int)result.HttpStatusCode, new ErrorDetailsResource(result.Messages.ToList(), result.Exception));
return Ok();
}
When I submit a request with a short token string such as
http://localhost:44353/api/Account/d73d17fc-9f58-471a-9f21-312aede320fc/confirm/CfDJ8Jcfzk
The request goes through. However, when I submit a request such as the one below:
I am getting the following message when I run the app in IIS Express:
Bad Request - Invalid URL HTTP Error 400. The request URL is invalid.
I have tried the following configuration in Program.cs, but it does not work
WebHost.CreateDefaultBuilder(args)
.UseConfiguration(configuration)
.ConfigureKestrel(options =>
{
options.Limits.MaxRequestBufferSize = 512000 * 1024;
options.Limits.MaxRequestLineSize = 512000 * 1024;
})
.UseStartup<Startup>()
.Build();
Where can I configure to set the Max Request Url Length in Asp.net Core 2.2 so the request is valid?
Thanks for any help!!