<?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>Configuration and Deployment</title><link>http://forums.asp.net/26.aspx</link><description>Configuring and deploying ASP.NET applications - web.config, \bin, etc.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Redirect a user with invalid permissions</title><link>http://forums.asp.net/thread/3273609.aspx</link><pubDate>Fri, 03 Jul 2009 13:39:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273609</guid><dc:creator>mandrews1234</dc:creator><author>mandrews1234</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273609.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=3273609</wfw:commentRss><description>&lt;p&gt;Did you guys see my if statement question. What is wrong with that? Also I tried the custom errors thing in my web.config but it still redirects to login.aspx. I can&amp;#39;t use a logged in template because they are logged in, they just don&amp;#39;t have the correct role. Am I correct on that? Thanks for all of your help.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Redirect a user with invalid permissions</title><link>http://forums.asp.net/thread/3272255.aspx</link><pubDate>Thu, 02 Jul 2009 20:48:06 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272255</guid><dc:creator>briangreig</dc:creator><author>briangreig</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272255.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=3272255</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Why not just add this&amp;nbsp;to your Web.config files:&lt;/p&gt;
&lt;p&gt;&lt;span class="" style="FONT-SIZE:x-small;COLOR:#008000;FONT-FAMILY:;"&gt;&lt;span class="" style="FONT-SIZE:x-small;COLOR:#008000;FONT-FAMILY:;"&gt;&lt;pre class="xhtml" name="code"&gt;&amp;lt;system.web&amp;gt;
&amp;lt;customErrors mode=&amp;quot;RemoteOnly&amp;quot; defaultRedirect=&amp;quot;GenericErrorPage.htm&amp;quot;&amp;gt;
&amp;lt;error statusCode=&amp;quot;403&amp;quot; redirect=&amp;quot;PermissionsError.aspx&amp;quot; /&amp;gt;
&amp;lt;/customErrors&amp;gt;

&amp;lt;/system.web&amp;gt;
&lt;/pre&gt;
&lt;p&gt;This will redirect all 403 errors (access denied) to your custom page. &lt;br /&gt;Good Luck,&lt;br /&gt;Brian&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;</description></item><item><title>Re: Redirect a user with invalid permissions</title><link>http://forums.asp.net/thread/3272235.aspx</link><pubDate>Thu, 02 Jul 2009 20:34:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272235</guid><dc:creator>sukumarraju</dc:creator><author>sukumarraju</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272235.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=3272235</wfw:commentRss><description>&lt;pre class="xhtml" name="code"&gt;//You can use LoginView control to achieve this. Instead of redirecting to 
//permissionsError.aspx you can display the Authorization message on the same 
//page.

&amp;lt;asp:LoginView ID=&amp;quot;LoginView1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
     &amp;lt;LoggedInTemplate&amp;gt;
          You are not a member of the Supervisors or Administrators roles. Therefore you cannot edit or delete any user information.
     &amp;lt;/LoggedInTemplate&amp;gt;
     &amp;lt;AnonymousTemplate&amp;gt;
          You are not logged into the system. Therefore you cannot edit or delete any user information.
     &amp;lt;/AnonymousTemplate&amp;gt;
&amp;lt;/asp:LoginView&amp;gt;

&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;br /&gt;Refer this &lt;a href="http://www.asp.net/learn/security/tutorial-11-cs.aspx" target="_blank"&gt;article&lt;/a&gt; that explains in detail.&amp;nbsp; Please note &lt;a href="http://www.asp.net/learn/security-videos/" target="_blank"&gt;here&lt;/a&gt; are number of videos on security including Role based security. &lt;/li&gt;
&lt;li&gt;Check &lt;a href="http://www.asp.net/learn/videos/video-45.aspx" target="_blank"&gt;this&lt;/a&gt; video that explains indetail, how to Authorize using Roles.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Let me know further Queries.&lt;/p&gt;</description></item><item><title>Redirect a user with invalid permissions</title><link>http://forums.asp.net/thread/3272190.aspx</link><pubDate>Thu, 02 Jul 2009 20:01:40 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272190</guid><dc:creator>mandrews1234</dc:creator><author>mandrews1234</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272190.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=3272190</wfw:commentRss><description>&lt;p&gt;I have went through and put in web.config files in each folder giving specific roles access or not. Now whenever a user tries to go to a page that they don&amp;#39;t have access to, they get redirected to the login page. How do I change that to a generic &amp;quot;sorry you don&amp;#39;t have permissions to see this page&amp;quot; page? Also, what is wrong with this if statement I want to redirect the user if they are not either a site admin or a super admin&lt;/p&gt;&lt;p&gt;If Not ((Roles.IsUserInRole(Membership.GetUser.UserName, &amp;quot;SiteAdmin&amp;quot;)) Or ((Roles.IsUserInRole(Membership.GetUser.UserName, &amp;quot;SuperAdmin&amp;quot;)))) Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Redirect(&amp;quot;PermissionsError.aspx&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If &amp;#39; if not roles&lt;/p&gt;&lt;p&gt;I get an error saying that the specified cast is not valid.&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>