CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.security Tags:
Item Type: NewsGroup Date Entered: 5/23/2007 7:38:31 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 7 Views: 11 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
8 Items, 1 Pages 1 |< << Go >> >|
joseph.nowak
Asp.Net User
Error specifying Default Role for CreateUserWizard5/23/2007 7:38:31 PM

0/0

I would like to specify a default role for a new user that has just registered for an account. I have a create user wizard on a page and this VB code in the back: Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser Roles.AddUsersToRole(CreateUserWizard1.UserName, "applicant") End Sub I'm getting an error: "Value of type 'String' cannot be converted to 1-dimensional array of type String" with the underline sitting under my (CreateUserWizard1.UserName) statement in the end. Any suggestions or advice is much appreciated!
hypercode
Asp.Net User
Re: Error specifying Default Role for CreateUserWizard5/24/2007 3:16:59 AM

0/0

Try this in your Creating_User event NOT Created_User event:

Dim ape As String = UserWizard.UserName.ToString

Dim theRole As String = "someRole"

Roles.AddUserToRole(ape, theRole)


 

jeremyh
Asp.Net User
Re: Error specifying Default Role for CreateUserWizard5/24/2007 8:45:13 AM

0/0

Well I have never had any problem using

 

Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs)
  Roles.AddUserToRole(CreateUserWizard1.UserName, "WebUser")
End Sub

And add

OnCreatedUser="CreateUserWizard1_CreatedUser"

to the

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"

tag.
 Hope it helps
Regards
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
jeremyh
Asp.Net User
Re: Error specifying Default Role for CreateUserWizard5/25/2007 10:29:34 AM

0/0

Did this solve your problem?


Regards
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
XiaoYong Dai –
Asp.Net User
Re: Error specifying Default Role for CreateUserWizard5/28/2007 10:38:26 AM

0/0

Hi joseph.nowak

Roles.AddUsersToRole(CreateUserWizard1.UserName ......

This will result in an error as the UserName property of the CreateUserWizard is.an String and not array of strings.


Best Regards
XiaoYong Dai
Microsoft Online Community Support

Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
hypercode
Asp.Net User
Re: Error specifying Default Role for CreateUserWizard5/28/2007 2:22:27 PM

0/0

Good shot XiaoYong!

I use the Creating_User event to add the user to a role because it has in the Sub by default:

"ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs"

I then validate the user input, roles, etc. and use "e.Cancel" in the sub if there's a problem with the input.

What is the preferred Sub to use "Roles.AddUserToRole" in? Created_User or Creating_User, or does it make any difference?

 

XiaoYong Dai –
Asp.Net User
Re: Error specifying Default Role for CreateUserWizard5/29/2007 2:08:37 AM

0/0

Hi hypercode

I think you are on the right track. "valide" the data before the data is saved use the "_CreatingUser" event
You can then test whichever you wish and then cancel the user if everything is not up to snuff.
BTW, I prefer to associate roles in "_CreatedUser" event


Best Regards
XiaoYong Dai
Microsoft Online Community Support

Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
joseph.nowak
Asp.Net User
Re: Error specifying Default Role for CreateUserWizard5/29/2007 2:01:33 PM

0/0

jeremyh:

Well I have never had any problem using

?

Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs)
  Roles.AddUserToRole(CreateUserWizard1.UserName, "WebUser")
End Sub

And add

OnCreatedUser="CreateUserWizard1_CreatedUser"

to the

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"

tag.
?Hope it helps
Sorry for the delayed response...long weekend out of town. Your code worked perfectly! Thanks for all the help.
8 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1148, Published: 2006
ASP.NET 3.5 For Dummies Authors: Ken Cox, Pages: 404, Published: 2008
Visual Basic 2005: How to Program Authors: Harvey M. Deitel, Pages: 1513, Published: 2006
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
ASP.NET 2.0: Your Visual Blueprint for Developing Web Applications Authors: Chris Love, Pages: 339, Published: 2007
Learning ASP.NET 3.5 Authors: Jesse Liberty, Dan Hurwitz, Brian MacDonald, Pages: 576, Published: 2008
Beginning Expression Web Authors: Zak Ruvalcaba, Pages: 474, Published: 2007

Web:
Error specifying Default Role for CreateUserWizard - ASP.NET Forums Error specifying Default Role for CreateUserWizard. Last post 05-29-2007 10:01 AM by joseph.nowak. 7 replies. Sort Posts: ...
CreateUserWizard Problem,8 - ng.asp-net-forum.security - fix error ... Error specifying Default Role for CreateUserWizard - ASP.NET Forums Re: Error specifying Default Role for CreateUserWizard ... Cancel" in the sub if there's ...
Membership Role Assignment through CreateUserWizard - ASP.NET Forums I think there could possibly be an error with this line:. Roles. ... All I want to do is use the default Create user Wizard and make every ...
CreateUserWizard Class (System.Web.UI.WebControls) By default, the CreateUserWizard control will accept a user name and ... Error messages when the membership provider fails to create a new user account. ...
adding users to roles with the createuserwizard - ng.asp-net-forum ... MSDN Visual C# General adding users to a default role in ... adding users to a default role in createuserwizard. Check out the AddUserToRole method in the ...
Add an error message to CreateUserWizard for duplicate username the other to associate roles to him. When I try to insert a user with a ... Default Re: Add an error message to CreateUserWizard for ...
CreateUserWizard Is a default database for Membership profile and roles missing? .... a wizard that will walk you through specifying connection information for the computer ...
CreateUserWizard Class By default, the CreateUserWizard control will accept a user name and ... In this case, creating a user raises an error that indicates an invalid password. ...
TheMSsForum.com >> Asp >> How to change CreateUserWizard error ... Thank You Peter Tag: How to change CreateUserWizard error message color Tag: ..... Does anyone have an idea of how I would specify a name for a sheet? ...
[RESOLVED] createuserwizard error - VBForums [RESOLVED] createuserwizard error ASP.NET. ... I wish to store the userid in an additional table as well as the default aspnet_user table ...




Search This Site:










express or professional edition

access 2007 query design view error

magicchat 1.1 full globalization!

credit card or shipping address modules?

admin access

forms authentication and membership data in remote database

detailsview and edititemtemplate

solpartwebcontrols design control

delete all aspnet_* entries for a given applicationname

need help on creating dll's

creating personal db in sql server 2000

ibs portal vs dotnetnuke

panel = contentplaceholder

new installation: rich text editor not allowing content to be entered

importing database to dotnetnuke 2.x (upgrading from 1.x)

can not find msdn express library or sql server express in add/remove components section

customised registration - module request

<securitypolicy> <trustlevel>

databound custom ctrl loses child ctrl state on postback

i deployed the club application in a folder (florida) on a sql server.but error

adding print capability to module subpages

code structure in asp.net from classic asp

custom membershipprovider/session

expand

set default button in wizard?

vs 2008 bug reporting?

new to web parts question on user controls

how to add onclick event to menuitem?

how can i get the page context of other pages to add a webpart

could not load type '_default'

 
All Times Are GMT