Cannot find namespace system.web.security

Hello,

I am using beta2 team edition. But when I try to add
"using system.web.security;" in the code, I got compile error:

Error 1     The type or namespace name 'Security' does not exist in the namespace 'System.Web' (are you missing an assembly reference )      C:\Documents and Settings\Administrator\my documents\visual studio 2005\Projects\WebSite1\CustomMemberShipLibrary\CustomMembershipProvider.cs      4     18    CustomMemberShipLibrary< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

And then when I try to add System.Web.Security to the reference, I cannot find it from the list. What is the problem

thanks,





Answer this question

Cannot find namespace system.web.security

  • Rioch Mulhall

    The project is a web project. Because I am working on the subclass, so I seperate my subclass from the web application. Actually, it is a class library.

    It is strange that I got this compile time error and even cannot find system.web.security from the reference list. The reference under systeem.web only have:
    system.web
    system.web.mobile
    sysetem.web.regularexpression
    system.web.services

    but no sysetem.web.security!!!

    Does my IDE have problem

  • stephQc

    I think I found the answer.
    The problem is I didn't add system.web into the reference. So the environment doesn't recogize system.web.security if I add code : using system.web.security

    But I still confused that why I cannot find system.web.security from the reference list(when you trying to add reference, a pop up window shows up and the title is "add reference". I cannot find system.web.security from the list.


  • Flima

    What type of project are you creating windows/web For web projects System.web is automatically included.

    If you want to reference this dll specifically for other projects, you can add the 'System.Web' dll from the list in the 'add reference' dialog box.

    thanks,
    akhila

  • Oliver

    Thank you for your reply.

    In your opinion, when I open reference adding window, each component that listed under .NET Tab is individual assembly. Am I right So the system.web and system.web.mobile are different assembly.

    Where can I find the diagram that depict hierachical relationship for all the assemblies

    Thanks again.



  • Vizi

    Thank you AngryRichard, you rescued me! very helpful poit.


  • bernie_e

    I think you are confusing the usages of namespace and reference.  This is understandable, as they both follow similar formats, and oftentimes can be equivalent.

    The reference option allows you to build against a particular assembly, much like you'd link against a particular import library in a native build.  In this case, you needed to build against System.Web.Dll.

    System.Web.Dll is an assembly that contains several namespaces, including System.Web.Security (and System.Web.HttpCookie, and hundreds of others).  To confuse matters, more than one assembly can have implementations in the same namespace.

    This relationship is documented in the "Requirements" section for the particular entities in the namespace.  So for instance


       System.Web.Security.DefaultAuthenticationEventArgs class:

       [...]

       Requirements
          Namespace: System.Web.Security
          Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
          Assembly: System.Web (in System.Web.dll)

    So in this case, if you wanted to use this class, you'd reference System.Web.dll (either with the Add Reference... option in VS, or with /r on the command line), and use the System.Web.Security namespace (using System.Web.Security) in your source.

    Does that make sense



  • Cannot find namespace system.web.security