System.Web.Security doesn't exist in assemblies
Asked Answered
T

4

11

Either i am late to the party or i did something wrong. I am working with Visual Studio 2013 and i was trying to use Membership class however, using System.Web.Security; namespace doesn't exist in my assemblies.

What can i do to solve this?

Note: System.Web exists

Targeting: .NET Framework 4.5.1

Tawnyatawsha answered 10/11, 2013 at 6:20 Comment(2)
It looks like the System.Web.Security namespace is in System.Web.dll. Do you have that dll included?Surrebuttal
@MillieSmith how to add dll?Spectroscope
S
6

The System.Web namespace exists in System.dll

The System.Web.Security namespace exists in System.Web.dll

You can check this by going to the System.Web and System.Web.Security namespaces, opening one of the classes, and checking what the msdn article states is the dll (listed as the assembly).

Surrebuttal answered 10/11, 2013 at 6:25 Comment(11)
I have read msdn and i am aware that it lives in System.Web.Security. Still no luck. Also note that i am Targeting: .NET Framework 4.5.1 not 4.5Tawnyatawsha
If you target 4.5 does it work? That works for me... Are you sure you've added System.Web.dll as a reference to that project?Surrebuttal
No, i don't see it in 4.5 either. Are you testing this in Visual Studio 2013? Is there another way i could install this library?Tawnyatawsha
Namespace: System.Web.Security Assembly: System.Web (in System.Web.dll)Janeth
@KomengeMwandila: Unfortunately I'm testing 2012. If this is really important, I can drive into work (about a 1 mile drive). My work has a 2013 install.Surrebuttal
I know which namespace i need, its just that i can't add it because it is not in the Framework Assemblies.Tawnyatawsha
@KomengeMwandila: Maybe you're under Assembly -> Extensions instead of Assembly -> Framework? Obviously I'm shooting in the dark here. Just trying to help.Surrebuttal
@MillieSmith No need to trouble yourself, i am sure someone on here will test it for me. Thanks!Tawnyatawsha
@MillieSmith I considered that, still nothing. Anyways, i don't think it matters if you search for the specific assembly.Tawnyatawsha
@MillieSmith worst moment ever, I wasn't reading your post carefully. All i needed to include was System.Web :(Tawnyatawsha
@KomengeMwandila haha nice. Glad you got it working.Surrebuttal
S
12

Actually, in .Net Framework 4+, the namespace System.Web.Security lives in the System.Web.ApplicationServices assembly, look for that one in the references

Stoup answered 19/2, 2014 at 14:46 Comment(2)
+1, the class MembershipProvider exists in the System.Web.ApplicationServices assembly under the System.web.security namespace. as per msdn.microsoft.com/en-us/library/…Pedaias
I had to reference System.Web AND System.Web.ApplicationServices to make this work.Gallium
S
6

The System.Web namespace exists in System.dll

The System.Web.Security namespace exists in System.Web.dll

You can check this by going to the System.Web and System.Web.Security namespaces, opening one of the classes, and checking what the msdn article states is the dll (listed as the assembly).

Surrebuttal answered 10/11, 2013 at 6:25 Comment(11)
I have read msdn and i am aware that it lives in System.Web.Security. Still no luck. Also note that i am Targeting: .NET Framework 4.5.1 not 4.5Tawnyatawsha
If you target 4.5 does it work? That works for me... Are you sure you've added System.Web.dll as a reference to that project?Surrebuttal
No, i don't see it in 4.5 either. Are you testing this in Visual Studio 2013? Is there another way i could install this library?Tawnyatawsha
Namespace: System.Web.Security Assembly: System.Web (in System.Web.dll)Janeth
@KomengeMwandila: Unfortunately I'm testing 2012. If this is really important, I can drive into work (about a 1 mile drive). My work has a 2013 install.Surrebuttal
I know which namespace i need, its just that i can't add it because it is not in the Framework Assemblies.Tawnyatawsha
@KomengeMwandila: Maybe you're under Assembly -> Extensions instead of Assembly -> Framework? Obviously I'm shooting in the dark here. Just trying to help.Surrebuttal
@MillieSmith No need to trouble yourself, i am sure someone on here will test it for me. Thanks!Tawnyatawsha
@MillieSmith I considered that, still nothing. Anyways, i don't think it matters if you search for the specific assembly.Tawnyatawsha
@MillieSmith worst moment ever, I wasn't reading your post carefully. All i needed to include was System.Web :(Tawnyatawsha
@KomengeMwandila haha nice. Glad you got it working.Surrebuttal
B
2

Guess I'm way to late, but if anyone has not got an answer I finally found it here:

https://msdn.microsoft.com/en-us/library/webmatrix.webdata.websecurity(v=vs.111).aspx

Add a Reference to: WebMatrix.WebData (you need to choose "Extentions") And you will have WebSecurity available

NOTE: You still need (System.Web.Security) for MemberShip & MemberShipUser

Barbabra answered 17/11, 2015 at 5:20 Comment(0)
H
1
  1. Change Target framework from .net client profile ** to **.net

  2. Add System.Web assembly by references-->right click --> add references --> .net

  3. On top add using System.Web.Security;

Helbonnas answered 11/1, 2015 at 7:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.