I am using below code in ASP.Net MVC
Entity.CurrentPassword = ConvertToSecureString(Request.Form.GetValues("CurrentPassword")[0]);
Here Request
is the HttpRequest ControllerBase.Request { get; }
and Form
is IFormCollection HttpRequest.Form { get;set; }
But while converting this to ASP.NET Core MVC, I'm getting below error:
'IFormCollection' does not contain a definition for 'GetValues' and no accessible extension method 'GetValues' accepting a first argument of type 'IFormCollection' could be found
Do we need to add any additional package for this in .Net core or is there any replacement for the similar functionality.
CodePudding user response:
In ASP.NET CORE, you can access the value from the indexer like this:
Entity.CurrentPassword = ConvertToSecureString(Request.Form["CurrentPassword"][0]);