<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Role-Based Authorization</title><link>http://www.asp.net</link><pubDate>Wed, 27 Mar 2013 21:00:58 GMT</pubDate><generator>umbraco</generator><description>Comments for Role-Based Authorization</description><language>en</language><atom:link href="http://www.asp.net/rss/comments/33407" rel="self" type="application/rss+xml" /><item><title>Comment Posted by jibarra</title><link>http://www.asp.net/web-forms/tutorials/security/roles/role-based-authorization-vb</link><pubDate>Mon, 25 Jul 2011 22:41:41 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000013832</guid><description><![CDATA[ <p>nice, great tutorial</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/jibarra.jpg?forceidenticon=false&amp;dt=635047854600000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by zyklo</title><link>http://www.asp.net/web-forms/tutorials/security/roles/role-based-authorization-vb</link><pubDate>Sun, 08 Apr 2012 18:05:18 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015282</guid><description><![CDATA[ <p>I&#39;m getting an error on this line:</p><p></p><p>Dim UserName As String = UserGrid.DataKeys(e.RowIndex).Value.ToString()</p><p></p><p>in UserGrid_RowDeleting and UserGrid_RowUpdating</p><p></p><p>Error is:</p><p></p><p>Index was out of range. Must be non-negative and less than the size of the collection.</p><p>Parameter name: index</p><p></p><p>Have done exactly as this toturial says, and used cut and paste where possible.</p><p></p><p>Anyone knows what I am doing wrong?</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/zyklo.jpg?forceidenticon=false&amp;dt=635047854600000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by jkjerome</title><link>http://www.asp.net/web-forms/tutorials/security/roles/role-based-authorization-vb</link><pubDate>Wed, 06 Mar 2013 04:37:03 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018584</guid><description><![CDATA[ <p>I appreciate the intention not offend anyone with this constantly switching from &quot;he&quot; to &quot;she&quot;, but the result is just weird to read.</p><p>Why not just say &quot;they&quot; or &quot;their&quot; instead?</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/jkjerome.jpg?forceidenticon=false&amp;dt=635047854600000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by jkjerome</title><link>http://www.asp.net/web-forms/tutorials/security/roles/role-based-authorization-vb</link><pubDate>Sat, 09 Mar 2013 02:58:28 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018636</guid><description><![CDATA[ <p>Under &quot;Programmatically Limiting Functionality&quot; it states:</p><p>&quot;Note: It is possible to hide the CommandField altogether when a non-Supervisor and non-Administrator is visiting the page. I leave this as an exercise for the reader.&quot;</p><p></p><p>If you&#39;re stuck on this, you can achieve this by amending your pageload event in RolesBasedAuthorization.aspx.vb as follows:</p><p>__________________________________________________________________________________________</p><p>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load</p><p></p><p>      If Not Page.IsPostBack Then</p><p></p><p>         UserGrid.Columns(0).Visible = (User.IsInRole(&quot;Administrators&quot;) OrElse User.IsInRole(&quot;Supervisors&quot;))</p><p></p><p>         BindUserGrid()</p><p></p><p>      End If</p><p></p><p>End Sub</p><p>__________________________________________________________________________________________</p><p></p><p>This is similar to how you would have hidden the link button in the grid on UserBasedAuthorization.aspx in a previous tutorial(if you did the &quot;I&#39;ll leave it to the reader&quot; exercise[a.k.a. &quot;I can&#39;t really be arsed to explain this one&quot; exercise] on that page)</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/jkjerome.jpg?forceidenticon=false&amp;dt=635047854600000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by jkjerome</title><link>http://www.asp.net/web-forms/tutorials/security/roles/role-based-authorization-vb</link><pubDate>Sat, 09 Mar 2013 03:17:03 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018637</guid><description><![CDATA[ <p>Sorry to say it again but these tutorials desperately need proof-reading/testing. Not such a problem if you know what you&#39;re doing already but pretty useless if you don&#39;t. Lets face it lots of the latter will be using these tutorials so why put them through that?</p><p></p><p>......</p><p></p><p>Talking of which, under &quot;Step 3: Applying Role-Based Authorization Rules to Classes and Methods&quot; the 3 PrincipalPermission lines need a space inserting before the line contiuation character, otherwise you&#39;ll get a build error for each line. Spaces inserted below:</p><p></p><p>&lt;PrincipalPermission(SecurityAction.Demand, Role:=&quot;Administrators&quot;)&gt; _</p><p>&lt;PrincipalPermission(SecurityAction.Demand, Role:=&quot;Supervisors&quot;)&gt; _ </p><p>Protected Sub UserGrid_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles UserGrid.RowUpdating</p><p></p><p>      ... </p><p>End Sub  </p><p></p><p>&lt;PrincipalPermission(SecurityAction.Demand, Role:=&quot;Administrators&quot;)&gt; _ </p><p>Protected Sub UserGrid_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles UserGrid.RowDeleting</p><p>      ... </p><p>End Sub</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/jkjerome.jpg?forceidenticon=false&amp;dt=635047854600000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ricka6</title><link>http://www.asp.net/web-forms/tutorials/security/roles/role-based-authorization-vb</link><pubDate>Wed, 27 Mar 2013 21:00:58 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018792</guid><description><![CDATA[ <p>@jkjerome - he/she - agreed. Thanks again for your contributions.</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/ricka6.jpg?forceidenticon=false&amp;dt=635047854600000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>