Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2019
    Thanked 0 Times in 0 Posts

    Issues with HTML Encoding in ASP.NET Core MVC web application

    I just started at a new job as a senior .NET developer, and have run into a very puzzling issue with the package System.Text.Encodings.Web.

    The project is in .NET Framework 4.6.1

    The package is showing in the NUGET PACKAGE MANAGER as Installed version 4.5.0, however, the using statement in a .CS file that is trying to use the HtmlEncoder is showing an error with the error text "The type or namespace 'Encodings' does not exist in the namespace 'System.Text'. Are you missing an assembly reference?"

    It also says after trying to build, another error, "The type HtmlEncoder is defined in an assembly that is not referenced, You must add a reference to assembly 'System.Text.Encodings.Web, version=4.0.3, Culture=neutral, and then a public key token after that."

    I tried several different things but none of them worked.

  2. #2
    Regular Coder
    Join Date
    Sep 2014
    Thanked 55 Times in 53 Posts
    Haven't touched visual studio for a while. It looks to me that you are referencing the wrong binary for system.text. In visual studio, check your references, remove the entry for system.text and then add a reference to the assembly that you have.

    good luck.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts