Link to home
Create AccountLog in
Avatar of Shade22
Shade22Flag for United States of America

asked on

Run a stored procedure prior to firing off the createuserwizards hidden procedures.

With the createuserwizards procedures firing off when you click on the "createuser" button, I need to override it and have it validate that the user has a member number prior to allowing them to create a user.  How do I fire off a validation store procedure before allowing the remain procedures to go through the createuser methods?
Avatar of Rob
Rob
Flag of Australia image

What database are you using?  I would suggest getting the zones changed to reflect it.
Avatar of Shade22

ASKER

I am connecting to my SQL server.  So prior to the built in (createuserWizard) procedure of creating a user, I want it to validate if the user has account with us.  If they don't, I just want the form to decline them from creating a user.
You have to create another table in the database that has the membership id and something else i.e. user name or email address and a true/false of say 'isregistered'  or just the membership id.


You will have to prepopulate this database table..
Create a new page that will query this table and if membership id exists now check if registered is false then set a cookie with the membership id and bring up the register page
retrieve the cookie and if a successful registration, then set the isregistered to true

otherwise (memberhip id does not exist then  display a message i.e. "This is a private website"

when a user registers then set the database table memberhip on the membership id isregistered to true.
Avatar of Shade22

ASKER

How would I fire off the query?  I need it to run a pre-query to validate when the user clicks on the register button.  However when the user hits the button from the form I create with the createuserWizard, it automatically runs hits procedures that I cannot see or edit.
You will need to modify your aspx page that receives the form data to fire off the query.  If it is successful then continue with the code and stored procedure you already have otherwise send the user to the registration page.
Not sure why you'd need to create a whole new table for this, perhaps worth elaborating why ve3ofa?
Avatar of Shade22

ASKER

I believe the way it works is, that the createuserwizard is ran first and then the c# coding is then fired off.  I have test users I have created in my database during a test that were created even though a line of my code broke. So the createuserwizard was able to successfully create user's even though my code broke.

The site I am building needs to validate that specific people are only allowed to create users.
Sorry I'm not able to help much more I'm afraid. Hopefully one if the other experts can jump in.
Feel free to request attention too
I prefer having a table that I maintain just a personal preference.  This way when I associate the club membership number I will also store in the email address, to prevent someone from leaking out their membership number and getting several accounts under that number.

There are probably more different ways of doing it than there are programmers. But until I get a valid membership number the 'register' options are hidden.
As I said in YOUR OTHER post, you must use ajax to do this. Fire off an AJAX post to a function that you write in your web application that will do the validation and return true/false.
ASKER CERTIFIED SOLUTION
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Shade22

ASKER

Someone helped me with this, the solution was to add "oncreatinguser" to fire off a query to verify prior to creating user.
Kind of surprised by the 'C' grade, however.