Você está na página 1de 25

Overview of different types of languages and computer basics before starting programming languages, Computer field is basically categorized

into two categories, they are software and hardware. Software is a collection of related programs which gives you formatted output. Hardware is a collection of physical components. Software can be classified into two things, they are package and language. Package is software towards predefined task, eg: ms office, tally etc.., language is software towards generalized task eg: C, C++ etc.., Languages are classified into three types Machine Level Language: the instructions directed towards processor in terms of 0s and 1s. Assembly language: the instructions provided to assembler using certain English words also called as nuemonic codes eg: ADD, SUB, MULT, DIV, REM. High level language: the set of instructions towards interpreter or compiler. Compiler will produce error free code while interpreter cannot, syntax checking will be performed with each execution and performance will not be better for interpreter not incase of compiler. Problems Before NET: Platform dependancy Error handling Language interoperability Distributed technology Web based application Mobile application Platform dependancy: The application targets to particular O/S thats Platform dependant application. Vb 6.0 application depends on windows O/S. Solution: - .NET language compiler will produce MSIL (Microsoft Intermediate Language code) code which is platform independent code. Error Handling: C language defining constants for error handling Vb an error goto label VC++ it has its own format to handle errors. Different languages have got different approach for error handling, this is called unstructured error handling, it doesnt support cross error handling Solution: .NET support structured error handling called exception handling, it supports cross language error handling. Language interoperability: VC++ (DLL) VB (EXE) Here we can use VC++ (DLL) in VB.

One language produced code used by another language application is called language interoperability. This has been achieved before .NET by using COM. COM having a set of drawbacks, its specific to windows O/S. COM is Object based language. These languages dont support inheritance & polymorphism. Solution: .NET is providing assemblies concept to overcome COM drawbacks towards language interoperability. Distributed Technology: Distributed Technology is the concept of maintaining application logic separated on different systems. Before .NET distributed technology can be implemented using DCOM (Distributed COM). DCOM comes with set of drawbacks It supports Microsoft Applications only; it does not support internet base approach. Solution: .NET is providing remoting, web services & WCF towards distributed technology. .NET Appn (Windows) Remoting .NET Appn (Linux) J2EE Appn or Oracle App Web Services .NET Appn Web Based Application: Before .Net, ASP 3.0 can be used to develop dynamic web pages with server side coding. ASP 3.0 supports scripting languages (JavaScript, VbScript) towards server side coding. These are interpreter based. This makes slow execution; this will affect web server performance. Solution: .Net is providing ASP.NET to overcome drawbacks of ASP 3.0. Mobile Application: Mobile application development can be classified into 2 steps. Mobile normal applications like developing games, editors towards mobile devices, Mobile web applications like developing web page towards mobile device Normal mobile applications developed using VC++ programming; it is very complex & time consuming. Before .NET mobile web application development is not possible. Solution: .NET supports mobile normal applications with easier approach by providing smart device project. .NET supports mobile web applications development with MMIT (Microsoft Mobile Internet Toolkit). What is .NET? .NET is a Framework.

A framework is a predefined environment, which is a collection of tools, utilities and services etc.., Framework is further divided into FCL and CLR. FCL means Framework Class Library (Base Class Library) FCL is a collection of classes, collection of classes is called Namespace, and collection of namespaces is called Assembly. We are having predefined namespaces like System.data; system.web; system.windows.forms; System is root namespace. CLR means Common Language Runtime, which uses to compile and execute any .NET application. The code executed with the interaction of CLR then the code is called Managed Code. The code or program executed without the interaction of CLR means with the help of OS, and then the code is called unmanaged code. When .NET framework changes CLR changes, for .NET 3.5 CLR version 2.0.50727 1433 CLR stores under C:\windows\system32 by a filename MSCOREE.DLL CLR can understand only one language i.e, IL (Intermediate Language) Types supported by IL (CLR) are called CTS (Common Types System). Basic types supported by IL Byte, int16, int32, Uint16, Uint32, User defined types like Structures, Class, interfaces etc, Pointer types. Common Language Specification (CLS): The set of types to be supported by .NET high level languages [VB.NET, C#.NET] is called CLS, which is a subset of CTS. History of .NET: .NET released in the year 2000 which is BETA version for companies, developers, and to many to test the software whether it is fulfilling all the set of rules. The actual version of .NET i.e.., RTM (Release to Manufacture) in the year 2002. VS2001 .NET 1.0 VS2003.NET 1.1Ado.NET, a lot more enhancements to connect with .NET application with different databases using various providers or drivers. VS2005.NET 2.0ASP.NET a lot more enhancements with nearly fifty new controls are introduced, comparative .NET 1.1 70% of coding decreases .NET 2.0. 2006 winfx WPF, WWF, WCF, WCS, all these are different technologies released by Microsoft. WPFWindows Presentation Foundation WWFWindows Workflow Foundation WCFWindows Communication Foundation WCSWindows Card space

VS2007.NET 3.0.NET2.0+winfx VS2008.NET 3.5.NET 2.0+.NET 3.0+.NET 3.5+Ajax+LINQ etc.., VS2010.NET 4.0, its highly rich user interfaces. C#.NET C#.NET is a High Level Language. It belongs to C family languages, i.e.., C, C++, VC++, Java, C#.NET. All these are highly case sensitive C#.NET is purely Object Oriented Programming Language Platform Independent Language Independent Language Interoperability Secured Programming Language Distributed Programming Networking Programming Multi Threading Programming Currently .NET version 3.5 C#.NET version is 3.0 Student sno, sname, marks (variables in C, Data members in .NET) Accept(), display() user defined functions in C, Member functions or methods in .NET. Int a; student s; student is class name, s is called class variable nothing but object. OOPS concepts:- Object Oriented Programming Concepts(OOPs) Class: Class is logical representation of data. Eg: Fruit Class is a collection of data members and member functions or methods. Class is a collection of fields, properties, methods, events. Fields: private data of a class Properties: defines look and feel of an object Methods: what an object can do Events: what user can do with an object? Object: physical representation of data is called Object. Eg: Apple, Mango etc, Object is instance of a class. Data Encapsulation: collection of data members and member functions combined together into a single unit. Abstraction: this concept hides the information about an entity (student). Polymorphism: Poly means many, morphism means forms; polymorphism means one thing can be behaved in different forms. Eg: + operator uses for adding two integers, two float values, two characters, two strings etc,

Inheritance: inheritance is the concept of inheriting the data members and member functions of one class to another class. Eg: children inherit mannerisms, hobbies, knowledge, intelligence and many more from their parents. Platform independency: C program (dos) after execution EXE copy exe file to LINUX Dos based exe file purely depends on DOS Java program JVM (varies for Every O/S) output code is BYTE code which is independent of O/S. JVM means Java Virtual Machine, Java is purely platform independent. .NET program CLR (Common Language Runtime varies for ever O/S) output code is MSIL code i.e., Microsoft Intermediate Language Code, CLR for windows Xp, mono CLR for Linux, compact CLR for smart device applications, .NET supports platform independency concept, but its not purely platform independent. .NET does not support dos, Windows 95, 98, UNIX, Macintosh etc, Language Interoperability:Program written in one language can be written and executed successfully in any other language successfully. Language Independent: For example a company requires developing a project in J#.NET, company having four employees 2 of them knows C++ and 2 knows VB 6.0 respectively. None of them having idea on .NET, company trained 2 persons C#.NET who knows C++, VB.NET who knows VB 6.0, the project is divided into two modules and handled the project to two teams and the two teams completed their modules within in their span of time. After compiling code in C#.NET and VB.NET the code generated is in the format of MSIL code, we can use this MSIL code in J#.NET and execute the application successfully. Its independent for us in which language we developed coding. Thats how .NET supports language independency. EXE and DLL files: Exe is self executable file, where DLL is not self executable; it is called as library file. [DLLDynamic Link Library] Advantages of DLL: Reusability Better Maintenance Language Interoperability achieved using DLL concept. DLL having one disadvantage i.e., Proper Memory Management, it has been resolved using COM

technology, using addref () and release () methods are used to solve drawback of DLL. Language Interoperability achieved using DLL concept, before .NET language interoperability can be achieved using COM (component object Model), Com comes with set of draw backs, its purely window based, it needs windows registry, versioning problem etc.., by using Assembly COM technology drawbacks resolved. Data Types Data type to specify size of data, type of the data and Range of data that can be stored. Eg: short type of data 4 bytes size of data in memory it occupies -32768 to +32767 Ranges of data C#.NET divides data types into two types, they are Value Types: int, float, char, structures etc, Reference Types: class, objects, interfaces, delegates, pointers etc, Value types holds data directly Reference types hold the address but not the data Value types does not contain default values Reference holds default values Value types will be stored in stack memory at compile time Reference types will be stored in heap memory at run time Garbage Collector cant access stack memory Garbage Collector can access Heap memory Data types categorized into predefined data types and user defined data types. Predefined Data types are divided into four groups. They are Integral Data types: byte, short, int, long etc., Float Data types: float, double, decimal Character Data types: char, string Other data types: Boolean, date time Variable Declaration: <data type> variable name; eg: int a; eg: int a = 5;

Initialization of a variable: <data type> variable name = value; Float x=45.54f; Double y=4.5;

Decimal z=12.23m;

Type Casting: Type casting is a concept of converting from one data type to another data type. C#.NET support 2 types of type casting, they are Implicit Type Casting: converting lower data type to higher data type, implicit conversion will be taken care by CLR. E.g.: int (4 bytes) long (8 bytes) Int (4 bytes) float (4 bytes) Byte (1 byte) int (4 bytes) Explicit Type Casting: conversion of higher data type to lower data type, explicit conversion is under the control of programmer. E.g.: decimal (16 bytes) float (4 bytes) Float (4 bytes) int (4 bytes) C#.NET supports 4 types of explicit conversions, they are as follows 1) CPP conversion 2) converting 3) parsing 4) Boxing & unboxing Cpp Conversion: Data type1 <variable name1> = value; Data type2 <variable name2> = (data type) value; Eg: int a=150; Byte sal; Sal= (byte) a; If byte value is 256 then output will be ZERO. i.e., in C++ style of type casting there is a possibility for losing the data. Converting: Convert is a predefine class, which is the part of FCL, working with convert class is called as converting. Convert class contains a set of methods. Methods of convert class Convert.tochar(variable); convert.tostring(variable); Convert.tofloat(variable); convert.todouble(variable); Convert class can be used to convert any data type to any other data type. Parsing: Working with parse method is called parsing. Parsing is used to convert from string into any other data type. Generally any data type contain four methods, they are parse (), Tostring (), MaxValue (), MinValue (). Boxing & UnBoxing: Boxing is a concept of converting value type into reference type. UnBoxing is a concept of converting reference type into value type.

Conditional statements: If(condition) { Statements; }

if(condition) { statements; } Else { Statements; } switch(condition) { case val1: statements; break; case val2: statements; break; . case valn: statements; break; default: Statements; Break; }

If(condition) { Statements; } Else if(condition) { Statements; } Else { Statements; }

Loops: Loops are used to execute a set of statements repeatedly. We are having following loops, they are FOR Loop, WHILE Loop and DOWHILE Loop. For Loop will be used when we know the condition exactly how many times we want to repeat a loop. Syntax: for (initialization; condition; increment/decrement) { Statements; } Eg: for( i=1; i<=10;i++) { Console.WriteLine(I value = +i); } While Loop and Do..While loops are used when we dont exactly how many times I want to repeat a loop. WHILE Loop: Initialization; While(condition)

{ Statements; } DOWhile Loop: Initialization; do { Statements; }while(condition);

Arrays: A collection of similar data types stored in continuous memory locations, Arrays are of type reference, hence these will be stored in heap memory. Arrays holds same name with different index numbers, Index numbers starts from zero. Arrays store some default value. Arrays are instances of predefined class called as System.Array. C#.NET supports 3 types of arrays. One Dimensional Array Multi Dimensional Arrays Jagged Arrays. Single Dimensional Arrays: Data type [] variable name = new data type [size]; Eg: int [] x= new int [7]; Array initialization: Int [] a = new int []{12,23,34,45,56}; as number of elements in array are five then array size is 5. Multi Dimensional Arrays: An array is a set of elements in rows and columns, Multi Dimensional arrays identified with number of rows by number of columns. Every row contains same number of elements. Int[ , ] a = new int[4,3]; If array name is X then X.Length returns total number of elements. X.Getlength(0) returns number of rows X.Getlength(1) returns number of Columns Jagged Arrays: Its a collection of rows where every row may contain discrete number of elements. Jagged Array saves memory. These are faster in execution. These are also called as Dynamic arrays or Array of Arrays. Enumerations: Enum is a keyword; enum is a collection of integral constants which will identify with string constants. If numbers of constants are more, then enum helps to

maintain those constants easily. Enum must be declared in generate description area only. There is no global variable concept in Java and .NET. Syntax to write Enum: Enum enum_name { String value1 = integer value1, String value2 = integer value2, String value3 = integer value3, .. } Eg: enum GTB { da=12, ba=45, za=64}; If enum member is not initialized then it will be initialized automatically with incremented value of previous member. If previous member is not initialized starts from zero onwards. Class: Class is a collection of data members and member functions. These data members cannot be accessed outside of a class. We are having private, public and protected access specifies or modifiers. By using Private we cannot access data members outside of a class By using public we can access data members through entire program By using protected access specifier we can access data members or member functions from one class (parent) to another class (derived). This Keyword: The variables or data members inside in a class are also called as Instance variables. The variables which we are passing through methods are called local variables. Working with instance variable and local variable along with this keyword. When instance variable names and local variable names are same then by default priority will be given to local variables within a method. In order to access instance variable, this keyword is required. This is a keyword, which works like an object of current class.

C#.NET allows passing the arguments into functions in 3 ways, they are as follows. 1) Call By value: when formal arguments are modified then modified values wont reflect on actual arguments.

2) Call by Reference: when formal arguments are modified then modified

values are reflected on actual arguments. 3) By default all the variables will be passed by call by value only. 4) Ref is a keyword which is required to pass a variable by Reference. 5) Ref keyword must be used along with formal argument too. 6) Ref variable must be initialized before passing to a function. 7) Call by OUT: OUT is a keyword. 8) OUT is 99% same as Ref 9) Out variable can be passed without initial value also 10)Even if Out variable is initialized then value will not be considered Function Overloading is functions having same name of different signature. C#.NET supports function overloading and Operator overloading. These concepts supports one type of Polymorphism called as compile time polymorphism. Constructor: Constructor is a special type of reference which can be executed automatically while creating an object. Constructors name must be same name as class name without any return type. Public classname() { Statements; }; Constructors are overloadable; we can have any number of constructors for a class. Constructors will be used to initialize instance variables, open files, open database connections. Constructors are used to allocate memory when an object is created. Destructors: Destructor is special type of reference which can be executed automatically while debugging an object. Its preceded with special character called (~) tilde character. Destructors name must be same name as class name without any return type and any access specifier. ~classname() { Statements; } Destructors are not overloadable. Destructors are used to deallocate the memory or to close the connection or to close a file.

Static: Static is a keyword, it can be used with data members, methods, constructors and classes. Static variable creates common memory for all the objects Static variable will be created only once, while class is loading into the memory, hence static variables are also called as class variables. Static class cannot instantiate an object. Static methods can be accessed directly with class name Static constructors can access only static variables. Static methods can access only static data, static methods need to called with the help of Class name.static methods(); If a class contains all static methods, then recommended to declare that class as static. Operator Overloading: Operator Overloading (OOL) is a concept of providing extra functionality for an existing operator. + Operator is designed to add with numbers and strings only, in case if + is required to use with objects then + need to be overloaded.. all the operators are overloadable except those contains a (dot) operator i.e., ., :,;,::,?: Overloaded operator must be declared as static, operator is a keyword. Syntax to overload an operator Public static return type operator + (arguments) { Statements; } Inheritance:Inheriting the data members and member functions of one class (base/parent) class to another class (child/derived) class. Different types of inheritance are there, they are as follows, Single inheritance: AB A is Base/Parent class, B is derived/Child class Multilevel Inheritances: ABC A is Base/Parent class, B is derived/Child class of A, B is base class of C, and C is derived class of B. Multiple Inheritances: AC, BC A and B are base classes of C, c is derived class of A and B. .NET does not support multiple inheritances; it is indirectly supported using interfaces. Hierarchical Inheritance: AB, C; BD, E; CF, G; A is only Base Class, B, C are intermediate classes (base class and derived class),

D, E, F, G are derived classes. Hybrid inheritance: its a combination of Multilevel and Multiple inheritances. .NET does not support hybrid inheritance bcoz of multiple inheritances is not supported. Overriding: 1. Overriding is also called as runtime polymorphism. 2. Overriding is a concept of having two methods with same name and same arguments in base and derived class. 3. In overriding by default importance is given to local class methods. In the above case in order to call base class methods base keyword is required. 4. Base keyword can be used with methods and fields also. Sealed Classes: Sealed is a keyword, sealed classes are not inheritable, whenever a class is providing full functionality then recommended to declare that class as sealed. Abstract Classes: 1. Abstract is a keyword which can be used with methods and classes. 2. Whenever a class is not providing full functionality then recommended declaring that class as abstract classes. 3. A method without body is called as abstract method. Syntax: Public abstract void function name (); 4. Abstract methods are also called as rule. 5. When a class contains atleast one abstract method then that class must be declared as abstract class. 6. All the abstract method must be override in derived classes. 7. abstract class provides a set of rules (abstract method), which must be followed (override) in derived classes 8. abstract classes are not instantiable, but a reference can be created 9. reference works with child class memory Interfaces: Interfaces contains only abstract methods, hence it is called as fully abstract. Differences between Abstract classes and Interfaces are as follows: An interface are fully abstract, means it contains only abstract methods, Abstract classes are partially abstract, means it contains abstract methods and non abstract methods. Interface supports a structure like multiple inheritance Interfaces are not instantiable, but a reference can be created. Syntax:

Interface <interface name> { Return type Method Name; Return type Method Name; } I1C1 I1 is interface which is a base; C1 is a derived class deriving from interface. I1I3, I2I3, here I1, I2 are base interfaces and derives I3 interface which solves multiple inheritance concept using interfaces. C1I1, C1 is base class; I1 is derived from C1 base class, which is not possible. GUI (Graphical User Interface): (Windows Applications) Working with forms and controls is called as GUI programming. Forms like a container; where any number of controls can be placed; Form is a class which must be inherited from a predefined class FORM. All the predefine controls are predefine classes, when a control is placed in the form an object is created for that controls class. Fom1.cs contains the application logic and design Form1.design.cs contains the controls declarations which are placed on the form. Form1.resx (resource) is required while developing globalization of projects. F4 Displays properties window of selected object F7 switches between coding and designing view. Properties of Form by pressing F4 are as follows: Name, Text, Back color, Font, Fore Color, Form Border style etc.., Working combo Box & List Box controls: ComboBox and listbox holds collection of items, every item will be identified with an index number, which always starts from Zero. ComboBox allows selecting only one item, Listbox allows selecting multiple items. Properties for comboBox and listbox are same. Items: allows adding items at design time Selected Item, Selected Index, Etc.., Exception Handling: Compile time problems are called as errors, runtime problems are called as exceptions. Definition Exception is a runtime exception condition, which stops normal execution of a program abnormally. When exception is raise execution will stopped. Generally exceptions will be raised when Working with type casting While working with I/O concepts While working with database programming

To work with exceptions .NET introduce 4 keywords TRY, CATCH, FINALLY & THROW blocks. When an exception is expected from a block of code write that code in TRY block. TRY block must be followed either with multiple catch blocks, finally. Whenever an exception is raised catch will be executed but finally will be always executed irrespective of any exception. All exceptions are predefined classes which must be inherited from EXCEPTION class. FILE HANDLING: Working with sytem.io namespace is called as file handling. File Handling is required to read or write the data into the file, to find the drive information, to find directory and file information. Stream Reader: Stream Reader is a class, which is used to read information from a file. Methods of stream reader are Read (), ReadLine (), ReadToEnd (); Stream Writer: Stream Writer is also a class, which is used to write the data into a file. ADO.NET:(Active x Data Object.NET) Ado.Net is an object class library, which is a collection of classes; this is used to communicate .NET application with databases. Ado.NET helps to develop client server Architecture, Front End is Client, and Back end is Server. Ado.NET supports two types of connections; they are managed connections and unmanaged connections. Unmanaged connections works with OLEDB providers. Object Linking and embedding databases, as com is platform dependent, hence connections over OLEDB are called as unmanaged connections. Managed connections works with the help of TDS (Tabular Data Stream) protocol Managed connections are faster. Namespaces for ADO.NET programming, these are divided into 5 groups 1) Common name spaces System.data System.data.common System.data.sqltypes 2)Unmanaged namespaces System.data.Oledb 3)Managed namespaces System.data.Sqlclient

System.data.Oracleclient 4) Odbc namespaces System.data.odbc 5)LINQ related System.data.LINQ Connected architecture: Where database connected with .net application, whenever retrieving data from a database or perform manipulations in database from front end. Data Readers connection oriented, if connection is opened, then only data reader works. If connection is closed then all associated data readers are closed automatically. While using data readers if numbers of clients are more in the network then the project efficiency decreases. DataSet: Dataset is a class, which is a part of System.Data namespace Dataset supports connection less architecture i.e., Active connection is not required will working with dataset. Dataset works with XML technology, it cant communicate directly with database. Hence the data adapter is required to carry data in between dataset and database. Data adapter should carry the data but not hold the data. Dataset holds collections of tables, where CLR gives an index number for every table optionally table alias names are also allowed. Dataset supports xml technology. When dataset is modified, then modifications will be stored in XML file, but not in database. To effect dataset modifications on database then we use command builder. Dataset modifications need to be stored in database with the help of data adapter. Command builder is a predefined class which is used to create DML syntax automatically. Command builder works with the help of data adapter, command builder purpose is to create the syntax only, but not to execute. Dataset class hierarchy: The collection of interrelated classes with dataset is called as dataset class hierarchy. Tablesdata tablerows data rowcolumnsdata column Working with ODBC connections: ODBC means Open Database Connectivity. ODBC connection is unmanaged connection

ODBC supports to create a connection with any type of database including sql server and oracle also. ODBC drivers are implemented as DLL files, which are COM components ODBC drivers are located at Start settings control panel Administrative tools Data Sources (ODBC) In order to use ODBC driver a reference is need to be created for the specific DLL file, which is called as DSN (Data Source Name) In excel, every sheet works like a table

Multi Threading: Multi means many Thread means process Executing more than one process simultaneously is called multi threading. Process indicates either part of program or a complete program also. Eg: ATM server, IIS Server, any Server, Games etc.., For every process CPU allocates a set of cycles based on the priority Based on above statement OS are divided into 2 types Single threaded OS like DOS, UNIX Multi Threaded OS like Windows, Linux The following are steps for Multi threading in .NET Use namespace System.Threading contains three classes 1) Thread:- which is use to maintain the lifecycle of thread 2) ThreadStart:- which is used to create threads 3) Mutex:- which is used for thread synchronization 4) Start the method Thread Synchronization: 1) When more than one thread is accessing same resource, then there is possibility for unexpected results. 2) To overcome the above problem, Thread Synchronization is required 3) Thread synchronization is a concept of allowing only one thread into one process at a time. 4) If process is busy then threads need to wait in to queue.

5) Waiting threads will be executed based on the priority. 6) To work with synchronization Mutex class is required. 7) Mutex class contains two methods waitone() and releaseMutex() 8) The code written between these two methods are synchronized. Distributed Programming: 1) Distributed programming (DP) is a concept of sharing the logic over the network. 2) DP is used to develop Reusable objects over the network 3) Network is a collection of computers, which are connected together with the help of a protocol 4) Generally network can be establish TCP or HTTP protocols 5) Example for distributed programming techniques are as follows 1970 1992 1995 1997 2000 RPC (Remote Procedure Call) RMI DCOM CORBA Remoting Unix & C JAVA visual Studio 6.0 OMG .NET

Working with .NET Remoting:1) .NET remoting is a distributed program technique 2) .NET allows to share the logic over the network 3) Connection in between two computers is called CHANNEL 4) In the network every computer will be identified with a unique IP- address 5) Remoting supports 2 types of connections TCP and HTTP channels 6) In order to share logic, every computer must have CLR software. 7) To start the communication a port need to be exist 8) Windows OS supports 0 65535 ports Some predefined ports are as follows: HTTP : 80 SMTP : 25 FTP : 31 Web Logic Server: 7070, 8080, 9090 .NET Remoting Architecture: Marshalling: converting object stream into byte stream Demarshalling: converting byte stream into object stream Marshalling will be done with the help of proxy server called as STUB and Demarshalling by Skeleton. To work with Remoting .NET introduce namespace System. Runtime .Remoting assembly

MarshallByRef object is predefined class, which create stubs and skeletons Remoting is used to develop 3 tier and N tier architectures 4 steps for Remoting Application Development: 1) Write an interface with abstract methods and compile it to get a DLL file 2) Write the server program by overriding interface methods, and then register a port over a channel 3) Write a client program and open the communication with the server 4) Start the server then execute the Client Working with security concepts: Security is the concept of restricting anonymous accessibility. C#.NET supports Cryptography and Role Based Security concepts. Cryptography is the concept of data encryption and data decryption Encryption is the concept of converting original values into some other format and vice versa is Decryption. To encrypt or to decrypt some logic is required, which is called as an algorithm. Every algorithm is identified with a unique id. This unique id needs to be represented with a 16 byte array value. Syntax to declare algorithm for unique ID Byte [] x = new byte [] {0x56, 0x98, 0x45, 0x46.16} //type 16 values Note: These values must be between 0x0 to 0x99 Always cryptography must be in 2 levels To work with cryptography .net introduce System .Security .Cryptography namespace TripleDesCrypto Service provider is a predefined class, which is required in cryptography programming.

Delegates: It will hold the address of one function or many functions its just like c++ function pointers. It encapsulates some information like class names and namespaces etc, These are divided into Single Caste and Multi caste Delegates. Steps to Create delegates: Step 1: write a class with methods Step 2: create a delegate Step 3: create an object to the delegate with the address of a function

Step 4: call/raise the delegates object Single caste delegate holds the address of one function. Multi caste delegates holds the address of Many functions, Multi caste delegates holds a sequence of methods, it supports arithmetic operations, + operator adds a function into the sequence, - operator removes a function from the sequence. Windows Services (WS): WS are use to develop automated background processes. WS contains only application logic but not GUI. The controls which are not visible at runtime are used in WS project eg: Timer, Event Log, File mono System Watcher, etc.., To develop windows services .NET introduce File NEW Project Visual C# Windows Windows Service template WS template is available only in 2008 professional Edition only. WS will be deployed as EXE files WS are not executable directly Windows service with File System watcher and ADO.NET:File system watcher control is used to keep a track on particular folder for IO changes. When an IO operation is occurred then file system watcher control executes a specific event automatically Property of File System Watcher: path: Folder Name Include sub directories: false/true Events: Created, Deleted, Rename, Changed

ASP.NET: Page Life Cycle Events: Set of programs executed towards each time of webpage processing are called page life cycle events.

Page PreInit: this will be executed before memory initialization for webpage (before constructing webpage). Attaching theme, master page dynamically to webpage is possible using PreInit event procedure. Page Init: this will be executed when memory is initialized for webpage Page Load: this will be executed when submitted data & controls are loaded, Database connectivity, reading submitted data can be placed within page load. Page Prerender: this will be executed before rendering HTML content for server side control, Control behavior can be changed before producing client side control. Page Unload: this will be executed once memory is released for webpage. Closing database connection etc., the response cannot be given to client. State Management:An HTTP behavior is go, get & forgets Go sending request (connection will be established) Get getting response Forget closing connection This stateless implementation is considered as an advantage, where burden will be reduced on server, it will improve performance of webserver. The requirement is webserver should remember clients information, Hence the solution is State management techniques. Webserver remembering information of client is called state management. The following techniques are used to implement state management 1) context 2) query string 3) cookies 4) sessions 5) application 6) cache 7) view state Context: The user information can be maintained from one webpage to another webpage using context when redirection is using Server. Transfer. Asp.Net 2.0 is providing PostBackUrl property with button to perform cross page submission. Query String:

The client info can be maintained from one webpage to another webpage when redirection is using Response.Redirect. Response.Redirect will instruct browser to call particular webpage. The called webpage (welcome.aspx) cannot access controls data & variables of calling webpage (default.aspx) This requires querystring implementation to maintain (transfer) info from calling page to called page If the redirection is to different website, complete URL of the webpage is required. Response.Redirect(Http://syst/aspnet/welcome..aspx?uname=t1.text); Server.transfer does nt accept URL, this makes redirection only within website. More than one variable can be appended to URL using & Response.Redirect(Welcome.aspx?uname=aaa&pwd=bbb);

Cookies: Cookie is a small amount of memory used by webserver within client system. The purpose is maintaining personal info of client within client system to reduce burden on server, (personal info can be loginids, session ids, security tokens, question & answers by user etc..,) Cookies can be classified into 2 types 1) Inmemory cookie 2) Persistent cookie In Memory Cookie:The cookie placed within browser process memory is called inmemory cookie. It is temporary cookie specific to browser instance, once browser is closed cookie will be erased. Cookie data will be accessible to all the webpages with client request. .NET is providing httpCookie class for sending cookie (or) reading cookie. Cookie can be read based on name or index, if it is more number of cookies, index based approach is recommended for better programming. Persistent Cookie:Cookie placed within hard disk memory of client system is called persistent cookie. This will be maintained by client system with particular life time (life time can be 1 min, 1 hr,) Once life time is finished cookie will be erased by client system O/S. httpCookie obj = new httpCookie(n); obj.value=100; obj.expires=DateTime.Now.AddDays(2); life time is 2 days

response.appendCookie(obj); persistent cookie=inmemory cookie+life time. Location of cookies in client system:C:\Doucments & Settings\Administrator\(login Folder Name)\Cookies Administrator@syst.txt (server name) Uname#Blossom#pwd#Computerpersistent cookie Cookies dont provide security, where client can modify or delete cookies. Browser will maintain cookies uniquely to website. Cookies will be maintained uniquely w.r.t browser (each browser (IE, FireFox etc) will maintain cookies separately) Browser supports maximum of 20 cookies towards a website Browser supports maximum of 300 cookies towards all different websites. Cookies supports maximum of 4kb data. Session Memory: When client makes a first request, webserver will allocate block of memory unique to client on server system, this is called Session Memory. The session memory will be maintained by webserver with the timeout of 20 minutes by default (from last request within 20 minutes no communication made from client, the session will be erased). Example: Online shopping to maintain products (shopping cart) Maintaining them selected by user. Session object is provided to access session memory from Asp.Net page This provides following methods 1) add(key, value); session.add(n,100); or session[n]=100 it will place variable into session memory. 2) remove(key): it will remove variable from session memory 3) abandon():- it will close session

Distributed Technology: This is the concept of maintaining application logic scattered on different systems, this logic will be reusable to different applications. Advantages: Reusability Better Maintenance Securing resources like database Reducing financial investment Load balancing to reduce burden on web server Asp (asp 3.0) does not support distributed technology implementation Asp cannot maintain business logic[class] to service to other applications The distributed technology can be implemented using MTS (Microsoft Transaction server), MTS acts like a container for com components (classes). Advantages: It supports DCOM, MTS can distribute class methods to different applications on the network using DCOM services. It supports Connection pooling, connection pooling is the concept of maintaining set of active connections within a memory called pool memory, the client request will be attached with connection from pool memory after the processing is finished the connection will be placed back into pool memory. This makes database connectivity faster. It supports transaction handling, MTS supports cross database transaction Disadvantage: It provides services only for Microsoft applications under windows O/S. Solution is Web services which support to work in heterogeneous applications under heterogeneous platforms. Web Services: Web services are provided by W3C, the standards provided by particular company to their environment are called proprietary standards, W3C provides open industry standards, thus will be accepted by different companies. Standards are set of rules for arranging description of methods, arranging request/response. Web service is a method hosted by web server. Web service is an application logic managed by web server accessible to different applications based on open industry standards in platform independent way.

Web service main target is integrating different vendor softwares; this provides heterogeneous application communication under heterogeneous platforms. Web server acts like application server Web service provides following standards: WSDL (web Services Description Language) SOAP (Simple Object Access Protocol) HTTP (Hyper Text Transfer Protocol) UDDI (Universal Description Discovery Integration). Microsoft is implementing with .NET, it is called XML Web Services. Sun Micro is implementing J2EE, it is called Java Web Services. Oracle is implementing oracle 9i, it is called PL/SQL Web Services.

Você também pode gostar