locked
Cannot find namespace system.web.security

    Question

  • 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

    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,


    Tuesday, May 17, 2005 5:17 AM

Answers

  • 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
    Tuesday, May 17, 2005 6:50 AM

All replies

  • 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
    Tuesday, May 17, 2005 6:50 AM
  • 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?
    Wednesday, May 18, 2005 3:41 AM
  • 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.
    Wednesday, May 18, 2005 5:14 AM
  • 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?

    Wednesday, May 18, 2005 9:51 PM
  • 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.

    Thursday, May 19, 2005 3:58 AM
  • Thank you AngryRichard, you rescued me! very helpful poit.
    Thursday, December 13, 2007 8:31 PM
  • Nothing worked, I ended up using the fully qualified name

    System.Web.Security.

     

    Membership...


    Respectfully - Yovav Gad
    Friday, August 06, 2010 11:47 PM
  • Try adding a reference to System.Web.ApplicationServices. You should then be able to addd your using System.Web.Security.

    Cheers!

    Friday, March 16, 2012 2:38 PM