EpiServer CMS 12 and aspdotnet core

Vote:
 

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;
     }
 }

#316348
Jan 29, 2024 16:02
Kumar - Jan 29, 2024 17:43
Just i'm validating the current URL is valid or not
Vote:
 

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. 

#316388
Jan 30, 2024 3:12
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.