[c#] error CS0234: The type or namespace name 'Script' does not exist in the namespace 'System.Web'

I am trying to use JavaScriptSerializer in my application.

I initially received

Cannot find JavaScriptSerializer

and I solved it by adding:

using System.Web.Script.Serialization;

But then the sub-keyword Script is underlined with a blue line:

The type or namespace 'Script' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

So I added to the project a reference to:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.Extensions.dll

That didn't help. I am still receiving the same blue underline with same error. The reference is marked with an exclamation mark yellow warning:

enter image description here

I tried the suggested solutions on this thread, but as @user781490 indicated, they didn't help in my situation.

Any idea how to resolve this?

The answer is


Since JsonSerializer is deprecated in .Net 4.0+ I used http://www.newtonsoft.com/json to solve this issue.

NuGet- > Install-Package Newtonsoft.Json


I had the same. Script been underlined. I added a reference to System.Web.Extensions. Thereafter the Script was no longer underlined. Hope this helps someone.


Just Add reference to System.Web.Extensions and happy to go.


Add System.Web.Extensions as a reference to your project

enter image description here

For Ref.


Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to visual-studio-2010

variable is not declared it may be inaccessible due to its protection level SSIS Excel Connection Manager failed to Connect to the Source This project references NuGet package(s) that are missing on this computer Gridview get Checkbox.Checked value error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj What is the difference between Visual Studio Express 2013 for Windows and Visual Studio Express 2013 for Windows Desktop? Attach (open) mdf file database with SQL Server Management Studio What is and how to fix System.TypeInitializationException error? Could not load file or assembly "Oracle.DataAccess" or one of its dependencies IIS error, Unable to start debugging on the webserver

Examples related to javascriptserializer

error CS0234: The type or namespace name 'Script' does not exist in the namespace 'System.Web' Deserializing a JSON file with JavaScriptSerializer() How do I get formatted JSON in .NET using C#? JavaScriptSerializer - JSON serialization of enum as string JavaScriptSerializer.Deserialize - how to change field names

Examples related to jsonserializer

error CS0234: The type or namespace name 'Script' does not exist in the namespace 'System.Web' Jackson enum Serializing and DeSerializer Serializing object that contains cyclic object value Cannot find JavaScriptSerializer in .Net 4.0 Ruby objects and JSON serialization (without Rails)