What are the best-practices and/or standards for creating a user control in ASP.Net MVC web applications with the ability to limit the functionality of it, based on the user role or user itself?
In other words, assume that I have four different web pages with 90% exact similar content (some search fields, a grid containing the result of the search, some javascript, ...) and each one may have one or two other search fields. (Please note that these extra search fields on each page, are effective in the result of the search. also please consider that we use the same stored procedures behind the scene, and in pages with less search fields, we pass null or default values -based on the situation- to them).
we are looking for a way to refactor our code and if it's possible use a USER CONTROL in each of four pages instead.
edit : maybe I should correct the question to something like this : how to avoid putting <% if(...)%> tags inside the view and use a method like the one described here, where CRice said: "it is better to let the viewdata or model represent what the view is to display, and the view can simply check the view data. A controller base class or a filter on an action can make repetitive use of this very simple and allow the code to exist in one place." in order to solve my problem?
people keep emphasizing on the check user-in-role part. In fact I had already knew this when I asked the question. What I don't know is how to do it the right way, using viewdata or model or whatever suits these kind of cases. (specially using the model as described in the reference question)
Thanks a lot for guiding me through this and your patience.