Posts Tagged ‘.net’

Introduction to Visual Studio .NET

Tuesday, September 30th, 2008

Visual Studio.NET is based on the .NET framework.
Visual Studio.NET provides languages and tools that enable you to build Web-based, desktop, and mobile applications. You can also create Web services in Visual Studio.NET.

Visual Studio.NET includes the following programming languages:
1
. Visual Basic.NET
2. Visual C++.NET
3. Visual C#.NET
It also provides additional technologies, such as ASP.NET, that enable you to develop and deploy applications.In addition, Visual Studio.NET includes the MSDN library that contains documentation on various development  tools and applications.

Using the integrated development environment (IDE) of Visual Studio.NET, you can create applications in the various .NET languages. The IDE of Visual Studio.NET enables you to share tools and create applications in multiple languages.

Visual Studio.NET includes various enhancements over earlier versions of Visual Studio.

 New Features in Visual Basic :

Unlike Visual Basic 6.0, Visual Basic.NET is an object-oriented language.Visual Basic.NET supports the abstraction, encapsulation, inheritance, and polymorphism features.The earlier versions of Visual Basic, versions 4 through 6, supported interfaces but not implementation inheritance. Visual Basic.NET supports implementation inheritance as well as interfaces.Another new feature is overloading.In addition, Visual Basic.NET supports multithreading,which enables you to create multithreaded and scalable applications. Visual Basic.NET is also compliant with the common language specification (CLS) and supports structured exception handling.

Visual C# .NET
Visual Studio.NET provides a new language, Visual C#.NET, which is an object-oriented language based on the C and C++ languages. Using Visual C#.NET, you can create applications for the .NET framework. As mentioned earlier, Visual C#.NET supports the CLR, therefore, any code written in Visual C#.NET is managed code. The IDE provides various templates, designers, and wizards to help you create applications in Visual C#.NET.

Visual C++ .NET
Visual C++.NET is an enhanced version of Visual C++. Visual C++.NET includes features such as support for managed extensions and attributes.Managed extensions include a set of language extensions for C++ to enable you to create applications for the .NET framework. Using managed extensions, you can easily convert existing components to components that are compatible with the .NET framework. Therefore, with the help of managed extensions, you can reuse existing code and thus save both time and effort. In addition, by using managed extensions, you can combine both unmanaged and managed C++ code in an application.

The CLS is a set of rules and constructs that are supported by the CLR. Visual Basic.NET is a CLS-compliant language. Any objects, classes, or components that you create in Visual Basic.NET can be used in any other CLS-compliant language. In addition, you can use objects, classes, and components created in other CLScompliant languages in Visual Basic.NET. The use of the CLS ensures complete interoperability among applications, regardless of the language used to create the application. Therefore, while working in Visual Basic.NET, you can derive a class based on a class written in Visual C#.NET, and the data types and variables of the derived class will be compatible with those of the base class.

Visual C++.NET also supports attributes, which enable you to extend the functionality of the language and to simplify the creation of COM components. You can apply attributes to classes, data members, or member functions.

What are Web Forms ?
Visual Studio.NET introduces Web forms, which are based on Microsoft ASP.NET technology. Web forms are used to create Web pages. In Visual Studio.NET, you can drag controls to the designer and then add code to create Web pages. A Web forms page can open in any Web browser. The controls in a Web forms page are based on server-side logic.

What are Windows Forms ?
Windows forms provide a platform for developing Windows applications based on the .NET framework. Windows forms include a set of object-oriented and extensible classes that enable you to implement visual inheritance. Visual inheritance enables you to inherit a form from an existing form. Using these classes, you can develop Windows applications by creating a form based on an existing form. When you create forms based on existing forms, you can reuse code and thus enhance productivity. Typically,Windows forms are used to create user interfaces for a multitier application.

What are Web Services ?
Web services are applications that exchange data by using eXtensible Markup Language (XML). Web services can also receive requests over HTTP. Web services are not a part of any specific component technology. Therefore, any language or operating system can use Web Services. You can use Visual Basic.NET, Visual C#.NET, or ATL Server to create Web services.

XML(Extensible Markup Language)

XML is a markup language based on Standard Generalized Markup Language (SGML), which is a standard for all markup languages. XML is a subset of SGML. XML enables you to define the structure of data by using markup tags. In addition, you can also define new tags using XML.The World Wide Web Consortium (W3C) has defined XML standards to ensure that structured data is uniform and independent of applications.

Visual Studio.NET it also provides XML Designer, which enables you to create and edit XML documents and create XML schemas.

Online Dot Net Books

Saturday, August 9th, 2008

Dot Net Interview Questions

Wednesday, July 30th, 2008

What is .NET?
.NET is essentially a framework for software development. It is similar in nature to any other software development framework (J2EE etc) in that it provides a set of runtime containers/capabilities, and a rich set of pre-built functionality in the form of class libraries and APIs
The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, and ASP.NET.

With respect to security ,which one is the better choice .Net or J2EE? Explain?
The dot net is more secure than J2EE,because .net is having multiple modules compatible with it.All modules are depends upon each other to functions.As .net is more comfortable that provides more security for users and Data with Application. 

 How many languages .NET is supporting now?
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.

How is .NET able to support multiple languages?
A language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.
 
How ASP .NET different from ASP?
Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.

What is smart navigation?
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.

What is view state?
The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control.

How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for this. We have Range Validator, Email Validator.
Can the validation be done in the server side? Or this can be done only in the Client side?
 Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.

How to manage pagination in a page?
Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.

What is ADO .NET and what is difference between ADO and ADO.NET?
ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch.

Observations between VB.NET and VC#.NET?
Choosing a programming language depends on your language experience and the scope of the application you are building. While small applications are often created using only one language, it is not uncommon to develop large applications using multiple languages.

For example, if you are extending an application with existing XML Web services, you might use a scripting language with little or no programming effort. For client-server applications, you would probably choose the single language you are most comfortable with for the entire application. For new enterprise applications, where large teams of developers create components and services for deployment across multiple remote sites, the best choice might be to use several languages depending on developer skills and long-term maintenance expectations.

The .NET Platform programming languages - including Visual Basic .NET, Visual C#, and Visual C++ with managed extensions, and many other programming languages from various vendors - use .NET Framework services and features through a common set of unified classes. The .NET unified classes provide a consistent method of accessing the platform’s functionality. If you learn to use the class library, you will find that all tasks follow the same uniform architecture. You no longer need to learn and master different API architectures to write your applications.

In most situations, you can effectively use all of the Microsoft programming languages. Nevertheless, each programming language has its relative strengths and you will want to understand the features unique to each language. The following sections will help you choose the right programming language for your application.

How u can create XML file?
To write Dataset Contents out to disk as an XML file use:

MyDataset.WriteXML(server.MapPath(”MyXMLFile.xml”))
dataSet.WriteXml(string path);

Can we run DOT.NET in unix plateform?
One of the disadvantages of using Visual Studio.NET and the .NET framework to develop applications has been the lack of cross-platform support. Since the introduction of the .NET framework and common language run time a few years ago, there have been a few projects designed to bring the .NET framework to other platforms, including Linux and Unix.The DotGNU project is touted as the “Free software alternative to .NET” and encompasses a number of projects, including DotGNU Portable .NET, which is designed to be used to compile and run C# and C applications on a multitude of platforms, including GNU/Linux, FreeBSD, Mac OS X, and Windows.One of the main features of the product is it’s compatibility with EMCA standards for C# and the Common Language Infrastructure (CLI), as well as Microsoft’s own CLI implementation in the .NET framework.The project chose to go with a “Virtual Machine” implementation, where bytecode is transformed into a simple instruction set which is then passed to a “Converted Virtual Machine”, which then are executed through an interpreter. This approach is different to other open source .NET implementations, but provides more flexibility when porting the project to other platforms.At the core of the project is the runtime engine (ilrun) and compiler (cscc) with an implementation of System.Windows.Forms that make developing for the platform easier, as it doesn’t required translation through another toolkit or toolset.

How will you make .NET programs work in Linux ?
Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Sponsored by Novell, the Mono open source project has an active and enthusiastic contributing community and is positioned to become the leading choice for development of Linux applications.

What is the difference between the C#.NET and VB.NET?
VB.NET

- It didn’t have the XML Documentation.

- It didn’t have the Operator Overloading.

- It didn’t have the Pointer Type variables.

C#.NET

- It has XML Documentation, Operator Overloading and supports Pointer Variables using unsafe keyword
c#.net is case sensitive.
vb.net is not case sensitive

Can implement same method name in both base class And derived class with different action?
Method overloading is possible.

suppose baseclass class class1 is having method called getname(string name) this method can be overloaded in derived class class2:class1

{

void getmethod(int i,string name)

{

}

}

It is possible with Method over riding not with over loading.
over loading is required with in the same class. but with in base class and child class over riding is possible.

Can I change private assembly to shared assembly?How?
Yes, You can change from Private to Shared.

- Get the SN using sn.exe

- Add the SN to the Assembly

- Put the Assembly in GAC.
Yes You can change.

In .NET Compact Framework, can I free memory explicitly without waiting for garbage collector to free the memory?
Yes, the memory can be cleared using gc.collect method but it is recommanded that u should not call this because we don’t know the exact time when the gc will be called automaticle.

What i do for load testing in . net application?
Load testing for .NET Developers and testersBy Red Gate Software.

How many types of assemblies are there , wat are they?
A private assembly is normally used by a single application, and is stored in the application’s directory. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Satellite assemblies are often used to deploy language-specific resources for an application. These language-specific assemblies work in side-by-side execution because the application has a separate product ID for each language and installs satellite assemblies in a language-specific subdirectory for each language.

How to clear a datagrid on a button click?
You need to Clear the DataSource of the dadaGrid.

So try this codes:

dataSet1.Clear();

dataGrid1.DataSource = dataSet1.TableNameHere.DefaultView;

or

C#: dataGrid1.DataSource = null;

VB: dataGrid1.DataSource = nothing
Given a server with 4 cpu’s, and no databases write a pseudocode to search for the word camera in 100,000 html documents?
Start 4 threads which do the following task:
Opens every nth file (first thread will open 0th, 4th, 8th, 12th file, second thread will open 1st, 5th, 9th and so on)
Scans the file for occurrences of word ‘camera’ and notes down line numbers (possibly in a hash table — the key would be the file name with complete path and value will be an array / arraylist containing line numbers).

What Is The Difference Between ViewState and SessionState?
ViewState persist the values of controls of particular page in the client (browser) when post back operation done. When user requests another page previous page data no longer available.

SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes.

How different are interface and abstract class in .Net?
Abstract classes can not be instantiated it can have or cannot have abstract method basically known as mustinherit as the methods are static in nature where interfaces are the declaration and r defined where they are called used for dynamic methods.
Interface needs to be implemented,abstract class has build in implementation.

What is the difference between proc. sent BY VAL and By Ref?
BY VAL: changes will not be reflected back to the variable.
By REF: changes will be reflected back to that variable.( same as & symbol in C,C++).

Which control cannot be placed in MDI?
All the controls that cannot be placed on the MDI. Only certain controls can be pleced on the MDI they are Picture Box, Tool Strip, Status Bar, Timer, Progressvie Bar.

Dotnet Page Lifecycle? 
While excuting the page, it will go under the fallowing steps(or fires the events) which collectivly known as Page Life cycle. Page_Init — Page Initialization LoadViewState — View State Loading LoadPostData — Postback data processing Page_Load — Page Loading RaisePostDataChangedEvent — PostBack Change Notification RaisePostBackEvent — PostBack Event Handling Page_PreRender — Page Pre Rendering Phase SaveViewState — View State Saving Page_Render — Page Rendering Page_UnLoad — Page Unloading.  

What is the difference between visual basic and visual basic dot net?
VB.NET is Microsoft’s Visual Basic implemented onto their .NET Framework. While Visual Basic is part of Visual Studio, VB.NET is also part of the Visual Studio.NET release.

What is the difference between SQL Server, Visual Studio, ASP.NET and Visual Basic?
SQL Server is a RDMS (Relational Database Management System). Visual Studio is the IDE (Integrated Development Environment) development studio that encompasses the Microsoft programming languages. ASP.net is scripting for IIS (Internet Information Server) using the .Net platform. Visual Basic is a Microsoft programming language, and part of Visual Studio.

Dot Net Jobs for Freshers

Friday, July 25th, 2008

Great Opportunity for DIPLOMA PASS OUTS 2008 (0 yr), 25 July 2008 
  Wipro Infotech
  Location : Mumbai, Mumbai Suburbs
  DIPLOMA PASS OUTS-2008 BATCH ONLY Interested candidates can mail their Resumes to wigroup.campus@wipro.com on or before 31 July 2008….. 

Junior Software Engineer  (0 yr), 23 July 2008 
  Ingersoll Rand International (I) Limited
  Location : Bengaluru/Bangalore
  - Expertise in C - Good communication skill is a must - An aggregate of 70% and above will only be considered…

Software Trainees: Java / J2ee, .Net and Testing  (0 yr), 22 July 2008
  Celestial Labs Limited
  Location : Hyderabad / Secunderabad
  Should have sound knowledge in JAVA / J2EE, Dot Net and Testing. We are looking for candidates with Good communication skills and good academics required…. 

Introduction to ASP.NET

Sunday, July 20th, 2008

Active Server Pages (ASP)
Microsoft Active Server Pages (ASP) is a server-side scripting technology. ASP is a technology that Microsoft created to ease the development of interactive Web applications. With ASP you can use client-side scripts as well as server-side scripts. Maybe you want to validate user input or access a database. ASP provides solutions for transaction processing and managing session state. Asp is one of the most successful language used in web development.

ASP.NET was developed in direct response to the problems that developers had with classic ASP. Since ASP is in such wide use, however, Microsoft ensured that ASP scripts execute without modification on a machine with the .NET Framework (the ASP engine, ASP.DLL, is not modified when installing the .NET Framework). Thus, IIS can house both ASP and ASP.NET scripts on the same machine.

ASP.NET is the next generation of Active Server Pages (ASP). ASP.NET is an advanced Web development technology that has the power and flexibility of the .NET Framework.

ASP.NET code is compiled, so ASP.NET Web applications perform better than those that use scripting languages. Plus, you can write ASP.NET code in any language that is supported by the Microsoft .NET Framework, including Microsoft C# and Microsoft Visual Basic .NET.

ASP.NET provides a programming model and infrastructure that makes creating scalable, secure, and stable Web applications faster and easier than with other Web programming technologies. This makes ASP.NET an ideal development platform for robust Web applications.

Advantages of ASP.NET
Separation of Code from HTML
To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently. This makes it much easier for teams of programmers and designers to collaborate efficiently.

ASP.NET pages, also called Web Forms, are powerful forms-based Web pages. When building Web Forms, you can use ASP.NET server controls instead of ActiveX controls to create common UI elements and then program them for common tasks. This capability allows you to develop pages that are independent of a specific browser. ASP.NET Server controls also allow you to rapidly build Web Forms out of reusable built-in or custom components, which helps simplify the code of a page.

ASP.NET uses a new file extension “.aspx”. This will make ASP.NET applications able to run side by side with standard ASP applications on the same server.

Problems with Traditional ASP
There are many problems with ASP if you think of needs for Today’s powerful Web applications.

Interpreted and Loosely-Typed Code
ASP scripting code is usually written in languages such as JScript or VBScript. The script-execution engine that Active Server Pages relies on interprets code line by line, every time the page is called. In addition, although variables are supported, they are all loosely typed as variants and bound to particular types only when the code is run. Both these factors impede performance, and late binding of types makes it harder to catch errors when you are writing code.

Mixes layout (HTML) and logic (scripting code)
ASP files frequently combine script code with HTML. This results in ASP scripts that are lengthy, difficult to read, and switch frequently between code and HTML. The interspersion of HTML with ASP code is particularly problematic for larger web applications, where content must be kept separate from business logic.

Limited Development and Debugging Tools
Microsoft Visual InterDev, Macromedia Visual UltraDev, and other tools have attempted to increase the productivity of ASP programmers by providing graphical development environments. However, these tools never achieved the ease of use or the level of acceptance achieved by Microsoft Windows application development tools, such as Visual Basic or Microsoft Access. ASP developers still rely heavily or exclusively on Notepad.

Debugging is an unavoidable part of any software development process, and the debugging tools for ASP have been minimal.
Most ASP programmers resort to embedding temporary Response. Write statements in their code to trace the progress of its execution.

No real state management
Session state is only maintained if the client browser supports cookies. Session state information can only be held by using the ASP Session object. And you have to implement additional code if you, for example, want to identify a user.

Update files only when server is down
If your Web application makes use of components, copying new files to your application should only be done when the Web server is stopped. Otherwise it is like pulling the rug from under your application’s feet, because the components may be in use (and locked) and must be registered.

Obscure Configuration Settings
The configuration information for an ASP web application (such as session state and server timeouts) is stored in the IIS metabase. Because the metabase is stored in a proprietary format, it can only be modified on the server machine with utilities such as the Internet Service Manager. With limited support for programmatically manipulating or extracting these settings, it is often an arduous task to port an ASP application from one server to another.

Support for compiled languages
Developer can use VB.NET and access features such as strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) compiled when first requested. Subsequent requests are directed to the fully compiled code, which is cached until the source changes.

Use services provided by the .NET Framework
The .NET Framework provides class libraries that can be used by your application. Some of the key classes help you with input/output, access to operating system services, data access, or even debugging. 

Graphical Development Environment
Visual Studio .NET provides a very rich development environment for Web
developers. You can drag and drop controls and set properties the way you do in Visual Basic 6. And you have full IntelliSense support, not only for your code, but also for HTML and XML.

State management
To refer to the problems mentioned before, ASP.NET provides solutions for session and application state management. State information can, for example, be kept in memory or stored in a database. It can be shared across Web forms, and state information can be recovered, even if the server fails or the connection breaks down.

Update files while the server is running!
Components of your application can be updated while the server is online and clients are connected. The Framework will use the new files as soon as they are copied to the application. Removed or old files that are still in use are kept in memory until the clients have finished.

XML-Based Configuration Files
Configuration settings in ASP.NET are stored in XML files that you can easily read and edit. You can also easily copy these to another server, along with the other files that comprise your application.

Overview of ASP.NET-

ASP.NET provides services to allow the creation, deployment, and execution of Web Applications and Web Services
Like ASP, ASP.NET is a server-side technology
Web Applications are built using Web Forms. ASP.NET comes with built-in Web Forms controls, which are responsible for generating the user interface. They mirror typical HTML widgets like text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.
Web Forms are designed to make building web-based applications as easy as building Visual Basic applications
ASP.NET Architecture
ASP.NET is based on the fundamental architecture of .NET Framework. Visual studio provide a uniform way to combine the various features of this Architecture.

ASP.NET  Architecture -

At the bottom of the Architecture is Common Language Runtime. NET Framework common language runtime resides on top of the operating system services. The common language runtime loads and executes code that targets the runtime. This code is therefore called managed code. The runtime gives you, for example, the ability for cross-language integration.
.NET Framework provides a rich set of class libraries. These include base classes, like networking and input/output classes, a data class library for data access, and classes for use by programming tools, such as debugging services. All of them are brought together by the Services Framework, which sits on top of the common language runtime.
ADO.NET is Microsoft’s ActiveX Data Object (ADO) model for the .NET Framework. ADO.NET is not simply the migration of the popular ADO model to the managed environment but a completely new paradigm for data access and manipulation.

ADO.NET is intended specifically for developing web applications. This is evident from its two major design principles:

Disconnected Datasets—In ADO.NET, almost all data manipulation is done outside the context of an open database connection.
Effortless Data Exchange with XML—Datasets can converse in the universal data format of the Web, namely XML.
The 4th layer of the framework consists of the Windows application model and, in parallel, the Web application model.
The Web application model-in the slide presented as ASP.NET-includes Web Forms and Web Services.
ASP.NET comes with built-in Web Forms controls, which are responsible for generating the user interface. They mirror typical HTML widgets like text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.

Web Services brings you a model to bind different applications over the Internet. This model is based on existing infrastructure and applications and is therefore standard-based, simple, and adaptable.

Web Services are software solutions delivered via Internet to any device. Today, that means Web browsers on computers, for the most part, but the device-agnostic design of .NET will eliminate this limitation.

One of the obvious themes of .NET is unification and interoperability between various programming languages. In order to achieve this; certain rules must be laid and all the languages must follow these rules. In other words we can not have languages running around creating their own extensions and their own fancy new data types. CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow.

The CLR and the .NET Frameworks in general, however, are designed in such a way that code written in one language can not only seamlessly be used by another language. Hence ASP.NET can be programmed in any of the .NET compatible language whether it is VB.NET, C#, Managed C++ or JScript.NET.
Quick Start :To ASP.NET
After this short excursion with some background information on the .NET Framework, we will now focus on ASP.NET.

File name extensions
Web applications written with ASP.NET will consist of many files with different file name extensions. The most common are listed here. Native ASP.NET files by default have the extension .aspx (which is, of course, an extension to .asp) or .ascx. Web Services normally have the extension .asmx.

Your file names containing the business logic will depend on the language you use. So, for example, a C# file would have the extension .aspx.cs. You already learned about the configuration file Web.Config.

Another one worth mentioning is the ASP.NET application file Global.asax - in the ASP world formerly known as Global.asa. But now there is also a code behind file Global.asax.vb, for example, if the file contains Visual Basic.NET code. Global.asax is an optional file that resides in the root directory of your application, and it contains global logic for your application.

The easiest way to start with ASP.NET is to take a simple ASP page and change the file name extension to .aspx

Page Syntax-

Directives
You can use directives to specify optional settings used by the page compiler when processing ASP.NET files. For each directive you can set different attributes. One example is the language directive at the beginning of a page defining the default programming language.

Code Declaration Blocks
Code declaration blocks are lines of code enclosed in <script> tags. They contain the runat=server attribute, which tells ASP.NET that these controls can be accessed on the server and on the client. Optionally you can specify the language for the block. The code block itself consists of the definition of member variables and methods.

Code Render Blocks
Render blocks contain inline code or inline expressions enclosed by the character sequences shown here. The language used inside those blocks could be specified through a directive like the one shown before.

HTML Control Syntax
You can declare several standard HTML elements as HTML server controls. Use the element as you are familiar with in HTML and add the attribute runat=server. This causes the HTML element to be treated as a server control. It is now programmatically accessible by using a unique ID. HTML server controls must reside within a <form> section that also has the attribute runat=server.

Custom Control Syntax
There are two different kinds of custom controls. On the one hand there are the controls that ship with .NET, and on the other hand you can create your own custom controls. Using custom server controls is the best way to encapsulate common programmatic functionality.

Just specify elements as you did with HTML elements, but add a tag prefix, which is an alias for the fully qualified namespace of the control. Again you must include the runat=server attribute. If you want to get programmatic access to the control, just add an Id attribute.

You can include properties for each server control to characterize its behavior. For example, you can set the maximum length of a TextBox. Those properties might have sub properties; you know this principle from HTML. Now you have the ability to specify, for example, the size and type of the font you use (font-size and font-type).

The last attribute is dedicated to event binding. This can be used to bind the control to a specific event. If you implement your own method MyClick, this method will be executed when the corresponding button is clicked if you use the server control event binding shown in the slide.

Data Binding Expression
You can create bindings between server controls and data sources. The data binding expression is enclosed by the character sequences <%# and %>. The data-binding model provided by ASP.NET is hierarchical. That means you can create bindings between server control properties and superior data sources.

Server-side Object Tags
If you need to create an instance of an object on the server, use server-side object tags. When the page is compiled, an instance of the specified object is created. To specify the object use the identifier attribute. You can declare (and instantiate) .NET objects using class as the identifier, and COM objects using either progid or classid.

Server-side Include Directives
With server-side include directives you can include raw contents of a file anywhere in your ASP.NET file. Specify the type of the path to filename with the pathtype attribute. Use either File, when specifying a relative path, or Virtual, when using a full virtual path.

Server-side Comments
To prevent server code from executing, use these character sequences to comment it out. You can comment out full blocks - not just single lines.

First ASP.NET Program-

Let’s look at both the markup and the C# portions of a simple web forms application that generates a movie line-up dynamically through software.

Markup Portion
Web form application part 1 — SimpleWebForm.aspx
<% @Page Language=”C#” Inherits=”MoviePage” Src=”SimpleWebForm.cs” %>

<html>
<body background=”Texture.bmp”>

<TITLE>Supermegacineplexadrome!</TITLE>

<H1 align=”center”>Welcome to Supermegacineplexadrome!</H1>

<P align=”left”><STRONG>

Showtimes for <%WriteDate();%>

</STRONG>

 

<%WriteMovies();%>

</body>
</html>
And this is where the C# part of a web forms application comes in.

Web form application part 2 - SimpleWebForm.cs
using System;
using System.Web.UI;
using System.Web.UI.WebControls;

public class MoviePage:Page
{
protected void WriteDate()
{
Response.Write(DateTime.Now.ToString());
}

protected void WriteMovies()
{
Response.Write(”
The Glass Ghost (R) 1:05 pm, 3:25 pm, 7:00 pm

“);
Response.Write(”
Untamed Harmony (PG-13) 12:50 pm, 3:25 pm, ” + “6:55 pm

“);
Response.Write(”
Forever Nowhere (PG) 3:30 pm, 8:35 pm

“);
Response.Write(”
Without Justice (R) 12:45 pm, 6:45 pm

“);
}
}
Execution Cycle :
Now let’s see what’s happening on the server side. You will shortly understand how server controls fit in.

A request for an .aspx file causes the ASP.NET runtime to parse the file for code that can be compiled. It then generates a page class that instantiates and populates a tree of server control instances. This page class represents the ASP.NET page.

Now an execution sequence is started in which, for example, the ASP.NET page walks its entire list of controls, asking each one to render itself.

The controls paint themselves to the page. This means they make themselves visible by generating HTML output to the browser client.

Execution Process
We need to have a look at what’s happening to your code in ASP.NET.

Compilation, when page is requested the first time
The first time a page is requested, the code is compiled. Compiling code in .NET means that a compiler in a first step emits Microsoft intermediate language (MSIL) and produces metadata—if you compile your source code to managed code. In a following step MSIL has to be converted to native code.

Microsoft intermediate language (MSIL)
Microsoft intermediate language is code in an assembly language–like style. It is CPU independent and therefore can be efficiently converted to native code.

The conversion in turn can be CPU-specific and optimized. The intermediate language provides a hardware abstraction layer.

MSIL is executed by the common language runtime.

Common language runtime
The common language runtime contains just-in-time (JIT) compilers to convert the MSIL into native code. This is done on the same computer architecture that the code should run on.

The runtime manages the code when it is compiled into MSIL—the code is therefore called managed code.

ASP.NET Applications and Configuration
Overview
Like ASP, ASP.NET encapsulates its entities within a web application. A web application is an abstract term for all the resources available within the confines of an IIS virtual directory. For example, a web application may consist of one or more ASP.NET pages, assemblies, web services configuration files, graphics, and more. In this section we explore two fundamental components of a web application, namely global application files (Global.asax) and configuration files (Web.config).

Global.asax
Global.asax is a file used to declare application-level events and objects. Global.asax is the ASP.NET extension of the ASP Global.asa file. Code to handle application events (such as the start and end of an application) reside in Global.asax. Such event code cannot reside in the ASP.NET page or web service code itself, since during the start or end of the application, its code has not yet been loaded (or unloaded). Global.asax is also used to declare data that is available across different application requests or across different browser sessions. This process is known as application and session state management.

The Global.asax file must reside in the IIS virtual root. Remember that a virtual root can be thought of as the container of a web application. Events and state specified in the global file are then applied to all resources housed within the web application. If, for example, Global.asax defines a state application variable, all .aspx files within the virtual root will be able to access the variable.

Like an ASP.NET page, the Global.asax file is compiled upon the arrival of the first request for any resource in the application. The similarity continues when changes are made to the Global.asax file; ASP.NET automatically notices the changes, recompiles the file, and directs all new requests to the newest compilation. A Global.asax file is automatically created when you create a new web application project in the VS.NET IDE.

Application Directives
Application directives are placed at the top of the Global.asax file and provide information used to compile the global file. Three application directives are defined, namely Application, Assembly, and Import. Each directive is applied with the following syntax:

   <%@ appDirective appAttribute=Value …%>
Web.config
In ASP, configuration settings for an application (such as session state) are stored in the IIS metabase. There are two major disadvantages with this scheme. First, settings are not stored in a human-readable manner but in a proprietary, binary format. Second, the settings are not easily ported from one host machine to another.(It is difficult to transfer information from an IIS’s metabase or Windows Registry to another machine, even if it has the same version of Windows.)

Web.config solves both of the aforementioned issues by storing configuration information as XML. Unlike Registry or metabase entries, XML documents are human-readable and can be modified with any text editor. Second, XML files are far more portable, involving a simple file transfer to switch machines.

Unlike Global.asax, Web.config can reside in any directory, which may or may not be a virtual root. The Web.config settings are then applied to all resources accessed within that directory, as well as its subdirectories. One consequence is that an IIS instance may have many web.config files. Attributes are applied in a hierarchical fashion. In other words, the web.config file at the lowest level directory is used.

Since Web.config is based on XML, it is extensible and flexible for a wide variety of applications. It is important, however, to note that the Web.config file is optional. A default Web.config file, used by all ASP.NET application resources, can be found on the local machine at:

\%winroot%\Microsoft.Net\Framework\version\CONFIG\machine.config
Summary
ASP.NET is an evolution of Microsoft’s Active Server Page (ASP) technology. Using ASP.NET, you can rapidly develop highly advanced web applications based on the .NET framework. Visual Studio Web Form Designer, which allows the design of web applications in an intuitive, graphical method similar to Visual Basic 6. ASP.NET ships with web controls wrapping each of the standard HTML controls, in addition to several controls specific to .NET. One such example is validation controls, which intuitively validate user input without the need for extensive client-side script.

In many respects, ASP.NET provides major improvements over ASP, and can definitely be considered a viable alternative for rapidly developing web-based applications.

Differences between ASP and ASP.NET-

ASP.NET has better language support, a large set of new controls and XML based components, and better user authentication.

ASP.NET provides increased performance by running compiled code.

ASP.NET code is not fully backward compatible with ASP.

Language Supported by ASP.NET-

ASP.NET uses the new ADO.NET.

ASP.NET supports full Visual Basic, not VBScript.

ASP.NET supports C# (C sharp) and C++.

ASP.NET supports JScript as before.

ASP.NET Components-

ASP.NET components are heavily based on XML. Like the new AD Rotator, that uses XML to store advertisement information and configuration.

ASP.NET Controls-

ASP.NET contains a large set of HTML controls. Almost all HTML elements on a page can be defined as ASP.NET control objects that can be controlled by scripts.

ASP.NET also contains a new set of object oriented input controls, like programmable list boxes and validation controls.

A new data grid control supports sorting, data paging, and everything you expect from a dataset control.

.NET Framework

Sunday, July 20th, 2008

The .NET Framework is a programming platform that is used for developing Windows and Web-based software.It has number of pre-coded solutions that manage the execution of programs written specifically for the framework.Different programming languages such as C#, VBScript, VB.NET, Managed C++ can be used for developing the applications in .NET Framework, as the .NET Framework is not dependent on one particular language or platform and can support many kinds of platforms and programming languages that are in use today. Further, you can use .NET Framework for running your applications in almost all platforms such as Linux, Macintosh and Unix without any hitches.
The presence of many off-the-shelf libraries in .NET Framework can assist you in developing your applications in a faster, cheaper and easier manner. The most recent .Net Framework version is capable of supporting over 20 different programming languages today.
The functionality of .Net Framework supporting many programming languages is due to the use of the powerful CLR, the Common Language Runtime engine. The application programming codes are first compiled by CLR into a Microsoft Intermediate Language (MSIL) code instead of native codes and the MSIL, which is nothing but an instruction set, in turn creates the native code for running the application.
The main advantage of language and platform independent feature of .NET Framework can be attributed to CLR and the same CLR also takes care of run-time services such as memory processes, security enforcement, integration of language, and thread management. Hence, you can make use of the various infrastructures that have been provided in .NET Framework for creating your web-applications.
As per the classification by the Microsoft, there are two categories of .NET Framework and they are the Common Language Runtime (CLR) and the .NET Framework class library(FCL).
Common Language Runtime: The CLR is responsible for providing a common runtime environment or services with which all .NET applications can run. Further, the various capabilities of CLR can enable any developer to write even big applications with ease using the features such as strong type naming, life-cycle management, dynamic binding that is capable of making any business logic into re-usable component and finally the cross-language exception handling.
.Net Framework class library: This class library constitutes various predefined functional sets that are very useful while developing the applications by developers. There are three main components in this class library and they are:
ASP.NET.
Windows Forms.
ADO.NET.
With the .Net Framework you can make your codes written in fewer lines and other favourable features such as easy web settings, easy deployment of applications, easy compilation procedures, easy Web configuration makes the .NET Framework a great platform to work with. In an overall scenario, the developers will be able to concentrate more on Web controls and spend an efficient time in application design and implementation and to have an effective control over the flow of the application sequence.
Another great feature that any developer can take note of is the feature of .NET Framework taking into cognisance all the Web controls, server-side blocks of codes and Web forms and getting them compiled whenever a call for the page compilation is completed.
Once the components of .NET framework are compiled in your machine, the compiled version can easily be uploaded with all the relevant pages in the /bin directory of the system. The process of uploading is very easy when compared to the complicated process of web-application in ASP, where in you have to first upload the application pages with the relevant components and you also need to register them with the operating system.
In .NET Framework the simple uploading in /bin directory of the operating system is enough and you need not carry out the complicated process of registering the components of web-application with the operating system.
With the help of an XML based web.config file you can carry out the web settings which is nothing but configuring the .NET applications for successful running. The XML based web.config file can be modified through a program and when any such modification is done, the system recognises the change and registers it immediately that makes configuration of .NET applications easy and quick.