I am trying to migrate few View classes into .NET Core from .NET and I am having an issue with the lack of "Request" class methods.
My specific code is as follows:
<form id="contactUs" method="post" action="@Request.Url.GetLeftPart(UriPartial.Authority)@Url.Action("ContactUsFormSubmit")" accept-charset="utf-8">
Request can now be found as
Request in the Controller (from the base class) or at
@Context.Request if you are in a MVC View.
But there is no replacement for
Request.Url so you need to make it yourself: (see EDIT)
string.Concat(Request.Scheme, "://", Request.Host.ToUriComponent(), Request.PathBase.ToUriComponent(), Request.Path.ToUriComponent(), Request.QueryString.ToUriComponent())
But in your case it doesn't seems to be necessary. You could let the browser handle the relative path...
<form id="contactUs" method="post" action="@Url.Action("ContactUsFormSubmit")" accept-charset="utf-8">
Or use MVC Core native way (using tag helpers):
<form asp-controller="MyController" asp-action="ContactUsFormSubmit" method="post">
EDIT: Actually there is a replacement for
Request.GetDisplayUrl();... That will return