-
RedirectToRouteResult is now RedirectToActionResult, with an
ActionName
property -
No System.Runtime.Caching - replace it with IMemoryCache (
Microsoft.Extensions.Caching.Memory
) -
typeof(x).Assembly is now typeof(x).GetTypeInfo().Assembly
-
MongoCollection has changed
-
StringComparison.InvariantCultureIgnoreCase is gone, easy replacement
-
Configuration + Sections are totally different
-
HttpContext and HttpRequest etc. now found in
Microsoft.AspNetCore.Http.Abstractions - Microsoft.AspNetCore.Http.HttpRequest
-
Request.RequestUri is now various new properties, for example
Request.Host (a HostString)
-
WebActivatorEx?
-
DependencyResolver?
-
System.Net.Mail - Mailkit instead
-
MvcHtmlString/HtmlString - Microsoft.AspNetCore.Html.Abstractions
- ToHtmlString() is now .Value
-
HtmlHelper -> IHtmlHelper in Microsoft.AspNetCore.Mvc.ViewFeatures package
- this return IHtmlContent not HtmlString
- Use StringHtmlcontent for this
- HtmlHelper still exists
-
Encoding.Default is gone. Use UTF8 or Unicode
-
htmlhelper.ViewContext.Controller is gone, can't find a way around it.
-
I replaced UrlHelper with IUrlHelper
-
HttpResponse (Microsoft.AspNetCore.Http) has no Cache property anymore
- Solution appears to be https://docs.microsoft.com/en-us/aspnet/core/performance/caching/middleware
-
Transferring models between actions (preserving ViewData)- no longer seems to work using an Attribute?
-
JsonRequestBehavior.AllowGet is gone
-
CacheContentType attribute is gone
-
OnActionExecuting is now public
-
Localization new technique - https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization
services.AddLocalization(options => options.ResourcesPath = "Resources");
-
[ValidateInput] and request validation is gone - aspnet/Mvc#324
-
[HandleError] is gone
-
Json(obj, JsonRequestBehavior.AllowGet) - JsonRequestBehavior.AllowGet is gone
-
HttpStatusCodeResult is now StatusCodeResult
-
return Javascript() is gone, use Content("js here", "text/javascript")
-
HttpUtility is now System.Net.WebUtility
-
Request.QueryString["Key"] is now Request.Query:
if (Request.Query.ContainsKey("ReturnUrl"))
{
StringValues values;
if (Request.Query.TryGetValue("ReturnUrl", out values))
{
string firstValue = values[0].ToLower();
if (firstValue.Contains("/filemanager/select") || firstValue.Contains("/help"))
{
return View("BlankLogin");
}
}
-
Areas have changed completely: https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/areas
-
IgnoreRoutes() has gone - https://stackoverflow.com/questions/39517816/how-to-ignore-routes-in-asp-net-core-1-0-1
-
Microsoft.AspNetCore.Routing.Route isn't compatible with System.Web.Routing.Route. Is it the right class?
-
RazorViewEngine is gone, closest I can find is Microsoft.AspNetCore.Razor.RazorTemplateEngine
-
Bundles, where have they gone? Doesn't matter to me as Gulp is better
-
SelectListItem is now in Microsoft.AspNetCore.Mvc.Rendering;
-
HttpContext.Current is gone, good riddance. See https://stackoverflow.com/questions/38571032/how-to-get-httpcontext-current-in-asp-net-core
-
WebApi AuthorizeAttribute has changed, no more
OnAuthorization
-
[RoutePrefix] is now [Route]
-
ApiController is now gone, use ControllerBase
-
WebViewPage is now RazorPage, and it's in Microsoft.AspNetCore.Mvc.Razor (not Microsoft.AspNetCore.Razor)
-
Middleware has changed since the Owin namespace: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware
-
HttpFileCollectionBase is now an enumerable of IFormFile and has CopyTo instead of SaveAs()
-
Char.ToString() no longer takes a culture
-
UrlHelper now has an interface and factory:
var urlHelperFactory = _httpContext.RequestServices.GetService<IUrlHelperFactory>();
var actionAccessor = _httpContext.RequestServices.GetService<IActionContextAccessor>();
IUrlHelper urlHelper = urlHelperFactory.GetUrlHelper(actionAccessor.ActionContext);
- Structuremap HybridAnd... is now a package? Maybe
StructureMap.Microsoft.DependencyInjection
handles it - OAuth2 is middleware now: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/
- Packages are
microsoft.aspnetcore.authentication
e.g. microsoft.aspnetcore.authentication.google`
❤️