Monday, May 26, 2008

ASP.NET 2.0 Directives

Hi,

Today I've decided to write about ASP.NET 2.0 directives. There are 11 of them. Here is a full list of directives:



DirectiveAttributesShort description
@AssemblyName
Src
Imports assembly with given name into page or control
@ControlThe same as Page hasApplied for properties setting while creating custom controls
@ImplementsInterfaceSpecifies that page's class implements this interface
@ImportNamespaceImports given namespace
@MasterThe same as Page hasApllied for specifying Master Page template. New in ASP.NET 2.0
@MasterTypeTypeName
VirtualPath
Gives strongly typed reference on class contained in Master Page. Gives opportunity to reference class properties.
OutputCacheDuration
Location
VaryByCustom
VaryByHeader
VaryByParam
VaryByControl
Controls Page or Control caching. See msdn for details.
@PageDescribed belowAttributes refering current Page.Used only if files with .aspx extension.
@PreviousPageTypeTypeName
VirtualPath
Page, which was used for user data sending. New in ASP.NET 2.0.
@ReferencePage
Control
Page or Control that should be compiled with current.
@RegisterAssembly
Namespace
Src
TagName
TagPrefix
Associates aliases with namespaces and class names for notation in custom server control syntax.


@Page Directive

The @Page directive enables you to specify attributes and values for an Asp.Net Page to be used when the page is parsed and compiled. Every .aspx files should include this @Page directive to execute. There are many attributes belong to this directive. We shall discuss some of the important attributes here.

Language: This attribute tells the compiler about the language being used in the code-behind. Values can represent any .NET-supported language, including VB.NET, C#, or JScript .NET.

AutoEventWireup: For every page there is an automatic way to bind the events to methods in the same .aspx file or in code behind. The default value is true.

CodeFile: Specifies the code-behid file with which the page is associated.

Title: To set the page title other than what is specified in the master page.

Culture: Specifies the culture setting of the page. If you set to auto, enables the page to automatically detect the culture required for the page.

UICulture: Specifies the UI culture setting to use for the page. Supports any valid UI culture value.

ValidateRequest: Indicates whether request validation should occur. If set to true, request validation checks all input data against a hard-coded list of potentially dangerous values. If a match occurs, an HttpRequestValidationException Class is thrown. The default is true. This feature is enabled in the machine configuration file (Machine.config). You can disable it in your application configuration file (Web.config) or on the page by setting this attribute to false.

Theme: To specify the theme for the page. This is a new feature available in Asp.Net 2.0.

SmartNavigation: Indicates the smart navigation feature of the page. When set to True, this returns the postback to current position of the page. The default value is false.

MasterPageFile: Specify the location of the MasterPage file to be used with the current Asp.Net page.

EnableViewState: Indicates whether view state is maintained across page requests. true if view state is maintained; otherwise, false. The default is true.

ErrorPage: Specifies a target URL for redirection if an unhandled page exception occurs.

Inherits: Specifies a code-behind class for the page to inherit. This can be any class derived from the Page class.

There are also other attributes which are of seldom use such as Buffer, CodePage, ClassName, EnableSessionState, Debug, Description, EnableTheming, EnableViewStateMac, TraceMode, WarningLevel, etc. Here is an example of how a @Page directive looks

Monday, May 5, 2008

How to disable Vista UAC.

Hi,

I've noticed that Vista UAC turned on automatically about 2 weeks(my work PC is in domain) ago and now I can't turn it off using Control Panel - it simply doesn't turns off. UAC irritates me highly and I've started searching the solution how to kill it :) And found one very usefull. UAC still works but doesn't display any messages :-))

You just need to create 2 keys in registry, here they are:
In [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"ConsentPromptBehaviorAdmin"=dword:00000000
"EnableLUA"=dword:00000001

Or if you want to turn it off totally simply change and reboot:
"EnableLUA"=dword:00000000

You can also use msconfig to do the same:
- Start - Run - msconfig - Tools -Disable UAC

Hope this will help other people.