Solved

How do I prevent the createuserwizard from creating the user?

Posted on 2007-11-16
1
616 Views
Last Modified: 2008-02-01
I want to stop the creation of a user ID in the user database if the created ID does not match a list of pre-authorized users.  I have a function that compares the username of the createuserwizard control to a database of authorized users.

Protected Sub CreateUserWizard1_CreatingUser(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs)
        Dim chkID As Boolean
        chkID = CompareUserName()
        If chkID = False Then Exit Sub
    End Sub

I put it in creatinguser event but exiting the sub if the users do not match, does not prevent the user information from being written to the user database.  How can I interrupt this process?  I am using vs2005 and visual basic.

Thanks,
John
0
Comment
Question by:leachj
1 Comment
 
LVL 16

Accepted Solution

by:
anoyes earned 500 total points
ID: 20316851
Instead of "Exit Sub", try "e.Cancel=True"

Here's the MSDN info about that argument:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.logincanceleventargs.cancel.aspx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maxJsonLength exceeded error on ajax Post to ASP.NET MVC Controller Action method 5 124
Different Delete Messages 7 37
ASP.NET 5 Templates 2 66
Reset asp.net login password 4 34
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now