Search code examples
c#asp.net-mvcasp.net-web-apifilestreamresult

What is the difference between the these two FileStreamResult from different classes?


What is the difference between System.Web.Mvc's FileStreamResult and Microsoft.AspNetCore.Mvc's FileStreamResult? Is there any significant take away of using the latter over the first one?

Edit:

Is it possible to have .Net Core project but still use System.Web.Mvc? I don't know how but just asking for possibility here, is it or is not?


Solution

  • The System.Web.Mvc namespace is used the .NET Framework. If your project is targetting the .NET Framework, use this.

    The Microsoft.AspNetCore.Mvc namespace is used in .NET Core. If your project is targetting .NET Core, use this.

    Only one of them will be available to you, depending on your project.

    You can have an ASP.NET Core project that targets the full .NET Framework, and then add a reference to System.Web.Mvc.dll directly. That might work. But I don't know why you would want to.

    But if your ASP.NET Core project is targetting .NET Core, then there is no way to use System.Web.Mvc.