I am trying to use a JavascriptSerializer object in ASP.NET v4.0 with C #. I do not use Visual Studio - it is on a real IIS7 server. I can access this object very well using VB on the same web server, so I know that the required 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 the following:
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 the following:
JavaScriptSerializer obj_serializer = new JavascriptSerializer();
This is the last line of code causing the above error.
reference
source share