<?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>Architecture</title><link>http://forums.asp.net/16.aspx</link><description>Discuss and debate ASP.NET application designs. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=8&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: Object Oriented way to handle access</title><link>http://forums.asp.net/thread/3273598.aspx</link><pubDate>Fri, 03 Jul 2009 13:34:10 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273598</guid><dc:creator>vivek_iit</dc:creator><author>vivek_iit</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273598.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=16&amp;PostID=3273598</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;piyushc:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/p&gt;&lt;p&gt;Depending on the user role, I need to show/hide some part of the page and even set properties of the controls. &lt;/p&gt;
&lt;p&gt;This has led to n number of if-else statements in my aspx page which does not smell good. &lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;You need to create a Permissions utility class, with a method like : bool HasAccess(ActionEnum action, User user)&lt;/p&gt;&lt;p&gt;You can divide your system objects into Actions, like ShowHeader, ShowFooter etc.&lt;/p&gt;&lt;p&gt;Each user will have its own permission set, and this utility function will check the user&amp;#39;s role and associate it with the relevant permission to return true or false based on if the user has permission to perform that action or not.&lt;/p&gt;&lt;p&gt;Hope this helps,&lt;/p&gt;&lt;p&gt;Vivek&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Object Oriented way to handle access</title><link>http://forums.asp.net/thread/3273557.aspx</link><pubDate>Fri, 03 Jul 2009 13:06:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273557</guid><dc:creator>DigiMortal</dc:creator><author>DigiMortal</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273557.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=16&amp;PostID=3273557</wfw:commentRss><description>&lt;p&gt;I think that it is bes for you if you separate the pages for different roles. User controls should be able to function without knowing who and how is using them - they just get their data and get all the orders from parent controls or pages. Maybe today your code behind the pages is not very large and complex to handle but it may happen soon. Usually all specific roles add their own little differences and it is better if you consider this right now than later when there is a lot of code that needs to be moved and refactored.&lt;/p&gt;</description></item><item><title>Re: Object Oriented way to handle access</title><link>http://forums.asp.net/thread/3273188.aspx</link><pubDate>Fri, 03 Jul 2009 09:40:46 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273188</guid><dc:creator>v.vivek</dc:creator><author>v.vivek</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273188.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=16&amp;PostID=3273188</wfw:commentRss><description>&lt;p&gt;this are my sugession that may be useful for ur application.&lt;/p&gt;&lt;p&gt;create usercontrol (Nevigation control) on the basis of different role.&lt;/p&gt;&lt;p&gt;on login store role type in session .&lt;/p&gt;&lt;p&gt;dynamic bind specfic usecontrol based on role.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Object Oriented way to handle access</title><link>http://forums.asp.net/thread/3273095.aspx</link><pubDate>Fri, 03 Jul 2009 08:52:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273095</guid><dc:creator>RickNZ</dc:creator><author>RickNZ</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273095.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=16&amp;PostID=3273095</wfw:commentRss><description>&lt;p&gt;The ideal object oriented way is that each object knows how to display itself, including in response to the current role, etc.&lt;/p&gt;&lt;p&gt;You might consider things like creating some user controls that know how to respond to the current role.&amp;nbsp; If the actions involve multiple pages, you might be able to implement some of the logic in a master page or in a common page base class.&amp;nbsp; If it involves all controls of a given type, you can use control adapters or tag mapping.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Object Oriented way to handle access</title><link>http://forums.asp.net/thread/3272839.aspx</link><pubDate>Fri, 03 Jul 2009 06:43:30 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272839</guid><dc:creator>piyushc</dc:creator><author>piyushc</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272839.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=16&amp;PostID=3272839</wfw:commentRss><description>&lt;p&gt;Hello All, &lt;/p&gt;
&lt;p&gt;I have this question since quite some time now.&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;have a project in which I have few user roles. &lt;/p&gt;
&lt;p&gt;Depending on the user role, I need to show/hide some part of the page and even set properties of the controls. &lt;/p&gt;
&lt;p&gt;This has led to n number of if-else statements in my aspx page which does not smell good. &lt;/p&gt;
&lt;p&gt;What is the way to handle such scenarios using Object Oriented techniques? &lt;/p&gt;
&lt;p&gt;Help is appreciated. &lt;/p&gt;
&lt;p&gt;Thanks, Piyush&lt;/p&gt;</description></item></channel></rss>