TL;DR: Properties that need to be converted from HttpRequestBase to HttpRequest at the bottom along with my best guesses
I'm developing a web application that uses ASP.Net 3.1 Core and I am trying to implement OAuth 2 authentication.
The sample code that I am following is old (uses System.Web) and I'm having issues trying to convert this to the newer standards.
The original code in the Controller class has:
[HttpPost]
public async Task<ActionResult> oauth2Request()
{
oauthHelper oauth = new oauthHelper(Request);
Where Request is of type System.Web.Mvc.HttpRequestBase.
When I do the equivalent code in my application, I have:
[HttpPost]
public async Task<IActionResult> oauth2Request()
{
oauthHelper oauth = new oauthHelper(Request);
and Request is now Microsoft.AspNetCore.Http.HttpRequest.
I need to get the equivelent properties out of Microsoft.AspNetCore.Http.HttpRequest:
System.Web.Mvc.HttpRequestBase.Form (NameValueCollection)
[Microsoft.AspNetCore.Http.HttpRequest.HttpContext.Request.Form with a loop to change the KeyValuePairs to the NameValueCollection ?]
System.Web.Mvc.HttpRequestBase.UserHostAddress (string)
[Microsoft.AspNetCore.Http.HttpRequest.HttpContext.Connection.RemoteIpAddress.ToString() ?]
System.Web.Mvc.HttpRequestBase.Url (Uri)
System.Web.Mvc.HttpRequestBase.HttpMethod (string)
[Microsoft.AspNetCore.Http.HttpRequest.Method ?]
What I have tried:
I've shown three of the four properties that I need with my best guess. If these are wrong, please let me know.
I have no idea at all how to do the conversion from the
HttpRequestBase.Url
property. I don't even know what it is supposed to contain.