The name 'JavaScriptEncoder' does not exist in the current context

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 anos atrás
I'm creating a new theme and copied everything over from the default theme. I'm getting a message saying:

The name 'JavaScriptEncoder' does not exist in the current context
displayPopupNotification('@Html.Raw(JavaScriptEncoder.Default.Encode(Model.AlertMessage))', 'success', false);

I saw a similar question here: https://www.nopcommerce.com/boards/t/55339/new-theme-error-the-name-publicwidgetzones-does-not-exist-in-the-current-context.aspx

I checked my _ViewImports.cshtml file and it already had the @using Nop.Web.Framework.Infrastructure in it. Any ideas on how to fix this? What am I missing?
4 anos atrás
Hello,

I have a same problem.
After copied default template. Frontend go down.

Error message:
One or more compilation failures occurred:
C:\inetpub\weby\website\Themes\themenew\Views\Shared\Components\HeaderLinks\Default.cshtml(53,53): error CS0103: The name 'JavaScriptEncoder' does not exist in the current context.

One or more compilation failures occurred:
C:\inetpub\weby\website\Themes\themenew\Views\Customer\Register.cshtml(355,62): error CS0103: The name 'JavaScriptEncoder' does not exist in the current context

Can any help ?
4 anos atrás
Add the following to your theme's _ViewImports.cshtml

@using System.Text.Encodings.Web
4 anos atrás
For Version 4.2 - The ViewIMports.cshtml file should be as follows:

https://github.com/nopSolutions/nopCommerce/blob/develop/src/Presentation/Nop.Web/Views/_ViewImports.cshtml
1 ano atrás
Eyre wrote:
Add the following to your theme's _ViewImports.cshtml

@using System.Text.Encodings.Web


Thank you! Worked for me.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.