Asked by:
missing a directive or assemby reference- is it an error in config

Question
-
User-605499000 posted
my logout and login is locked up. several files are saying that the membership user could not be found are you missing a directive or assembly influence. here is one of the files
namespace EP.BumplesMagazine.UI.User
{
public partial class ActivateAccount : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
String email = String.Empty;
String token = String.Empty;if (Request.QueryString["email"] != null)
email = Request.QueryString["email"].ToString();if (Request.QueryString["token"] != null)
token = Request.QueryString["token"].ToString();if (email == String.Empty && token == String.Empty)
Response.Redirect("~/Default.aspx");Boolean userFound = false;
// authoriza email
MembershipUserCollection emailAccount = Membership.FindUsersByEmail(email);foreach (MembershipUser user in emailAccount)
{
if (user.Comment == token)
{
user.IsApproved = true;
user.Comment = String.Empty;
Membership.UpdateUser(user);// Authorize user
if (!Roles.RoleExists("Registered"))
Roles.CreateRole("Registered");Roles.AddUserToRole(user.UserName, "Registered");
userFound = true;
}
}if (!userFound)
Response.Redirect("~/Default.aspx");//set focus
LoginBox.SetFocus();
}//PanelMessage.Visible = false;
}
}
}below is my web conf for the user files
<configuration>
<location path="EditProfile.aspx">
<system.web>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
</location><location path="ChangePassword.aspx">
<system.web>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
</location><location path="OrderHistory.aspx">
<system.web>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
</location>
</configuration>I am not getting any debugging errors when I run it in visual studio. The program was built in 2009 and has been upgraded to 4.0
Hope you can help as no one can log in.
thanks,
Jen
Tuesday, September 12, 2017 9:04 PM
All replies
-
User1771544211 posted
Hi bumples18,
I am not getting any debugging errors when I run it in visual studio. The program was built in 2009 and has been upgraded to 4.0The MembershipProvider abstract class is part of the System.Web.ApplicationServices namespace in the .net 4.0 Framework. Add a reference to that assembly and it should solve the issue.
<add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Best Regards,
Jean
Wednesday, September 13, 2017 2:34 AM -
User-605499000 posted
Thank you very much for getting back to me so fast. I put the 4.0.0.0 in the main web config. where the 2.0.0.0 was and it closed my site with a server error. So I had to put 2.0 back in. TDoes that mean that there is another place where I need to change the 2.0 to 4.0 ?
Also, it did not change the membership user problem but I was able to redo a default and fix the login problem. I still have a password problem but the site is working again.
AI am a self taught programmer and not very good at this but I keep trying to learn. Mainly by looking at what the first programmer did.
Thank you very much for your help.
Jen
Wednesday, September 13, 2017 4:02 PM -
User1771544211 posted
Hi bumples18,
I still have a password problem but the site is working again.What is the password problem do you have now?
And you can try the following link about the migration problems.
https://docs.microsoft.com/en-us/aspnet/whitepapers/aspnet4/breaking-changes#0.1__Toc256770156
Best Regards,
Jean
Friday, September 15, 2017 7:07 AM