I have finally got my ASP.NET 2.0 web site (extended from the personal web site starter kit) developed in VS2005 in C# live on GoDaddy. GoDaddy does not currently allow remote access to their SQL data bases so Web Administration is a problem. Even if it
wasn't, I would still like anyone logging in to my site to not require any authorization from the administrator (me) and to be automatically assigned the role of "Friend" giving them access to "private" albums and to several programs that require Request.IsAuthenticated
as soon as they login. Does anyone know how this could be done?
DisableCreatedUser="true"
EmailRegularExpression="\S+@\S+\.\S+"
EmailRegularExpressionErrorMessage="The email format is invalid.">
</asp:CreateUserWizard>
I put your coding in the beside code, Register.aspx.cs so it reads:
public
partial
class
Register_aspx : System.Web.UI.Page
This does not work. The newly created account shows up in the database but the user's role is not assigned and is not marked as "active". That is, the intervention of the administrator is still required for this user to be activated as a "Friend".
Did I put your code in the wrong place? Or, is additional coding required?
Now all I have to do is figure out how to run the WebAdmin page locally on GoDaddy since they don't allow remote access to their databases.
did you solve this problem? I seem to have the same problem: I developed the website on my local computer using the administration tool to set up roles. I used the "createdUser" function to addUserToRole, and it works perfectly. I even implemented my own
provider (in web.config) - and all went well.
I set up a DB on godaddy and the membership functions work fine (it adds a user to the aspnet_users and aspnet_membership tables). But the addUserToRole call doesn't work. I added roles to aspnet_roles using their Querry Analyzer and calling the stored proceedure
that comes with the asp.net membership architecture and it placed the roles into the aspnet_roles table (I can tell by running a SELECT command from the QA and it returns the correct values). But the addUserToRole function still doesn't work.
I can, of course, add each user manually - the way I did with the roles table, but that doesn't seem right. I want users to register to my site and be able to use restricted pages WITHOUT administrative intervention.
Member
1 Points
28 Posts
Can I change Personal web site starter kit to allow automatic role assignment as "Friend" to anyo...
Dec 14, 2008 02:55 PM|RogerHill|LINK
I have finally got my ASP.NET 2.0 web site (extended from the personal web site starter kit) developed in VS2005 in C# live on GoDaddy. GoDaddy does not currently allow remote access to their SQL data bases so Web Administration is a problem. Even if it wasn't, I would still like anyone logging in to my site to not require any authorization from the administrator (me) and to be automatically assigned the role of "Friend" giving them access to "private" albums and to several programs that require Request.IsAuthenticated as soon as they login. Does anyone know how this could be done?
Thanks.
Member
240 Points
39 Posts
Re: Can I change Personal web site starter kit to allow automatic role assignment as "Friend" to...
Dec 14, 2008 07:56 PM|jw91|LINK
Member
1 Points
28 Posts
Re: Can I change Personal web site starter kit to allow automatic role assignment as "Friend" to...
Dec 15, 2008 11:13 AM|RogerHill|LINK
This didn't work but I'm not quite sure where your suggested coding should go.
Register.aspx contains the script:
<asp:CreateUserWizard ID="CreateUserWizard1" Runat="server"ContinueDestinationPageUrl="default.aspx"
DisableCreatedUser="true" EmailRegularExpression="\S+@\S+\.\S+" EmailRegularExpressionErrorMessage="The email format is invalid."> </asp:CreateUserWizard>I put your coding in the beside code, Register.aspx.cs so it reads:
public partial class Register_aspx : System.Web.UI.Page{
protected void CreateUserWizard1_CreatedUser(object sender, System.EventArgs e){
Roles.AddUserToRole(this.CreateUserWizard1.UserName, "Friend");}
}
This does not work. The newly created account shows up in the database but the user's role is not assigned and is not marked as "active". That is, the intervention of the administrator is still required for this user to be activated as a "Friend".
Did I put your code in the wrong place? Or, is additional coding required?
Thanks for your input.
Member
1 Points
28 Posts
Re: Can I change Personal web site starter kit to allow automatic role assignment as "Friend" to...
Dec 15, 2008 04:09 PM|RogerHill|LINK
OnCreatedUser
="CreateUserWizard1_CreatedUser"to the <asp:CreateUserWizard script in Register.aspx.
And then add the coding suggested by jw91; viz., (except for "Friends" rather than "Friend")
protected void CreateUserWizard1_CreatedUser(object sender, System.EventArgs e){
Roles.AddUserToRole(this.CreateUserWizard1.UserName, "Friends");}
to Register.aspx.cs.
Now users logging in are automatically put in the database and activated as a member of "Friends".
Now all I have to do is figure out how to run the WebAdmin page locally on GoDaddy since they don't allow remote access to their databases.
Thanks for your help, jw91.
Member
1 Points
18 Posts
Re: Can I change Personal web site starter kit to allow automatic role assignment as "Friend" to...
May 27, 2009 07:41 AM|relstlman|LINK
did you solve this problem? I seem to have the same problem: I developed the website on my local computer using the administration tool to set up roles. I used the "createdUser" function to addUserToRole, and it works perfectly. I even implemented my own provider (in web.config) - and all went well.
I set up a DB on godaddy and the membership functions work fine (it adds a user to the aspnet_users and aspnet_membership tables). But the addUserToRole call doesn't work. I added roles to aspnet_roles using their Querry Analyzer and calling the stored proceedure that comes with the asp.net membership architecture and it placed the roles into the aspnet_roles table (I can tell by running a SELECT command from the QA and it returns the correct values). But the addUserToRole function still doesn't work.
I can, of course, add each user manually - the way I did with the roles table, but that doesn't seem right. I want users to register to my site and be able to use restricted pages WITHOUT administrative intervention.
Does anyone know of a solution??
Thanx