AI OnAI Off
Hi Kumar
Is the RequestValidator in your sample code referring to ASP.NET web util RequestValidator? If yes, there is no migration exist in .NET Core. ASP.NET Core has been completely redesigned, something like RequestValidator is no longer applicable.
If your requirement is to validate the incoming request URL, you could build custom middleware.
Kindly convert the below code into the .netcore 6.0
public class TestRequestValidator : RequestValidator
{
protected override bool IsValidRequestString(HttpContext context, string value, RequestValidationSource requestValidationSource, string collectionKey, out int validationFailureIndex)
{
bool result = base.IsValidRequestString(context, value, requestValidationSource, collectionKey, out validationFailureIndex);
if (!result)
{
if (requestValidationSource == RequestValidationSource.QueryString)
return true;
}
return result;
}
}