Wednesday, August 13, 2008

Asp.net Directvies Previouspagetype

As Name suggest PreviousPageType directive is used to access previous page in currently executing page.PreviousPageType is a new directive makes excellence in asp.net 2.0 pages. The concept of cross-page posting between Asp.Net pages is achieved by this directive.

it has 2 Attributes

TagName: Sets the name of the derived class from which the postback will occur.

And

VirutalPath: sets the location of the posting page from which the postback will occur.

Monday, August 11, 2008

Asp.net Directive :Page

Page Directive defines Page specific attributes, which help to get command over customization of .aspx page.

Main Attributes are

Async

Makes page enable for asynchronous handler. Default value is false.

AsyncTimeOut

It defines the time-out (in seconds) used for asynchronous processes. The default time out is 45 seconds.Value must be in integer.

AspCompat

A the page to be executed on a single-threaded apartment (STA) thread. This allows the page to call STA components, such as a component developed with Microsoft Visual Basic 6.0. Setting this attribute to true also allows the page to call COM+ version 1.0 components that require access to unmanaged Active Server Pages (ASP) built-in objects. default is false.

AutoEventWireup

Indicates whether the page's events are autowired. true if event autowiring is enabled; otherwise, false.

ClassName

A string that specifies the name of the page class that will be dynamically compiled when the page is requested.

CodeFile


S
pecifies a path to the referenced code-behind file for the page.

Culture

Indicates the culture setting for the page. The value of this attribute must be a valid culture ID.

Debug
Indicates whether the page should be compiled with debug symbols.

EnableEventValidation

Validate events in postback and callback scenarios. true if events are being validated; otherwise, false. The default is true.

It reduces the risk of unauthorized postback requests and callbacks. When the enableEventValidation property is set to true, ASP.NET allows only the events that can be raised on the control during a postback request or callback.

EnableSessionState

Defines session-state requirements for the page. true if session state is enabled; ReadOnly if session state can be read but not changed; otherwise, false. The default is true.
EnableTheming
Indicates whether themes are used on the page. true if themes are used; otherwise, false. The default is true.

EnableViewState

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

EnableViewStateMac

Indicates that ASP.NET should run a machine authentication check (MAC) on the page's view state when the page is posted back from the client. true if view state should be MAC checked; otherwise, false. The default is true.
A view-state MAC is an encrypted version of the hidden variable that a page's view state is persisted to when sent to the browser. When you set this attribute to true, the encrypted view state is checked to verify that it has not been tampered with on the client. Note that setting this attribute to true affects performance, because the variable value must be decrypted and encrypted for each round trip of the page.
ErrorPage

Defines a target URL for redirection if an unhandled page exception occurs.

MaintainScrollPositionOnPostback

Maintain user at same position in the client browser after postback. true if users should be returned to the same position; otherwise, false.

SmartNavigation
Indicates whether the page supports the smart navigation feature of Internet Explorer 5.5 or later. true if smart navigation is enabled; otherwise, false. The default is false.
Theme

Specifies a valid theme identifier to use on the page. When the Theme attribute is set without using the StyleSheetTheme attribute, it overrides individual style settings on controls, enabling you to create a unified and consistent look on a page.
Title
Specifies a title for the page which will rendered as a html title tags in the response. The title can also be accessed programmatically as a property of the page.
Transaction

Tells that transactions are supported on the page. Probable values are Disabled, NotSupported, Supported, Required, and RequiresNew. The default is Disabled.

ValidateRequest

This attributes determines request validation should occur. If true, request validation ensure all input data against a hard-coded list of malicious values If a match occurs, an HttpRequestValidationException exception 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.


I hope this will help you.

Source :MSDN,dotnetspider,Forums.asp.net.

Saturday, August 9, 2008

Asp.net Directive :OutputCache

OutputCache as name suggest use to handle caching concept.

It handles/control caching policies for asp.net pages or controls,
users can handle caching programmatically also.

Attributes are

Duration
The time, in seconds, that the page or user control is cached. Setting this attribute on a page or user control establishes an expiration policy for HTTP responses from the object and will automatically cache the page or user control output.
Location:

To specify the location to store the output cache.
To store the output cache on the browser client where the request originated set the value as ‘Client’.
To store the output cache on any HTTP 1.1 cache-capable devices including the proxy servers and the client that made request, specify the Location as Downstream.
To store the output cache on the Web server, mention the location as Server.

VaryByControl: List of strings used to vary the output cache of a user Control, separated with semi-colon.
A semicolon-separated list of strings used to vary a user control's output cache. These strings represent the ID property values of ASP.NET server controls declared in the user control.

VaryByParam: List of strings used to vary the output cache, separated with semi-colon.

A semicolon-separated list of strings used to vary the output cache. By default, these strings correspond to a query string value sent with GET method attributes, or a parameter sent using the POST method. When this attribute is set to multiple parameters, the output cache contains a different version of the requested document for each specified parameter. Possible values include none, *, and any valid query string or POST parameter name.

VaryByCustom:
String of values, specifies the custom output caching requirements.

VaryByHeader: List of HTTP headers used to vary the output cache, separated with semi-colon.
A semicolon-separated list of HTTP headers used to vary the output cache. When this attribute is set to multiple headers, the output cache contains a different version of the requested document for each specified header.

Friday, August 8, 2008

Directives -Master

@Master directive belongs to Master Pages that is .master files.
Master pages are use to mitigate redundant coding & programming.So, Master pages are use to create for integrating common code in all pages such as header footer,navigation , banners which are most common features in any web applications.

This directive
Defines master page–specific (.master file) attributes that are used by the ASP.NET page parser and compiler.

Its Attributes are

AutoEventWireup

To hook up event with control explicitly if it set false else event auto-wiring is enabled; The default is true.

ClassName

Specifies the class name for the class that is automatically generated from the markup and compiled when the master page is processed. This value can be any valid class name and can include a namespace.

CodeFile

Specifies the name of a separate file that contains a partial class with the event handlers and other master page–specific code.

CompilationMode

Specifies whether to compile an ASP.NET master page at run time. Options are Always to always compile the page; Auto, if ASP.NET is to avoid compiling the page, if possible; and Never, to never compile the page or control. The default is Always.

CompilerOptions
Provides a string containing compiler options to use to compile the page. In C# and Microsoft Visual Basic, this is a sequence of compiler command-line switches.

Debug

Indicates whether to compile the master page with debug symbols. true, to compile with debug symbols; otherwise, false.

Description

Provides a text description of the master page. This value is ignored by the ASP.NET parser.

EnableTheming

Indicates whether the appearance of the master page and of controls on the master page can be modified, if a theme is applied. true if a theme can be applied; otherwise, false. The default is true. Setting the EnableTheming attribute is primarily useful when a page theme is defined in the Web.config file and applies to all pages, by default.

EnableViewState

Indicates whether view state is maintained across page requests. true to maintain view state; otherwise, false. The default is true.

Explicit

Determines whether the page is compiled using the Visual Basic Option Explicit mode. true indicates that the Visual Basic explicit compile option is enabled and that all variables must be declared using a Dim, Private, Public, or ReDim statement; otherwise, false. The default is false.

Inherits

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

Language

Specifies the language used when compiling all inline rendering (<% %> and <%= %>) and code declaration blocks within the page. Values can represent any language that is supported by the .NET Framework, including VB (Visual Basic), C#, and JScript.

LinePragmas

Determines whether the runtime should generate pragmas in the generated code.

MasterPageFile

Specifies the .master file that acts as a master page for a master page. The MasterPageFile attribute is used in a master page when defining a child master page in a nested master-page scenario.

Src

Specifies the source file name of the code-behind class to dynamically compile when the page is requested. You can choose to include programming logic for your page either in a code-behind class or in a Code Declaration Blocks in the .aspx file.

Strict

Specifies whether to compile the page using the Visual Basic Option Strict mode. true if Option Strict is enabled; otherwise, false. The default is false.
The Strict attribute is ignored by languages other than Visual Basic.

WarningLevel

It Specifies the compiler warning level at which you want the compiler to abort compilation for the page. Its Possible values are from 0 through 4.

Thursday, July 10, 2008

Assembly Directive

Hi,
Assembly Directive used to link assembly in to our application.
To Make our ASP.NET page aware of external components.
It has following attibutes/property.

a. Name: Enables you specify the name of an assembly you want to attach to the page.
Here you should mention the filename without the extension.
b. Src: represents the name of a source code file
<%@ Assembly Name="YourAssemblyName" %>



Thursday, July 3, 2008

Asp.net Directives

Directives are those things which handles the behavior of Asp.net pages.
We have eleven directives to enrich and nurture our asp.net pages or user control.


Directives are opened <%@ and close with %>
Developers have tendacy to decalre it on top of the page, It does not matter if you declare them at any part of the page.
List of directives in alphabatical order.

Assembly :- Used to link assembly.Control :- For User Control.Implements:- For implement .Net interface.Import:- For Importing Namespace in to page or user control.
Master :- For Using Master page , .Master Page required.MasterType:-Associate a class name to get strongly typed refrences within the specfied master page.
OutputCache:-Controls the Caching Mechanism.
Page:- Allow users to specify a page level attributes,Only can be used with Asp.net Page.
PreviousPageType:-Enables in asp.net Page to handles few things about previous page.
Reference:-Links page or user control to the current page or user control.
Register:-Associate aliase with namespaces and class name for notation in the custom server control.

I will try to explain each useful directive one by one on my forthcoming

posts.......

Saturday, June 28, 2008

Web Hosting and Domain

Hi,
Let me share few information regarding Web hosting and DNS.

Web Host -Means Server where our website resides.This always up and connected to internet to make our web site active.

Shared Hosting:- Most of the host provides Shared Hosting , as it is meaningless to use whole server for small website which does not have very heavy traffic or not a big application.
At that time on a on server more then one website is hosted and manged.shared hosting is widely used , it is very cost effective too.Shared hosting may not provide full access to server(it is depends upon service provider also).

Dedicated Server:- Dedicated Server means only one particuler website or particular user owns a server.Where Owner(Person who purchase Dedicated server from host ,yes your own pc also can be a dedicated server).Owner have full access of server ,freedom of installing new s/w ,uninstall s/w.

DNS:-Domain Name Server
As we all knows on back side web request is made through IPs.
DNS :- Map the IP(where our website hosted) and Domain Name (like www.google.com).
As defination you can say
DNS is the service which translates between Internet names and Internet addresses.
If you are working on a Windows machine, you can view your current IP address with the command WINIPCFG.EXE (IPCONFIG.EXE for Windows 2000/XP). On a UNIX machine, type nslookup along with a machine name (such as "nslookup www.howstuffworks.com") to display the IP address of the machine (use the command hostname to learn the name of your machine).

DNS is such a big thing so it can not be explained in a single post I will add more information about it.