I have a scenario that I haven't been able to solve:
I'm toying around with creating my own custom authorization attribute for mvc. The main bit of functionality I would like to add is to have the ability to change where the user gets redirected if they are not in a certain role. I don't mind that the system sends them back to the login...
Hi,
I am looking for ways to implement custom user-roles in windows application with vb.net. I got a database table called Roles with Administrator and User entries. User cannot see some of the form data. In ASP.NET MVC we can do like.
[Authorize(Roles = "Administrator")]
public function GetAccount() as Array
End Function
If it cou...
I am looking to have an attribute "show" on certain properties in my class and give the user the option to show other properties in the view.
Can I change a custom attribute from the front end?
...
Hi,
Sometimes I add an attribute to some of my controls. Like:
<a href id="myLlink" isClimber="True">Chris Sharma</a>
I know it is not a valid html. But it helps me in some cases.
Is this considered as a bad practice? A friend of mine says that it is ok for Intranet environment but on internet it might not be find friendly by search...
I have a bunch of input text boxes that have the attribute ORIGINAL set to their initial value, so that when the user changes the textbox value, jQuery can highlight items that have changed (by comparing the text box's current value to the ORIGINAL attribute's value)
What Im trying to do now is provide the user with a button that they c...
So, I'd like to implement my own custom authorization system in MVC2.
If I'd have to create a global class, where do I instantiate it?
Can HttpContext be extended with my own additions and where do I do that?
Should I use Authorization filters for rights validation or ActionFilters or do it within an action?
Can ActionFilter pass any da...
Okay I'm very new to C# and i'm trying to create a little website using ASP MVC2.
I want to create my own authorization attribute. but i need to pass some values if this is possible.
For example:
[CustomAuthorize(GroupID = Method Parameter?]
public ActionResult DoSomething(int GroupID)
{
return View("");
}
I ...
Hello All:
Can some body tell me any alternative to store some information for a particular tag in HTML 4. For example If I have a drop down like
<select>
<option value="0" regionId="1">Test1</option>
<option value="1" regionId="2">Test2</option>
</select>
Here regionId is a custom attribute, I am able to access the attribute but the...
Is it possible to get the decorated class' type inside of the custom attribute's class?
For example:
[MetadataAttribute]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)]
public class ViewAttribute : ExportAttribute
{
public object TargetRegion { get; set; }
public Type ViewModel { get;...
I have two custom attributes defined like so:
internal class SchemaAttribute : Attribute {
internal SchemaAttribute(string schema) {
Schema = schema;
}
internal string Schema { get; private set; }
}
internal class AttributeAttribute : Attribute {
internal AttributeAttribute(string attribute) {
Attribute...
I have created custom attributes for a category in my module's install script like so:
$attrib = array(
'type' => 'varchar',
'group' => 'My Data',
'backend' => '',
'frontend' => '',
'label' => 'My Custom Field',
'input' => 'text',
'class...
So according to Sun's J2EE documentation (http://docs.sun.com/app/docs/doc/819-3669/bnani?l=en&a=view), "If a tag attribute is not required, a tag handler should provide a default value."
My question is how in the hell do I define a default value as per the documentation's description. Here's the code:
<%@ attribute name="visible" ...
I have a custom attribute PackerAttrib which takes no data, simply marking a field or property, which will be used to mark a property or field of a class inherited from Panel in order to serialize it later on. How would I take an instance of any object derived from Panel and get a Directory<string s, object o> where s is the name of the ...
I recently upgraded a C# project from .NET 3.5 to .NET 4. I have a method that extracts all MSTest test methods from a given list of MethodBase instances. Its body looks like this:
return null == methods || methods.Count() == 0
? null
: from method in methods
let testAttribute = Attribute.GetCustomAttribute(method,
...
This question is related but not the same as this: http://stackoverflow.com/questions/40730/how-do-you-give-a-c-auto-property-a-default-value
I love auto-properties, but sometimes I have to do something like this:
private string someName;
public string SomeName
{
get
{
return someName;
}
set
{
someN...
I've been trying to figure this out all night, but I guess my knowledge of the .Net Framework just isn't that deep and the problem doesn't exactly Google well, but if I can get a nod in the right direction I'm sure I can implement it, one way or another.
I'd like to be able to declare a property decorated with a custom attribute as such...
I'm looking for a list of reasonable use cases of putting attributes in a parameter.
I can think of some good cases for attributes in a method, but can't seem to see a good usage of a parameter attribute. Please, enlighten me.
And what about attributes on the return type of a method?
...
So recently, I came up with a way to dynamically build a nav-bar menu where the Controller (And its Index ActionMethod) would be listed in a horizontal bar at the top of each page (via Site.Master) but also based on the user's assigned roles. Each Controller listed would also list (in a vertical drop-down) the ActionMethods available to ...
The MSDN Documentation: MemberInfo.GetCustomAttibutes Method (Type, Boolean) states in the remarks:
This method ignores the inherit parameter for properties and events. To search the inheritance chain for attributes on properties and events, use the appropriate overloads of the Attribute.GetCustomAttributes method.
This basically m...
Is it possible to pass custom attributes through a ViewStub to the target layout's root element? Like so:
<ViewStub
android:layout="@layout/custom_view"
app:customAttr="12345"
/>
Where custom_view.xml is:
<blah.CustomView ...>
...
</blah.CustomView>
When I try to do that, CustomView.java does not get "ap...