Specializations

Monday, November 19, 2012

OOPS

OOPS:


Abstract class:

    A class that serves only as a base class from which classes are derived. No objects of an abstract base class are created.
Ex:vb.net
Public mustinherit class person
{
//implementation
}
C#.net
Abstract class person
{
//implementation
}

For these classes we can’t create an object directly. We are declare one derived class and to inherit the base class. Then only we create an object to derived class.

Inheritance:

A relationship between classes such that some of the members declared in one class (base class) are also representing in the second class (derived class). The derived class inherits the members from the base class.

Multiple inheritance:

Multiple inheritance is a derived class declared to inherit properties of two or more parent classes.

Ex: vb.net:

Public class c1
 Public function hai() as string
    Msgbox(hi)
End class
Public class C2 inherits C1
    Msgbox(bye)
End class
Main()
Dim obj as new C2
C2.hai()
o/p: hi

C#.net:

Class C1
{
    Public string hai();
    MessageBox show(“hi”);
}
Class C2:C1
{
    Void Bye()
{
        MessageBox.show(“bye”);
}
}
Main()
{
    C2 obj=new C2;
    Obj.hai();
    Obj.Bye();
}

o/p: hi, Bye

Interface:

An interface can be defined as selection of subprogram without functionality.

Syntax: by default it is public
Vb.net:

Public interface <name>
    Sub setname(ename as string)
    Function Getname() as string
End interface
Public class emp implements person
    Dim name as string
Sub Setname(ename as string) implements person.setname
    Name=personname
End sub
Function getname() as string
End function return getname

C#.net:

Public interface <name>
{
    Void hello()
}
Class emp:person
{
    Void hello()
    {
        Messagebox.show(“hello”);
    }
}
End class

Note: you can’t create an instance of interface

Overridable:

    To indicate that a method may be overridden.





Ex: vb.net

Class C1
Public overridable subXX(0
Msgbox(“welcome”)
End class

Class C2
Public overrides subXX()
    Msgbox(“Bye”)
End class

Obj.XX()-> Bye->o/p

C#.net

Class C1{
    Public virtual string XX()
    {
        Msgbox.show(“welcome”);
    }
}
Class C2:C1
{
    Public override string XX()
    {
        Msgbox.show(“Bye”);
    }
}
Obj C2=new C2;
Obj.XX -> o/p=Bye


Must override:

To indicate that derived classes must provide their own implementation of a method using must override creates pure virtual also called abstract methods. These methods may not be used directly, but must be overriden.

Ex: vb.net

Public mustoverride subXX()
    Msgbox(“bye”)
End sub

C#.net:

Public abstract string XX()
        Msgbox.show(“bye”)

Not overriden:
To indicate that a method may not be overriden.

Vb.net:
Public Notoverridable subxx()
    Msgbox(“hai”)
End sub
Must inherits:

The class which doesn’t support instance creation is called must inherit class. In C++, Java it is called abstract class.
Ex: vb.net

Must inherits class C1
Public mustoverridable subxx()

End class

Class C2 inherits C1
Public overrides subxx()


  • Class: Logical representation of data.
  • Object: Physical representation of data.
  • Constructor: A special member function for automatically creating an instance of a class.
  • Destructor: A function that is called to deallocate memory of the object of a class.

Not inheritable:
The class which doesn’t support inheritance is called sealed class.
Ex: vb.net
Not inherits class C1
C#.net
Sealed class C1
Mybase:
To access methods in a base class when overriding methods in a derived class.

Me:
Me keywords provides us with a reference to our current object instance.
Myclass:
To call an overridable method in your class while making sure that implementation of the method in your class is called instead of an overridden version of the method.

Shadows:
The shadows keyword allows us to replace methods on the base class that the base class designer didn’t intend to be replaced.

Ex:
Vb.net:
Public shadows Readonly property  xx()Intiger
   Get
        Return 3.8
    End get
 End property
End class

Shared:

Shared data -> Shared Method -> Shared Constructor

Shared data:  when the data is attached to the class then it is called as shared data. This data will have only one memory instance which will be common to all the objects of the class.

Ex: public shared eno as byte

Shared method:   the method which is attached to the class is called as shared method. This method can access only by shared data.
Ex: public shared function XX() as byte

C#.net-> public static int xx()

Early binding:  Early binding means that our code directly interacts with the object by directly calling its method.(compilation time)

Late binding:   Late binding means that our code interacts with an object dynamically at runtime.

Access Modifiers:  

  1. Public : Entities declared Public have public access.There is no restrictions on the accessibility of the public entities.
  2. Private : Entities declared private have private access. They are accessible from their declaration context.

  1. Protected : Entities declared Protected have protected access. They are accessible only from within their own class or from a derived class. It is not a superset of friend class. You can use protected only at class level.

  1. Protected Friend: (protected internal) Entities declared in the protected friend have both protected and friend access. They can be used by code in the same class or as well as in derived class. The rules for protected and friend apply to protected friend as well.

  1. Friend: A function that has access to the private members of a class but is not itself a member of the class. An entire class can be a friend of another class.

Encapsulation: The mechanism by which the data and funtions ( manipulatiing this data) are bound together within an object definition.

Boxing: when we are converting value type as a reference type on the heap memory then it is called Boxing.

Ex: int a=20; Object b=a;It work implicitly.

Unboxing: when we are converting reference type to value type then it is called Unboxing. This will maintain on overhead towards the application. This will decrease the performance of application.

Ex: object a=20: int b=a;  Int b=int(a) -> implicit

Meta data: the collected information that describes an application is called metadata.

Name space: Name space is nothing but logical container for collection of classes.

  • Name space helps organize object libraries and hierarchies.
  • Simplify object references, prevent ambiguity when reffering to objects, and control the scope of object identifiers.

System collections: The collections name space is a part of the system name space and provides a series of classed that implement advanced array features.

  1. Array list: implements an array whose size increases automatically as elements are added.
  2. Bit array: Manages an array of Boolean that are stored as bits.
  3. Hash table:  Implements a collection of values organized by key. Sorting is done.

  1. Queue: Implements first in first out (fifo)

  1. Sorted list: Implements a collection of values with associated keys. The values are stored by key, and accessible by key or index.
  2. Stack: implements Last in First out(lifO)

System diagnostics: this name space provides classes that allow you to interact with system process, event logs and performance counters.

Deploymet: It is the process of taking an application and installing it on another machine.

Cabproject -> mergemodule project(.msm) -> setup project -> websetup project

Delegate:  a delegate is a class which acts as a function pointer.

    Features:

  1. It is provided with object-Oriented approach
  2. It refers to method of the object.
  3. A delegate is useful when you want to send one subprogram as a parameter to another subprogram.

Syntax: public Deligate sub XX()


Multicast deligate: it is a delegate that points to and eventually fires off several methods.

Thread: A thread can be defined as a unit of code having it’s own executing part.

  • Single thread: when the application is having only one process then it is called as single thread application.

  • Multi thread: when the application is having more than one process then it is called as multi thread application.
Methods: start(), shared sleep, suspend, resume, abort, join.

Asyschronus connection: ADO.net provides an option for asynchronous connection this can be achieved by multi threading.

Synchronization of threads:  Synchronization of the thread is allowing only one thread to work with block of statements. This can be achieved by applying the lock for set of statements.
Keyword:  synclock(“L1”)

Thread prorites: Above normal, normal, below normal, minimum.



ASP.NET


Session:

The session object is used to store information about a user. Data stored in the session object are not discarded when the user browser from one page to another, within the same applications. The object is destroyed when the user abondans the session or the session time out.

Default time -> 20 minuts.
Session.LCID -> properly set or returns local id by default -> 1033

Advantages:

  1. The session object contains information about a perticular user. This information doesn’t shared by other user.
  2. When the session expires or its terminated, the server destroys the seddion object.
  3. When the user makes additional requests to the server, the user Id is transferred between the client and server. Thus, user specific information can be tracked and monitored for the duration of the user’s session.

Session variable:  a session variable is avialable only to a particular user.

Syntax: session(“user”)=DateTime.now; Labell.Text=Session(“user”).ToString();

Session Events:  session-onStart() -> session-onEnd()

  • Session-onStart: when a new user accesses an application then session-onStart() event activated.

  • Session-onEnd:  when the user quits the application then session-onEnd event fired.

A session object is subset of application object. When an ASP.NET application is terminated, the dependent session objects are also destroyed.

Session properties:

  1. Session ID     -> Contains a unique user information identifier. To retrive the session ID -> Session.sessionID

  1. Time out            -> Is used to set the user timeout.
               <% Session.TimeOut=10 %>

  1. Count             ->  Gets or sets name of a session value.

  1. IsNewSession   -> If the session has been created with the current request.

  1. LCDID           -> Is used to set the local Identifier. This stores the local information like date, currency and time formats.


  1. Item                 -> Gets or Sets name of a session value.

Session.Abandon: (method):  The Abandon method is used to explicitly end a session.

Application:  The application object is built in ASP.Net object that represents an instance of an ASP.net application.

  • It includes all the methods and collections related to applications.

  • When the first user calls an ASP.net file from a virtual directory, the application is started and an application object is created.

  • Once the application object created, it can share and manage information through the application.

  • The application object persists until the application is shut down.

Syntax:  Appliction(“vasu”)=”welcome to C#”;// Declaration
       Response.write(Application(“vasu”));// Display

Application Events:

  1. Application –OnStrat() -> fired when the first ASP.net page in the current application directory.
  2. Appliction-OnEnd() -> Fired when the last session of the application ends. Also fired when the web application is stopped using the internet service.
  3. Appliction-OnBeginRequest -> Fired every time a page request begins(ideally when a page is loaded or refresh)
  4. Application – onEndRequest -> Fired every time a page request ends.

Application methods:

  1. Lock()  : to avoid data concurrency( End transaction, begin transaction)
  2. Unlock():
  3. Remove():


Remoting: the process of communication between different operating system process regardless of whether they are on the same computer.

  • Client should be .net

Single call:  Each incoming request from a client is serviced by a new object. The object is thrown away when the request has finished. This mode is stateless. Asp.net made it as stateful to store that state service.

Singleton: All incoming requests from clients an processed by a single server object.

Marshal ref object:  The server create an object and sends only reference information to the client. This information can be called as proxy on the client machine.
Marshal by value:  The server creation object and sends the object to the client system.

Client activated object: This is the old stateful model where by the client recieves a reference to the remote object and holds the reference. Until it is finished with it.(by default it is 5 min)

Searialization: serialization is the process of converting an object into a stream of bytes.

Deserialization: Deserialization is the opposite process of creating an object from a stream of bytes.

Channel:   A channel is a way of communicating between two mechines.

  • Http: is a already know, the protocal that webservers use -> SOAP
  • Tcp: The channel is a lightweight channel designed for transporting binary data between two computers. -> Binary

Formatter: A formatter is an object that is responsible for encoding and serializing the data into message on one end, and deserialized and decode message into data on the other end.

Proxy: It is a fake copy of server object that resides on the client side that behaves as if it was the server. It handles the communication between real server object and client object. This process also called marshalling.

Diffgram: A diffgram is an Xml format that is used to identify current and original versions of data elements. The dataset uses the diffgram format to load and persist its contents, and to serialize its content for transport across a network connection.

Application domain:  
A application domain can be thought of as a lightweight process. Multiple application and exist inside a win32 process. The primary purpose of the application domain is to isolate an application from other application. Win32 process provide isolation by having distinct memory address spaces.

Remoting implemention:

  • Reference:     system.Runtime.Remoting; imports System.Runtime.Remoting.chennel
  • Take one channel and Register( channelservice.RegisterChannel(t1))
  • Configuration -> Remoting configuration.Register well known service type. (getType(emp))



ADO.NET

ADO.NET:   Is the successor to activex data object( ADO). The main goal of   ADO.NET is to allow you to easily create distributed , data sharing application in the .net framework.

AD.NET uses xml to exchange data between programs or with web pages.



Features of ADO.NET:

  • Disconnected data architecture.
  • Data cached in datasets.
  • Data transfer in xml format
  • Interaction with the database is done through data commands.

ADO.NET data providers:
.net providers are used to connecting to database, executing commands, and retriving results.

  1. OLEDB.NET data provider: This provider sets you access a data source for which an OLEDB provider exists.

  1. SQL.Net data provider:   This provider has been specifically written to access sql server 1.0  or later versions.

Some name spaces in ADO.NET:

  • System.Date =>All generic data access classes;
  • System.Oledb => Oledb provider class.
  • System.Data.Common => Classes shared by individual data providers.
  • System.date.Sqltype => sql server date types.

ADO.NET Components:

    Dataset: Dataset contains a collection of one or more datatables object made up of rows and columm of data, as well as promary key, foreign key constraint and relation information about the data in the data table object.
    It is basically inmemory database. Good example for disconnected Architecture.

Types of Datasets:

    Typed data set:  A Typed dataset coming from the dataset class and has an associated x,l schema, which is created at the time of the creation of the dataset. The xml schema contains information about the dataset structure, such as tables, columns and rows. When a typed dataset structure is created, the data commands are generated automatically. By using the column name from the data source tables and teir columns can be accessed by their names while programing.
   
    Untyped dataset: An untyped dataset doesn’t have any associated xml schema in an untyped dataset, the tables and columns are represented as collections.

Data set methods:

  • Read xml: Reads an xml schema and data into the dataset.
  • Get xml: Returns the xml representation of contents of the dataset
  • Write xml: Writes the xml schema and data from the current dataset.
  • Copy : Creates a dataset that has both the same structure and the same data as current
Events:
Merge failed: Fires when two dataset objects being merged have the same packet key value and the enforce constraints property is true.

Data Adapter: data Adapter acts like a mediator between dataset and database server. It involves In the following things.

  • Getting information from the database server and filling itno dataset.
  • The changes within the dataset will be update to database server.

Fill():  The fill method of data adapter is used to populate a dataset with result of the select command of the data adapter.

Note: the data adapter object select command property must be set before the fill method is called.

Fill schema: Uses select command to extract just the schema for table from datasource & create an empty table in the dataset object will all constains.
Update: Having insert , delete , update.

Command object: After establishing a connection, you can execute commands and return results from a data source.

Methods:

  • Execute non query: Executes the action query specified by command text and returns the no. of rows effected.
  • Execute Reader: Executes the select query specified by command text and return the scalar value(singleton) In the first column of the first row nad ignoring all other values.
  • Execute xml Reader: Performs that select query specified by command text and return an xmlreader objcet that lets you read the values in the resuluset.

Data Reader: Data reader is used to retrieve data from a data source in a read only and forward only direction. Using data reader results in faster access to data and less memory usage since at any time, only a sinlge row is stored in the memory.

Connected Architecture: After processing of results is over if we are maintaining the connection to database server implicitly then that type is called connected Architecutre.

 Ex: Data Reader

Disconnected Architecture: After processing of result is over if we the connection is closed implicitly and result is stored on the client machine then this is called Disconnected Architecture.
Ex:data Set

Data row: class represents an individual row or record in a table. Which can be accessed through its item property.

Data column: Represents a single column in a data row or data table.

Data view:  A data view object contains  a collection of dataRowView objects. Which are views over the rows in the underlying datatable object. You can insert, delete or update. These data view objects , and your chages are reflected in the original table as well.

Data Relation:  A relationship associates rows in one datatable with rows in another data table In the same dataset.

Assembly:  Assemblies are the building blocks of .net framework applications. They form the fundamental unit of deployment, version control, reuse, activation scoping and security permissions. An assembly is a collection of types  and resources that are bulit to work together and form a logical unit of functionality.


Benefits:

  • Designed to simplify application deployment
  • Solve versioning problem
  • Assemblies enable zero-impact application installation.
  • They also simplify uninstalling and replicating application.

Assembly contents:

  • The assembly manifest which contains assembly metadata.
  • Type metadata
  • Microsoft intermediate Language code that impliments the type.
  • A set of resources.

Manifest: Manifest will describe the assemblies which are required for the application. This description is required for the runtime to load the d11’s into application process. This assembly manifest can be stored in either a portable executable (PE) with MSIL.

Type meta data:     This will provide description about name spaces, classes and methods available in the application.

Resources: if assembly contains any--------------------------------------

MSIL Code:   the compiler will convert source code of a particular language into intermediate language code which is going to be understand by CLR. This code is called MSIL. The MSIL code is platform independent. Which will be process by CLR towards operating system native code.

Assembly types:

  1. Private assembly:   Private assembly is used inside an application only and doesn’t have to be identified by a strong name.

  1. Shared assembly:   Shared assembly can be used by multiple application and has to have a strong name.

  1. Sattelite assembly:  An assembly with culture information is automtically assumed to be a sattelite assembly.


Assembler can be static or dynamic. Static assemblies can include .net framework types(interfaces and classes), as well as resources for the assembly (bitmaps, Jpeg files). Static assembliers are stored on disk in PE files. You can also use .net framework to creae dynamic assemblies. Which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.

Strong name:   A strong name includes the name of the assembly version nember, clulture, and public key token. Major: minor: Build: Rivision | sn –k “path. Snk”

Side-by-side execution:  It occurs when multiple versions of the same assembly can run at the same time.

Probing:  probing is a concept of searching for the assembly at runtime.

Gacutil.exe: The Gacutil.exe utility that ships with .net is used to add and remove assembliesfrom the Gac. To add an assembly into the GAC using the facutil.exe.

Syntax: gacutil –I “path.d11 “ -> install
      Gacutil –u “path.d11” -> uninstall

Reflection: All .net assemblies have metadata information stored about the types defined in modules. This meta data information can be acced by mechanism is called reflection.

Asp.net(cookies)

Cookie: it is a small amount of data used by the webserver on the client machine. 4kb(20 cookies)

  1. Inmemory cookie: When the cookies are stored within the process of web browser.
  2. Persistant cookie:  When the cookies is stored on the hard disk memory is called persistant cookie. Ex: temp

Ex: dim c1 as new HTTP cookie(“key”); c1.value= value(100); c1.add=(key,value);
Response.append cookie(“c1”)-> this is cookie to client machine.

  • C1.expires=”mm/dd/yyy”.

Cookies can be disabled in asp.net using cookieless property of session state node.
Cookies Advantages: it doesn’t requires server’s resources because none of the cookies are stored in the server.

You can have control on when a cookie can expire unlike sessions where there is no control.

Cookies Disadvantages:  the data stored on a cookie in clients machine is limited. You can’t store more than 4096 bytes of data.

Cookies are not secured as they any one can modify the cookies data in a client machine.

While writing the cookie information in cookies folder. The cookie is checked for its existance. In case it exists the old value of the cookie is discarded and new value is overwritten.

Cookie dictionary:  A cookie dictionary is single cookie with several name/value pairs of information.

HTTP cookie cookie1= new HTTP cookie(“user”);
Cookie1.values.Add(“name”, “sreenu k”);
Cookie1.values.Add(“password”, “vasu”);

In above ex a cookie dictionary created user cookie. The cookie has two keys name and pwd. When the client is sent to the browser, the following information is sent in the header.

Set.cookie: user=name=sreenu+k $ password=vasu

Retriving data: The HTTP cookie is the class of the request object to retrive information stored in a cookie and sent to the server through HTTP request.
Syntax: HTTP cookie <cookiename1>=Request.cookies[“<cookiename2>”];

Here cookie1 is the cookie that stores information about the required cookie. i.e cookie2

  • If  you want retrive particular key of the cookie dictionary. Then you have to pass the name of the key.
Cookie2.values[“password”];

HTTP Stateless Protocal:  The protocal doesn’t have any features that can be used to maintain information about user. Each page request made by the user is treated as a request from new user. Once the webbrowser sends the page to the client browser. It closes the connection. So, state information about user not created.

Caching:  caching is a technique used to increase performance by keeping frequently accessed data in memory.

    ->output caching->fragment->data caching

Output caching: Output caching refers to caching the dynamic response generated by a request. The @output cache should be added at the beginning or a page to cache a webpage. The output cache directive takes a duration parameter and very by param.

Data caching: Data caching involves in caching application data that is frequently used and retriving whenever required by application.

Syntax:      cache[“mykey”]= myvalue;
Myvalue= cache[“mykey”]

To add  a data to the cache, use the below

Cache(key)=value
Cache.insert(“variablename”,value)
Cahce.Add(“variablenaem”,value)

  • Here Add method returns an object that represent the cached data
  • Insert method doesn’t return any.
  • Insert method to a insert a value to a key already existing overwrites in add it results error.


To remove cached data:  cache.Remove(key)

Fragment caching:  Fragmet caching implementaed by user controls to cache a user control that a page is using for a specific duration of time.

Response.cache.setExpires[DataTime.now.AddSeconds(30)];
System.web.caching-> name space for implementation if application data caching

Ispost back:  To check whether an .aspx page is posted back to their server or not.


Error handling: Error handling in .net is done using either structure exception handling or unstructured exception handling.

->structured => you can use try, catch, finally blocks.
->unstructured=> on error Go to

The use of structured exception handling method is you can protect block of code and catch specific exception in that block.

Whenever an exception is thrown an instance of exception class is created which contains the details of about exception. The various propertied of exception class are,

Stack Trace:  this contain the list of methods that wrre called before the exception is thrown.

Message: This contain the description of Error message.

HelpLink: Used to associate a help file to an error.

Source: Gets or Sets the name of the objects or assembly where the error has originated.You can’t combine both structured and unstructured exception handling within a single page.

On Error Go To: This statement disable any exception handles in the current procedure.

Postback:  the process in which a webpage sends data back to the same page on the server.
    By default page method->Post

Round trip:A sequence of webform stages that begin when a user action requires processing on the server.


Server object:
The server object is one of the six built in object of asp.net that provides this interface through which the web server can be controlled. The server object acts as interface to the HTTP service and exposes properties and methods of the HTTP server.

Server object properties:

  1. Script timeout:   Is used to specify the period fro which a script can run on the server before it is terminated.
  2. Machine name:  is used to get the machine name of the server.

Methods:

Execute: Execute method is used to transfer execution from the current page to another page and return the execution to ocurrent page.

Transfer: Transfer method is used to transfer execution fully to the specified page. Unlike the execute method, the control is lost from calling page with this method.

HTML encode method:  The HTML encode method is used to apply HTML encoding to a specified string.

Ex: Response.write(server.HTMLEncode(“<h1>hai<h1>”);o/p=<h1>vasu<h1>

URL Encode method: The URLEncode method of the server object is used toe encode that is passed to the server through a URL.

Syntax: server.URLEncode(string);  It ASCII- based cheracter formats.

Map path:  The map path method is used by the server to map a path to the information on the server. This method acts as interface between virtual directory or relative directories on the webserver.

Ex: Response.write(server.mappath(Request.serverVariables.Ger(“path-info”)));
o/p: c:\ASPnet-15\first.aspx


Tracing: Tracing is a feature that doesn’t exist in asp and new is ASP.Net.

tracing allows as to trace the execution of an application and later view of the application.

To view the result of the trace    Trace.write()

Trace.warn();  -> It will print Red color.

Tracing types,

  • Application level tracing.
  • Page level tracing.

Application level tracing:

    Application level tracing will provide the option of tracing the webpages by the developer without distrubing the  clients. -> Go to web.config

<Trace Enabed=”True/False” pageoutput=”true/false” Requestlimit=10 localonly=”true/false” />

  • Pageoutput= True, cach client request to the webpage will be presented with tracing information.
  • Pageoutput= False, the tracing information will be maintain within the logfile and without presenting to the user.
  • Request limit: it specify how many webpages trace information has to maintain in logfile. By default 10
  • Localonly= true, then local host client will receive trace information.
  • Localonly= false, It will not provide trace information.

Page level Tracing:  <% page trace=”True/False”>

Tracing information can be divided into following parts.

  • Request details ex: Request time, session id.
  • Trace information ex: Events and custom trace information
  • Control Tree provides control names, memory size and view state.

Trace.axd: The  contents of the trace lig are stored in trace.axd

Debug vs Trace: Debug class is mainly used for debugging application on during the development phase, while the trace is used for Testing and optimize after an application has been completed and released.


Inpage Technique:  It is a concept of writing the code for user interface and logic part within a single file called .aspx

Code behind technique: It is a concept of writing the user interface code in .Aspx and writing logic part in .dll

Webserver controls:  It follows .net framework objcet model which makes the programmers work easier and provides rich amount of properties.

  • Intensic controls: Label, textbox, button, hyperlink, check, radio
  • Rich controls: calender, ad rotator, calender.selecteddate,ToString(), properties- select mode: day, dayweek, day week month.
  • Validation: RE, required field, custom validator, validator summary
  • Data bound controls: dropdown list, datagrid, data list, repeater.

Ad Rotator:  Ad Rotator will rotates the  ---- between various clients towards a single page.

      Properties->advertaisement file

Global.asax: When you want to provide events of sessions and applications then we require a specific file called as global.asax.

->asax->active server application

Web.config: web.config is used to configure application settings specific to a web application.

Machine.config: Machine.config is used to configure application settings across the entire web application hosted in a server.

C:\winnt\microsoft.net\framework\v.i.4332

Asp.net objects:

  • Response
  • Request
  • Session
  • Application
  • Server
  • Object context


Request: Request object is used to read information from clients

Response: To send information to the clients.

Paging: Paging is a concept of specific total no of records into different group where each group is called page.

Structure of ASP.NET page or page Architecture:


  1. Directives -> code declaration blocks, code render blocks
  2. Server side comments -> server side include directives.

Directives: A directive specifics how an Asp.net page is compiled. The most frequently used directives are page directive and import directive(this is important for additional namespaces).


Code declaration blocks:  Contains the application logic of an Asp.net page and global variable declarations, subrotines, functions.

< script language=”c#” runat=server> ->beginning code declaraion
Void add Emp()
{
          Label.text=”hello”
}
</script>

Code render blocks: If you want to execute code with in the HTML content of an Asp.net page you need to use code render blocks. These are two types.

  1. Inline code -> begins with characters. Display a variable or method.
  2. Inline expressions -> Begins with characters.

<form name=”f”  runat=”server” method=”post”>
    <%str=”hello world” %> //inline code
The value of str is
<%=str %>//inline expression
</form>

Server side comments: purpose of documentation

    <%-- this is an example of serverside comments>

Server side Include Directive: If you want to include extend file in Asp.net application you need to use server side include directive.
   
<!-- #include file=”path” -- >

To register a com component:   

    >regsvr32    <dll name>; -> This is for whenever we are working on the different  system.
    To work with com -> .net: Go to References -> select com tab and add it.

Using .net components in the com world:

    Regasm to register assemblies for use by com is called Regasm.
Ex: open vb6.0 -> and go to Reference select our .dll

In com, the location of the DLL containing the component is available via the registry. In .net, the assembly always has to be either current directory or the global assembly.


Tlbexp: The type library exporter generates a type library that describes the types defined in the common language runtime assembly.

Syntax:

>tlbexp assemblyname[/out:file]
>tlbexp xx.dll        /out:xx.tlb

Interoperability marshalling:  It is the process of packaging parameters and return values into equivolent data types as they move to and from com objects.

Tlbimp: type library import used for to change the com component to assembly.

Syntax: >tlbemp xx.dll  //out:tlb

CCW: Com callabe wrapper. When a com client calls a .net object, the CLR creates the managed object and a CCW for the object. Com clients use the CCW as a proxy for the managed object.

RCW: Runtime callable wraper marshals data between managed and unmanaged code.

Type library: Type libraries describes the characteristics of com objcets. Such as member names and data types.

No comments:

Post a Comment