<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Security</title><link>http://forums.asp.net/25.aspx</link><description>All about ASP.NET security (authentication, authorization, membership, roles, etc.) and the Login controls. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=24&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Add user to role programmatically</title><link>http://forums.asp.net/thread/2348977.aspx</link><pubDate>Fri, 09 May 2008 19:37:46 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2348977</guid><dc:creator>McGuire</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2348977.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2348977</wfw:commentRss><description>&lt;p&gt;Thank you so much.&amp;nbsp; I knew it had to be something simple, but I could not get it figured out...works great.&amp;nbsp;&amp;nbsp; Since I&amp;nbsp;work in VB I thought I would add the code.&amp;nbsp; Not much of a change from yours.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Protected&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/font&gt;&lt;font size="2"&gt; CreateUserWizard1_CreatedUser(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;font size="2"&gt; sender &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Object&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;font size="2"&gt; e &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; System.EventArgs) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Handles&lt;/font&gt;&lt;font size="2"&gt; CreateUserWizard1.CreatedUser&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp; Dim&lt;/font&gt;&lt;font size="2"&gt; userName = CreateUserWizard1.UserName&lt;/p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Roles.AddUserToRole(userName, &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;Members&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;Thanks for the help!&amp;nbsp;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Add user to role programmatically</title><link>http://forums.asp.net/thread/2348907.aspx</link><pubDate>Fri, 09 May 2008 18:57:55 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2348907</guid><dc:creator>anas</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2348907.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2348907</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;you can assign the created user to a role in CreatedUserWizard CreatedUser event handler&amp;nbsp; as follows:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;    &lt;span class="kwd"&gt;protected void&lt;/span&gt; CreateUserWizard1_CreatedUser(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, EventArgs e)
    {
        &lt;span class="kwd"&gt;string&lt;/span&gt; userName = CreateUserWizard1.UserName;
        Roles.AddUserToRole(userName, &lt;span class="st"&gt;&amp;quot;Accountants&amp;quot;&lt;/span&gt;);
    }&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hope it Helps&amp;nbsp;&lt;/p&gt;</description></item><item><title>Add user to role programmatically</title><link>http://forums.asp.net/thread/2348707.aspx</link><pubDate>Fri, 09 May 2008 17:03:35 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2348707</guid><dc:creator>McGuire</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2348707.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2348707</wfw:commentRss><description>&lt;p&gt;I need to add the user to a role when the user creates an account.&amp;nbsp; Since we use this site to allow users to apply 27/7/365, it would not be possible to user the configuration tool.&amp;nbsp; There must be a way to add it when the user hits the submit button.&amp;nbsp; I am using asp.net&amp;#39;s login tool createuserwizard.&amp;nbsp; Have been searching the net but so far haven&amp;#39;t found anything I can use.&amp;nbsp; Does anyone know how to do this or is there a link I can go to?&lt;/p&gt;
&lt;p&gt;Your help is very much appreciated!!!!&lt;/p&gt;</description></item></channel></rss>