HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0HOW TO: Programmatically Create New UserHOW TO: Programmatically Create New User
Previous
 
Next
New Post
11/13/2007 9:29 AM
 

Hi Ben.  Can you give us a little more detail as to how your code doesn't work?  Do you have an error or something that occurs?


These are my personal opinions and don't necessarily represent the views and opinions of DotNetNuke Corporation.
Will Strohl
Media Module Team Lead, User Groups Team Lead
Sales Engineer, DotNetNuke Corporation

DotNetNuke Blog | Find a DNN User Group | Media Module
Twitter: @WillStrohl LinkedIn: Will Strohl on LinkedIn

 
New Post
6/14/2010 2:00 PM
 
How do I create real custom validation programmatically for new custom fields that I created in the profile during creation New User?
I want to say for example - if txtText.Text = "" and txtText1.Text = "" Then --display my msg error on the page and do not process with registration.
I wish I have access to those txtText and txtText1 and make error label visible.
Where is it? How can I reffer to those controls in dnn?
 
New Post
6/16/2010 7:04 AM
 

Here is another way.... How I use:
I use the Membership provider (ASP.NET) .. the sqlmembershipprovider is already in your web.config by default.. You can use that way too...

//creatuser
//SqlMembershipProvider is a provider in your web.config which also refers to your connectionstring (database)...

MembershipProviderCollection provider = new MembershipProviderCollection();
provider = Membership.Providers;
MembershipProvider msp = provider["SqlMembershipProvider"];
password = CreateRandomPassword(6);
MembershipCreateStatus f;
MembershipUser msu= msp.CreateUser(newUsername, password, email, null, null, true, null, out f);

//random password
public static string CreateRandomPassword(int PasswordLength)
{
String _allowedChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ23456789";
Byte[] randomBytes = new Byte[PasswordLength];
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
rng.GetBytes(randomBytes);
char[] chars = new char[PasswordLength];
int allowedCharCount = _allowedChars.Length;
for (int i = 0; i < PasswordLength; i++)
{
    chars[i] = _allowedChars[(int)randomBytes[i] % allowedCharCount];
}
return new string(chars);
}

//some more code... udpate the status... (disable/enable status of the user)
MembershipProviderCollection provider = new MembershipProviderCollection();
provider = Membership.Providers;
MembershipProvider y = provider["SqlMembershipProvider"];
MembershipUser user = Membership.Providers["SqlMembershipProvider"].GetUser(username, false);
if (user.IsApproved != status)
{
user.IsApproved = status;
Membership.UpdateUser(user);
}


cheers,

mesut

 
New Post
7/31/2011 1:46 AM
 
Is there any up to date version of this?

Preferably in VB
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0HOW TO: Programmatically Create New UserHOW TO: Programmatically Create New User


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me
Have Someone Contact Me
Charlotte DoDNN

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Telerik JustCode Free
DotNetNuke DNN Hosting
Exact Target Exec Alert

DotNetNuke Scoop!

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates the DotNetNuke Store where users purchase third party apps for the platform.