I'm tryint to convert some existing code to the new framework and according to microsoft the membership stuff has been pushed to System.Web.ApplicationServices so I added the reference and imported the System.Web.Security namespace but MembershipUser continues
to error...what am I doing wrong?
and according to microsoft the membership stuff has been pushed to System.Web.ApplicationServices
The old membership classes are still in the same assembly/namspace.Nothing moved.The
mentioned namespace is a new one that allows you to expose the Membership and other security providers as wcf services to allow external applications to use your membership system.
So i think you should not change your code, if you are getting an exception, you should post it here.
I've been through all the .net 4 assemblies and i cannot find a system.web.security assembly when i go to add a reference. I've even reinstalled the .net framework twice.
System.Web is already referenced in my project. The error i'm getting is:
Error 17 Type 'System.Web.Security.MembershipUser' in assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' has been forwarded to assembly 'System.Web.ApplicationServices'. Either a reference to 'System.Web.ApplicationServices'
is missing from your project or the type 'System.Web.Security.MembershipUser' is missing from assembly 'System.Web.ApplicationServices'. F:\Documents and Settings\Codez\My Documents\Visual Studio 2010\WebSites\DataAccessFrameworkTestSite\App_Code\BasePage.vb 495 24 F:\...\DataAccessFrameworkTestSite\
and I've added a reference to that assembly alread.
Try to remove the reference to "System.Web.ApplicationServices" assembly through project references(if you are workign with web application) or assemblies section in web.config file(if you are working with website project model)
What is the type of the project you are currently using ? is it web application(have project icon)? or website ? and what is the langauge ?vb or c#? And are you getting that error in a specific page ? or during compliation ?
It's a website in VB and it is in my base page class. I'm getting the error in design mode so it see the squiggly line.
Protected Sub LogActivity(ByVal action As String)
If Request.IsAuthenticated Then
Dim usr As MembershipUser = Membership.GetUser
If usr Is Nothing Then
DisplayAlert("Unknown User!")
Exit Sub
End If
'Get user's UserId value
Dim UserId As Guid = CType(usr.ProviderUserKey, Guid)
Dim connectionString As String = MembershipHelper.GetMembershipConnectionString()
Using con As New SqlConnection(connectionString)
con.Open()
Dim cmd As New SqlCommand("WebCoreDB_Activity_UpdateCurrentActivity", con)
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@UserId", UserId)
cmd.Parameters.AddWithValue("@Action", action)
cmd.Parameters.AddWithValue("@CurrentTimeUtc", DateTime.UtcNow)
cmd.ExecuteNonQuery()
con.Close()
End Using
End If
End Sub
Not sure that my code will help but here is one of the underlying functions in my base page.
I think you are correct ! All the membership related classes have been moved to a new assembly "System.Web.ApplicationServices".
I just checked the error you are getting and it seems that the solution is to make sure that you already have reference to System.Web.ApplicationServices.
The new assembly is registered in the framework config file and so it should be available to your website when it's converted to .net 4.
For some reason, the error tells that your website doesn't have reference to that assembly.So you will need to try adding explicitly in the web.config file of your site.
So the assemblies section should become like this:
I am also using VWD 2010 Express and getting the same error on code that worked fine in VWD 2008 Express. I added the four lines you mention above to my web.config file, but my code (below) still ends up with a squiggly blue line under the lines in red and
when I expand the error it says:
Protected Sub ChangePassword(ByVal Username As String, ByVal NewPassword As String)
Dim member As MembershipUser = Membership.GetUser(Username)
member.ChangePassword(member.ResetPassword, NewPassword)
member.Comment = ""
member.Email = ""
Membership.UpdateUser(member)
End Sub
The error says:
Reference required to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' containing the type 'System.Web.Security.MembershipUser'. Add one to your project.
It even provides a hyperlink that says,
Add reference 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' to project 'Grading'
ut when I click on it it does nothing.
Douglas Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org
Well with my situation I only get the "error" blue underlines in Visual Studio. When i run the site everything works fine. Its annoying (since i'm OCD) but its not stopping anything
KC Abramson
www.ORCradio.com Web Application / Database Developer
Intensive Care On-Line Network, Inc.
When you're feeling down just remember.....the best things in life belong to someone else.
None
0 Points
33 Posts
Membership user in 2010
Apr 23, 2010 11:14 PM|daCodez|LINK
I'm tryint to convert some existing code to the new framework and according to microsoft the membership stuff has been pushed to System.Web.ApplicationServices so I added the reference and imported the System.Web.Security namespace but MembershipUser continues to error...what am I doing wrong?
All-Star
69278 Points
7977 Posts
Moderator
Re: Membership user in 2010
Apr 24, 2010 08:01 AM|anas|LINK
The old membership classes are still in the same assembly/namspace.Nothing moved.The mentioned namespace is a new one that allows you to expose the Membership and other security providers as wcf services to allow external applications to use your membership system.
So i think you should not change your code, if you are getting an exception, you should post it here.
None
0 Points
33 Posts
Re: Membership user in 2010
Apr 24, 2010 11:40 AM|daCodez|LINK
I've been through all the .net 4 assemblies and i cannot find a system.web.security assembly when i go to add a reference. I've even reinstalled the .net framework twice.
All-Star
69278 Points
7977 Posts
Moderator
Re: Membership user in 2010
Apr 24, 2010 11:47 AM|anas|LINK
Edit: there is no "System.web.Security" assembly.It's a namcespace in "System.Web" assembly.
None
0 Points
33 Posts
Re: Membership user in 2010
Apr 24, 2010 01:23 PM|daCodez|LINK
System.Web is already referenced in my project. The error i'm getting is:
Error 17 Type 'System.Web.Security.MembershipUser' in assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' has been forwarded to assembly 'System.Web.ApplicationServices'. Either a reference to 'System.Web.ApplicationServices' is missing from your project or the type 'System.Web.Security.MembershipUser' is missing from assembly 'System.Web.ApplicationServices'. F:\Documents and Settings\Codez\My Documents\Visual Studio 2010\WebSites\DataAccessFrameworkTestSite\App_Code\BasePage.vb 495 24 F:\...\DataAccessFrameworkTestSite\
and I've added a reference to that assembly alread.
All-Star
69278 Points
7977 Posts
Moderator
Re: Membership user in 2010
Apr 24, 2010 02:25 PM|anas|LINK
Try to remove the reference to "System.Web.ApplicationServices" assembly through project references(if you are workign with web application) or assemblies section in web.config file(if you are working with website project model)
None
0 Points
33 Posts
Re: Membership user in 2010
Apr 24, 2010 04:06 PM|daCodez|LINK
I've removed the reference and I am still getting the same error.
All-Star
69278 Points
7977 Posts
Moderator
Re: Membership user in 2010
Apr 24, 2010 04:14 PM|anas|LINK
Do you have <assemblyBinding> section in web.config file ? it should be under <runtime> section.If so, please post it here.
None
0 Points
33 Posts
Re: Membership user in 2010
Apr 24, 2010 04:25 PM|daCodez|LINK
All-Star
69278 Points
7977 Posts
Moderator
Re: Membership user in 2010
Apr 24, 2010 04:37 PM|anas|LINK
Hmm, weird,weird weird !
What is the type of the project you are currently using ? is it web application(have project icon)? or website ? and what is the langauge ?vb or c#? And are you getting that error in a specific page ? or during compliation ?
None
0 Points
33 Posts
Re: Membership user in 2010
Apr 24, 2010 04:49 PM|daCodez|LINK
It's a website in VB and it is in my base page class. I'm getting the error in design mode so it see the squiggly line.
Not sure that my code will help but here is one of the underlying functions in my base page.
All-Star
69278 Points
7977 Posts
Moderator
Re: Membership user in 2010
Apr 26, 2010 12:44 PM|anas|LINK
I think you are correct ! All the membership related classes have been moved to a new assembly "System.Web.ApplicationServices".
I just checked the error you are getting and it seems that the solution is to make sure that you already have reference to System.Web.ApplicationServices.
The new assembly is registered in the framework config file and so it should be available to your website when it's converted to .net 4.
For some reason, the error tells that your website doesn't have reference to that assembly.So you will need to try adding explicitly in the web.config file of your site.
So the assemblies section should become like this:
If you still see that error, try this instead:
Member
207 Points
1021 Posts
Re: Membership user in 2010
Jun 03, 2010 04:49 PM|Chaplain Doug|LINK
I am also using VWD 2010 Express and getting the same error on code that worked fine in VWD 2008 Express. I added the four lines you mention above to my web.config file, but my code (below) still ends up with a squiggly blue line under the lines in red and when I expand the error it says:
The error says:
Reference required to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' containing the type 'System.Web.Security.MembershipUser'. Add one to your project.
It even provides a hyperlink that says,
Add reference 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' to project 'Grading'
ut when I click on it it does nothing.
Good News Jail & Prison Ministry
www.goodnewsjail.org
Member
12 Points
136 Posts
Re: Membership user in 2010
Jun 08, 2010 10:57 AM|kcabrams|LINK
YES! Thank you. I am getting this same exact error
www.ORCradio.com
Web Application / Database Developer
Intensive Care On-Line Network, Inc.
When you're feeling down just remember.....the best things in life belong to someone else.
All-Star
69278 Points
7977 Posts
Moderator
Re: Membership user in 2010
Jun 09, 2010 03:31 PM|anas|LINK
It's one of the breaking changes in ASP.NET 4,
Please take a look at this link for the workaround and let us know if it solved your problem.
Member
12 Points
136 Posts
Re: Membership user in 2010
Jun 09, 2010 03:41 PM|kcabrams|LINK
Well with my situation I only get the "error" blue underlines in Visual Studio. When i run the site everything works fine. Its annoying (since i'm OCD) but its not stopping anything
www.ORCradio.com
Web Application / Database Developer
Intensive Care On-Line Network, Inc.
When you're feeling down just remember.....the best things in life belong to someone else.
None
0 Points
13 Posts
Re: Membership user in 2010
Oct 27, 2010 04:34 PM|majianlord|LINK
I had this same issue i tried everything. I then noticed the line that would fix it is this..
I didnt have the targetFramework="4.0" framework part of it inplace. Once i added that the errors went away.
None
0 Points
5 Posts
Re: Membership user in 2010
Nov 09, 2010 05:32 PM|picksupport|LINK
That link doesn't work.
I have the same problem, and it's driving me nuts.
Who had the bright idea of creating a namespace in one assembly that already existed in another?