Silverlight, "The type or namespace name 'CookieContainer' does not exist in the namespace 'System.Net'"
I'm running VS2010 pro, and I downloaded a sample Silverlight app written in an older version. I did the conversion but开发者_StackOverflow中文版 now when I go to run it, I get this error. I searched the net, the only recommendation I found was to add a reference to "System.Net" (which didn't make sense, but I did anyway), but this didn't help. The offending code:
public System.Net.CookieContainer CookieContainer {...
The System.Net dll is usually referenced by default but perhaps it wasn't in the older project. Check the version number is 2.0.5.0 and that the file path is something like:-
c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Net.dll
CookieContainer Class Namespace: System.Net Assembly: System (in System.dll) Supported in: 4, 3.5 SP1
CookieContainer still exists.
Try deleting the reference in your project then add System.net again.
精彩评论