It struck me today that, since I installed Vista I have run into a number of applications that require I escalate their privileges in order to have them run properly.
As I clicked through the approval.. for the 300th time this year it seems, it occurred to me that the average user is going to end up doing one of two things...
1. They will get so disenchanted with the dialogs constantly popping up for "legitimate" applications, that when a real threat presents itself they may very well click through UAC prompts in a zombie like fashion.
2. They will be paranoid of everything, and end up feeling like nothing on their computer works because they can never get applications to run, or when they do they crash with some kind of strange access error.
In the end it is still a step in the right direction. I remember when MS started discussing security some of the candid statements hinged around the idea that users that are not educated in security, will be nearly impossible to secure while preserving a good user experience.
Hopefully software will catch up with UAC and it will become seamless, then the average user will take note and UAC will be very useful to the masses.
Friday, January 12, 2007
Monday, January 8, 2007
Controlling input elements "disabled" attribute in ASP.NET
If you have ever wanted to have a client side button that has script which is generated from the server in ASP.NET you have most likely created an HTML control for which to do this. In the case of a input type of "button" you may have a need to disable this button within certain logic flows. The way to accomplish this is not exactly straightforward. Due to the fact that the XHTML attribute "disabled" is a boolean attribute. This essentially means that the mere presence of the attribute indicates that the input is disabled.
In order to be considered well formed XHTML the attribute can be set as disabled="disabled". This is easy enough to accomplish server side:
MyButton.Attributes["disabled"] = "disabled";
So that is great, we have a disabled button. How do we now enable the same? You might think that some other setting like disabled="false" would do the trick but it does not. Remember that the mere presence of the disabled attribute causes the input field to become disabled. So, we need to remove the attribute from the input control altogether. This is done by setting the attribute to null:
MyButton.Attributes["disabled"] = null;
This removes the attribute from the controls attributes collection and therefore suppresses the rendering of the disabled attribute.
In order to be considered well formed XHTML the attribute can be set as disabled="disabled". This is easy enough to accomplish server side:
MyButton.Attributes["disabled"] = "disabled";
So that is great, we have a disabled button. How do we now enable the same? You might think that some other setting like disabled="false" would do the trick but it does not. Remember that the mere presence of the disabled attribute causes the input field to become disabled. So, we need to remove the attribute from the input control altogether. This is done by setting the attribute to null:
MyButton.Attributes["disabled"] = null;
This removes the attribute from the controls attributes collection and therefore suppresses the rendering of the disabled attribute.
Subscribe to:
Posts (Atom)