Monday, 25 October 2010

Build Providers

Build Providers can be used by two entities in the development cycle, The build provider is first used is during te developemnt when you are building youe solution in VS 2010. For Instance when placing a CS file in App_Code folder IDE give you automatic the access to it's classes and their method instantly. 
The other entity that use the build provider is the ASP.NET itself, if you drag and drop a CS file in the App_Code folder of deployed application automatically gives the application access to the classes in the CS file.

A build provider is simply a class that inherits from System.Web.Compilation.BuildProvider
the <buildProviders> section in web.config file allows you to list the build providers classes that will be utilized.
<add extension=".wsdl" Type="System.web.Compilation.WsdlBuildProvider">

Using the Built-in Build Providers
The ForeceCopyBuildProvider is basically copies only those files for deployment that use the defined extensions, you can add other file types that you want to be part of this copy process. 
<add extension=".chm" Type="System.Web.Compilation.ForceCopyBuildProvider">

The IgnoreFileBuildProvider causes the defined files to be ignored form in the deployment or compilation process. 
<add extension=".vsd" Type="System.Web.Compilation.IgnoreFileBuildProvider">

ASP.NET Page Events

ASP.NET 1.0/1,1 Page events are:

  1. AbortTransaction
  2. ComitTransaction
  3. DataBinding
  4. Disposed
  5. Error
  6. Init
  7. Load
  8. PreRender
  9. Unload

ASP,NET 4.0 Page events in order are:

  1. PreInit
  2. Init
  3. InitComplete
  4. PreLoad
  5. Load
  6. LoadComplete
  7. PreRender
  8. PreRenderComplete
  9. Unload

Sunday, 24 October 2010

Pages Directives

These directives like:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TopTenEgypt._Default" %>
General syntax:
<%@ [Directive] [Attribute=value[Attribute=value] %>
Directives are:
  1. Assembly: To link an assembly to a page or user control.
  2. Control: User controls, ASCX files.
  3. Implements: Implement a .NET Framework interface
  4. Import: Imports a namespace into a page or a user control.
  5. Master: a Master page
  6. MasterType: Associate a class name to a page to get a strongly typed references or members of the specified master page.
  7. OutputCache: To control the output cache of the page or user control.
  8. Page: used with ASPX files to specify the page attributes. 
  9. PreviousPageType: enable the page to work with post back from another page in the application.
  10. Reference: To link another page or user control to the current page or user control.
  11. Register: To associate aliases with namespaces and class names for notation in customer server control syntax.
Directives attributes:
  1. AspCompat: To permit the page to be executed on a single-threaded apartment thread [Default=False] 
  2. Async: To specify the page to be processed synchronously or asynchronously 
  3. AsyncTimeout: the amount of time to wait the async task to complete [default=45 Sec]
  4. Buffer: To enable HTTP response buffering [default=True]
  5. ClassName: the class that is bound to the page when the page is compiled.
  6. ClientIDMode: Specify how the page generate the ClientID values for its server controls
  7. ClientTarget: Specify the taget user agent the control should render content for, Should be tied to an alias in Web.config file in <ClientTarget> Section.
  8. CodeFile: The Code-behind file
  9. CompilationMode: ASP.NET should compile the page or not [Auto,never, Always]
  10. CompilerOptions: Compilation Options of the page.
  11. CompileWith: the code-behind file used (?)
  12. ContentType:the content type of the HTTP response as MIME Type.
  13. Culture: the culture attribute of the page, can be Auto.
  14. Debug: If True, compile the page with debug symbols in place.
  15. EnableEventValidation: If true, validate the events in post-back and callback.
  16. EnableSessionState: To Enable/disable the session state for the page.
  17. EnableTheming: If True, the page is enabled to use themes.
  18. EnableViewstate: If True, View state is maintained across the page. 
  19. EnableViewstateMac: If true, page runs a machine-authenticated check on the page view state when the page is posted back.
  20. ErrorPage: an URL to post in case of all unhandeled page exceptions.
  21. Langauge
  22. LCID: Defined the Locale Identifier for web form's page.
  23. LinePragmas: weather line pragmas are used with the resulting assembly.
  24. MasterPageFile: Used with content pages to points to the master page file (.master).
  25. MaintainScrollPositionOnPostback
  26. MetaDescription (ASP.NET 4.0): Page description for SEO purposes.
  27. Metakeywords (ASP.NET 4.0)
  28. ResponseEncoding
  29. SmartNavigation: like MaintainScrollPositionOnPostback
  30. Src: Points to the source file of the class used for the code behind of the page being rendered.
  31. Strict: (VB)If true,Compile page in Strict Mode
  32. Theme: Applying the specified theme on the page.
  33. StyleSheetTheme: like Theme, but StyleSheetTheme wont override preexisting style setting in the controls.
  34. Title
  35. Trace: If true, enable Trace messages on the page.
  36. TraceMode: like SortByTime, SortByCategory
  37. Transaction: Specify weather transacctions are supported on the page. [Default=False].
  38. UICulture: which UI Culture to use on the page, use Auto to automatic detection of UI culture.
  39. ValidateRequest: If True, the page inputs are checked against a list of potential dangerous values to protecet your application from attacks like JavaScript attacks. 
  40. ViewStateEncriptionMode: Specify how the view-state are encrypted [Default=Auto] 
  41. WarningLevel: Specify the compiler warning level at which stop compilation of the page.

Used to specify the page from which any cross-page posting originates. 
  1. TypeName: the name of the class from which the post-back will occur.
  2. VirtualPath: the locati
Controls the output cahcing polices of ASp.NET page or use control.
  1. CacheProfile: To central the way of managing an application cache profile, use the CacheProfile detailed in web.config file.
  2. Duration: the caching time in seconds
  3. Location: works with ASPX files only, values [None, DownStream, Client, Server, ServerAndClient].
  4. NoStore: To send No-Store header with the page.
  5. Shared: Specify weather a user control output can be shared across a multiple pages
  6. SqlDependecy: To enable the page to use SqlDependency.
  7. VaryByControl: Semicolon-separated list of strings used to vary the output cache of a  user control.
  8. CaryByCustom: String specifing the custom output cacheing requirement.
  9. VaryByParm: Semicolon-seperated list of strings used to vary the output cache.
  10. VaryByHeaderSemicolon-seperated list of HTTP headers used to vary the output cache

ASP.NET Acronyms

SEOSearch Engine Optimization

Do you know that..!

  • The bullet-in Web Server in visual studio 2008/2010 was previously presented as a code sample project called Cassini.