What is .NET Framework

Microsoft .NET Framework is an integral part of Windows operating system and it is used for developing applications that runs on family of Windows operating system. The .NET Framework has two major components called Common Language Runtime and .NET Base Class Library. .NET Framework support an array of language, VB.C#, F#, C++ and J# are supported by Visual Studio’s default installation.

Features of .NET Framework

Interoperability : Sometimes application developed in .NET has to interact with applications developed outside .NET. Access to COM components is provided in the System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework; access to other functionality is provided using the P/Invoke feature.

Common Runtime Engine : The Common Language Runtime (CLR) is the execution engine of the .NET Framework. Its CLR responsibility to locate, load and manage .NET types on your behalf. The CLR also takes care of a number of low-level details such as memory management, application hosting, handling threads, and performing various security checks.

Common Type System  : The CTS specification fully describes all possible data types and programming constructs supported by the runtime, specifies how these entities can interact with each other, and details how they are represented in the .NET metadata format. Common Type System makes .NET Framework language independent means, class libraries developed in one language can be used applications that are developed in some other language.

Base Class Library : The Base Class Library (BCL), part of the Framework Class Library (FCL), is a library of functionality available to all languages using the .NET Framework. The BCL provides classes which encapsulate a number of common functions, including file reading and writing, graphic rendering, database interaction, XML document manipulation and so on.

Simplified Deployment Model : .NET Framework provides a simplified deployment. Applications developed using .NET Framework are not required to register them as binary unit into system registry. Further more .NET Framework allows multiple versions of the same *.dll to exist in harmony on a single machine.

ASP.Net Exception Handling-Part I

.Net languages support structured exception handling means when ever an exception occurs .Net framework creates an exception object, this exception object represents complete information about the exception. You can catch this exception object using the try catch block code if your application failed to catch the exception then you see a error page like this

Exception Handling

Structured Exception Handling Features

  • Exceptions are objects means each exception wrapped with significant amount of useful information about exception instead of just plain text explaining the exception message or cause of exception. These exception objects also support an InnerException property that allows you to wrap a generic error over the more specific error that caused it. You can even create and throw your own exception objects.
  • Exception can be caught based on their type means you can catch specific type of exception following code show an example of this
Try
    IO.File.Open("F:\testfile.text", IO.FileMode.Open)

Catch ex As IO.FileNotFoundException
    Console.WriteLine("File Not found")
Catch ex As IO.PathTooLongException
    Console.WriteLine("File Path is to long")
End Try

  • Exception handlers can also be used in layered manner means you can always create exception handlers on top of other exception handlers for different section of code to handle their exception separately.
  • Exceptions are generic part of .Net framework.

 

Exception Class Overview

Exception class is base class for all exception classes. Exception class defines two type of exceptions

  • SystemException: This class provides a means to differentiate exception caused by system or application. SystemException does not provide information about the cause of exception and try to avoid throwing instance of this class , if there are cases when you want to throw or created object of this class , a human readable message describing the error should be passed to the constructor.
  • ApplicationException: The ApplicationException class differentiates between exceptions defined by applications versus exceptions defined by the system. If you are creating your own exception class then it is always advised to derive custom exception class from Exception class. Deriving custom exception class from ApplicationException class does not add any significant value to derived class.

Exception Class Properties

Exception includes a number of properties that help identify the code location, the type, the help file, and the reason for the exception: StackTrace, InnerException, Message, HelpLink, HResult, Source, TargetSite, and Data.

In Next article we will discuss more about exception class members and how to write a exception handling block.

ASP.net Special Folder

To have a convenient folder and file structure help web developers and designers to manage their web application in a efficient manner. With the release of .Net Framework 2.0, ASP.net reserves the some folder names, so developers can put special files in these folders.

App_Browser 

ASP.net reserve this folder name for storing browser definition files. Browser definition files are used to determine the client browser capabilities. Browser definition files have .browser extension.

App_Code

App_code folder can contain source code for utility classes as well business objects. Classes that are present in App_Code folder are automatically complied when your web application complied. Arbitrary file types can be placed in the App_Code folder to create strongly typed objects. For example, placing Web service files (.wsdl and .xsd files) in the App_Code folder creates strongly typed proxies. Code present in App_Code is automatically referenced by ASP.net Application.

App_Data

App_Data is used to store file that can be used as database files including MDF files, XML files, as well as other data store files. App_Data folder is used by ASP.net application for storing ASP.net application local database. Developers can also use this folder for storing data for their ASP.net Application.

App_GlobalResources

App_GlobalResources folder contains resources files that are complied into assemblies and these assemblies are available in Global scope. Resource files are strongly typed and can be accessed programmatically.

App_LocalResources

App_LocalResources folder also contain the same files that are being contained by App_GlobalResources  but files located in this folder are only available to a particular project, web page, master page or web user control.

App_Themes

App_Themes folder used by ASP.net to store files that are being used to define the look and feel of web application. App_Themes folder store skin, CSS and image files. Skin files are files have .skin file extension.

Bin

Bin folder contains complied assemblies(.dll) files for web user controls, classes or for components.

Technorati Tags: , , , , , ,

Overview Of ASP.net

Microsoft ASP.net

ASP.net is a web technology built on top of Microsoft .net framework. Microsoft released the first version of .net framework in 2002 called .net 1.0. ASP.net is successor of Microsoft’s Active server pages technology. ASP.net application are built on top of .Net CLR so they utilize the full power of all .Net framework supported languages. Traditional ASP pages have a number of limitations and application created in ASP were difficult to manage and they faced a significant performance and scalability issues. To overcome all these issues, Microsoft to come up with a new framework that will offer a clean separation code from the design. Some of the differences between ASP.net and ASP:

  • ASP.net programming model is completely object oriented. Apart from the object oriented support ASP.net applications are event driven, control based architecture.
  • Developers can use any programming languages included by Microsoft or any other third party programming languages for developing ASP.net applications. ASP.net applications can also be developed in multiple languages also.

Key Features of ASP.net

  • ASP.NET Is Integrated with the .NET Framework: .Net framework provide a massive collection of functionality and ASP.net application can utilize the same .Net framework classes as other .Net framework application like Windows or any other type of applications using .Net framework.
  • ASP.net Applications Are Complied: One of the biggest advantage with ASP.net applications is that they are always complied manes you can’t run any ASP.net application without compiling the code. When the code is compiled, it is translated into a language-independent and CPU-independent representation called Microsoft Intermediate Language (MSIL). At run time, MSIL runs in the context of the .NET Framework, which translates MSIL into CPU-specific instructions for the processor on the computer running the application.
  •   ASP.NET Is Object-Oriented: ASP.net follow completely object oriented programming model. ASP.net applications   have full access to all objects in the .NET Framework, but you can also exploit all the conventions of an OOP (object-oriented programming) environment. For example, you can create reusable classes, standardize code with interfaces, extend existing classes with inheritance, and bundle useful functionality in a distributable, compiled component.