Reputation: 2420
new to .net so still learning....I have managed to get ASP.NET Membership mainly working with my SQL server.
The problem i'm having is I get an error in VS2010 in my code behind file when attempting to create a user. I get a Red Exclamation mark appear on .CreateUser on the code below.
Error Message:
Reference required to assembly 'System.Web.Security.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e65' containing the type 'System.Web.Security.MembershipUser'. Add one to your project.
Code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Membership.CreateUser(r_user_name.Text, r_password.Text)
Label1.Text = "User created"
'Response.Redirect("default.aspx")
Catch ex As Exception
Label1.Text = "Error"
End Try
I've tried adding the following to the web.config:
Not sure if thats correct!! but i get an error message when I open the page:
Parser Error Message: Could not load file or assembly 'System.Web.Security.MembershipUser\, System.Web.ApplicationServices\, Version\=4.0.0.0\, Culture\=neutral\, PublicKeyToken\=31bf3856ad364e65' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Thanks for any help.
J.
Upvotes: 1
Views: 1016
Reputation: 36349
Sounds like you haven't actually added the reference, though. Right-click on the project, select Add Reference, and navigate through the .NET libraries to find that assembly.
Upvotes: 1