ASP.NET C#: JavascriptSerializer could not be found

asp.net, c#, javascriptserializer

Solution

I don't know if you just incorrectly typed the line, but it's JavaScriptSerializer, not JavascriptSerializer (Capital S in Script).

Problem

I'm trying to use the JavascriptSerializer object in ASP.NET v4.0 with C#. I'm not using Visual Studio--this is on a live IIS7 server. I can access this object just fine using VB on this same web server, so I know the requisite DLLs are present and correctly configured. But when I try to use this object in C#, I get this error: `The type or namespace name 'JavascriptSerializer' could not be found` In my class file, I have this: ``` using System.Web; using System.Web.Script; using System.Web.Script.Serialization; ``` In web.config, I have this: ``` <assemblies> <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </assemblies> ``` In my default.aspx.cs file, I have this: ``` JavaScriptSerializer obj_serializer = new JavascriptSerializer(); ``` It's this last line of code that is causing the above referenced error. Help?

Original source