Last post Aug 19, 2005 12:21 AM by C-Flat
Aug 16, 2005 12:21 PM|aesvan|LINK
Aug 16, 2005 01:07 PM|webber123456|LINK
Aug 16, 2005 01:24 PM|aesvan|LINK
Aug 17, 2005 03:44 AM|C-Flat|LINK
Aug 17, 2005 08:48 AM|aesvan|LINK
I left the ASPNET.StarterKit.Portal namespace intact to change at a later date. I was planning to change it after I began to get some of the new functionality working for it. I made sure that
I edited the stored procedure that goes with the user table. I added the fields to the Portal_User database.
I added some more fields to the registration form such as fax, first name, last name etc. to the UserDB class, here is the code:
editRoles = moduleRow.EditRoles
accessRoles = moduleRow.TabRow.AccessRoles
myCommand.CommandType = CommandType.StoredProcedure
parameterFullName.Value = fullName
parameterEmail.Value = email
parameterPassword.Value = password
parameterAddress.Value = address
parameterFax.Value = fax
parameterCity.Value = city
parameterState.Value = state
parameterZip.Value = zip
parameterFirstName.Value = firstname
parameterLastName.Value = lastname
parameterOrganization.Value = organization
parameterOrganization.Value = phone
parameterUserId.Direction = ParameterDirection.Output
parameterUserId.Value = userId
dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
parameterUserName.Direction = ParameterDirection.Output
Aug 18, 2005 12:20 AM|C-Flat|LINK
Aug 18, 2005 04:55 PM|aesvan|LINK
I apologize for putting two questions in the same message. First, I added more members to the UserDB class. When I went to add them in the Register.aspx file I can not use them for example,
Dim accountSystem As New ASPNET.StarterKit.Portal.UsersDB()
If (accountSystem.AddUser(Name.Text, Email.Text, PortalSecurity.Encrypt(Password.Text)) > -1) Then
will not allow me to add the other members such as zip, address etc. It does not even see them from the AddUser function from the UserDB class.
When I user Register.aspx to register a new user it says "Registration failed!" user is already register. When I take a look at the database no such user has been entered.
I tried to get around this by writing a new class called ProfileInfo to register a user. When I instantiate the new class in Register.aspx it thinks that I am trying to use the class System.Web.Profile.ProfileInfo when the namespace in my project is clearly
Aug 19, 2005 12:21 AM|C-Flat|LINK
No worries on putting two questions in one message. I just wasn't clear on the problem, that's all.
I saw the added arguments for the AddUser function in your code, as well as the updated parametes for the stored proceure. That looks ok.
So what I understand is that when you try to add these new parameters to the line where you are calling the AddUser function (in your example above), they are not recognized. Is this correct? If so, that doesn't make any
sense. Try changing the name of the AddUser function in the UsersDB class (Security.vb) to AddUserXX and see if you get an error when compiling. If you don't, then, for some reason, it's looking somewhere else for this class.
Also try calling the AddUser function directly (unit test) just to be sure it works. What I mean is paste it into another file (any project), hard code the connection string, and call it to see if it actually adds the user.
The "registration failed" is strange, but I think that I know what it is. Keep in mind that this is the default (and only) message you will get if the AddUser function fails. Even if, for example, the stored procedure didn't
exist when you tried to call this function, it would still say "User already registered."
Since it won't let you add the new arguments to the call to AddUser, I will assume it is not seeing the changes you made for some reason. So, if it is calling the old function with just the standard arguments (fullName, email,
password), then maybe the call to the stored procedure is failing because it expects more parametes. So, when it fails and is caught in the try block, it returns -1. When Register.aspx gets -1 back, it gives you the message "Registration failed
xxx@xxx is already registered."
So first, try changing the name of the AddUser function to AddUserXX in the UsersDB class. But don't change the Register.aspx.vb file call to AddUser. Leave that the same. Then compile. You should get an error saying UsersDB class does not contain a function
called AddUser. If you don't, then I would have to request more code to try and tackle it for you.
But... If you do get the compile error, capture the exact error you are getting when the stored procedure fails.
Add a referenced argument to the call to AddUser, catch the exception, and set a ref argument to the Message or the ToString result of the exception if it fails, or set ref argument OK if it worked.
Something like (this is in C# because I don't know the sytax for VB)
//below, ref string msg is new