Solved

Field security -- ASP.Net MVC 4 C#

Posted on 2013-06-20
3
539 Views
Last Modified: 2013-07-03
I am using ASP.Net MVC 4 C# Simple Membership.

What easy add-on/etc can I get make the
below View/Index.cshtml coding easier ?

Summary
 1. Index.cshtml page has 100+ textboxes
 2. each textbox has one of the below options
    depending on record's WorkFlowStage
    and logged in user's role
       ** Hidden
       ** ReadOnly --> below DisplayFor
       ** ReadWrite --> below EditorFor
------------------------------------------------
            @if(item.WorkFlowStage == '2')
            {
                if (User.IsInRole("BUICK_Inspector"))
                {    
                    <td>@Html.EditorFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }

                if (User.IsInRole("BUICK_LeadMan"))
                {    
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
               
                else
                {
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
            }

            @if(item.WorkFlowStage == '3')
            {
                if (User.IsInRole("BUICK_Tech"))
                {    
                    <td>@Html.EditorFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }

                if (User.IsInRole("BUICK_LeadMan"))
                {    
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
               
                else
                {
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
            }
0
Comment
Question by:finance_teacher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 39267440
Hi,

You can try Fluent Security - http://www.fluentsecurity.net/

Hope it helps u...
0
 

Author Comment

by:finance_teacher
ID: 39292872
I emailed fluentsecurity.net and they said their premade solution does not do this.

Any other ideas ?
0
 
LVL 23

Accepted Solution

by:
Roopesh Reddy earned 500 total points
ID: 39294285
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question