ViewState
Each control on a Web Forms page, including the page itself, has a ViewState property that it inherits from the base Control class. View state is used by the ASP.NET page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.
You can use the ViewState property to save your values independent of control state between round trips to the server. The ViewState property is stored in the page in a hidden form field
asp.net,c# Framework
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.
asp.net,c# Framework
Metadata and Manifest
Manifest describes the assembly itself. Assembly name, version, culture, strong name, list of files, type reference and reference assembly. While Metadata describes contents within the assembly like classes, namespaces, interfaces, scope, properties, methods and their parameters etc.
asp.net,c# C#
Garbage Collection
It is Automatic Memory Manager for .Net Framework. It manages the memory allocated to .Net Framework.
When a variable is defined it gets a space in memory (stack) and when an object is created memory for the object is allocated in heap. When an object is assigned to a variable it increments the reference counts for the object and when program control comes out of the function the scope of variable gets ended Or NULL is assigned to variable it decrements the reference count of object by 1. When reference count of one object becomes zero GC acts call destructor of object and then releases the memory acquired by the object.
asp.net,c# C#
Boxing and Un-Boxing:
Implicit(automatic) conversion of value type to reference type is known as Boxing And Explicit (manual) conversion of Reference type to value type is said to be Un-boxing. (conversion of Integer variable to object type)
asp.net,c# C#
Class
Class is concrete representation of an entity. It represents a group of objects, which posses similar attributes and behavior.
Provides Abstraction and Encapsulations. A category name that can be given to group of objects of similar kind.
asp.net,c# C#
Destructor/Finalize
Called by GC just before object is being reclaimed by GC.
asp.net,c# C#
Constructor
Special Method Always called whenever an instance of the class is created.
asp.net,c# C#
Static Variable and Its Life-Time
VB.NET: Public Shared VAR As Type.
C#: public static Type VAR;
Life time is till the class is in memory.
asp.net,c# C#
What is a Delegate?
A strongly typed function pointer. A delegate object encapsulates a reference to a method. When actual function needs to be called will be decided at run-time.
asp.net,c# C#
Identifiers/Access Specifies and scope
VB.NET: Private, Protected, Friend, Protected Friend, Public.
C#: private, protected, internal, protected internal, public.
asp.net,c# C#
Early-Binding
Calling an non-virtual method decides the method to call at compile time is known as Early-Binding.
asp.net,c# C#
Polymorphism
Mean by more than one form. Ability to provide different implementation based on different no./type of parameters. A method behaves differently based on the different input parameters. Does not depend on the Return-Type.
asp.net,c# C#
Interface
What a Class must do, But not how-to.
Bridge for the communication when the caller does not know to whom he is calling.
Describes externally visible behavior of element.
Only Public members which defines the means of the communication with the outer world. Can-be-Used-As Relationship.
Can not contain data but can declare property. There can be no implementation. Interface can be derived from another interface.
asp.net,c# C#
Abstract Class
Instance can not be created. Optionally can have one or more abstract methods but not necessary. Can provide body to Classes.
asp.net,c# C#
Inheritance
Gives you ability to provide is-a relationship. Acquires attributes and behaviors from another. When a class acquires attributes and behaviors from another class. (must not be Final or sealed class in .Net)
asp.net,c# C#
Shadowing
When the method is defined as Final/sealed in base class and not overridable and we need to provide different implementation for the same. We define method with Shadows/new.
asp.net,c# C#
Overloading
Adding a new method with the same name in same/derived class but with different number/types of parameters. Implements Polymorphism.
asp.net,c# C#
Overriding
When we need to provide different implementation than the provide by base class, We define the same method with same signatures in the derived class. Method must be Protected/Protected-Friend/Public for this purpose. (Base class routine can be called by Mybase.Method, base.Method).
asp.net,c# C#
Encapsulation
Binding of attributes and behaviors. Hiding the implementation and exposing the functionality.
asp.net,c# C#
Abstraction
Hiding the complexity. Defining communication interface for the functionality and hiding rest of the things.
In .Net destructor can not be abstract. Can define Either Finalize / Destructor. For Destructor access specifiers can not be assigned. It is Private.
asp.net,c# C#
Diffrence between HTML control and Server Control ?
ASP.NET Server Controls
Advantages:
1. ASP .NET Server Controls can detect browser's capabilities
and render themselves accordingly. No issues for compatibility of Browsers.
2. Processing would be done at the server side. In built functionality
to check for few values(with Validation controls)
Disadvantages:
1. The control of the code is inbuilt with the web server controls so you have no much
of direct control on these controls
2. Migration of ASP to any ASP.NET application is difficult.
HTML Server Controls
Advantages:
1.These controls can interact with Client side scripting. Processing would be done at client as well as server depending on the code.
2.We can make HTML control as Server Side control by the tag 'runat = server'.
Disadvantages: We need to code for the browser compatibility.
HTML Intrinsic Controls
Advantages: These controls can be made to interact with Client side scripting.
Disadvantages: We need to code for the browser compatibility.
All Framework Questions & Answers
What is an Assembly?
Assemblies are fundamental building blocks of .Net Framework. They contain the type and resources that are useful to make an application. Assemblies enables code reuse, version control, security and deployment. An assembly consists of: Manifest, Type Metadata, MSIL and resource file.
Assemblies are Private and Shared. Private are used for a single application and installed in application’s install directory or its sub-directory. Shared assembly is one that can be referenced by multiple application and resides in GAC(local cache for assemblies managed by .Net Framework).
gacutil /i myDll.dll can see and %windir%\assembly
asp.net,c# Asp.Net
Types of assemblies in .NET
Static assemblies: These are the .NET PE files that you create at compile time. You can create static assemblies using your favorite compiler: csc, cl, or vbc.
Dynamic assemblies: These are PE-formatted, in-memory assemblies that you dynamically create at runtime using the classes in the System.Reflection.Emit namespace.
Private assemblies: These are static assemblies used by a specific application.
Public or shared assemblies: These are static assemblies that must have a unique shared name and can be used by any application.
asp.net,c# Asp.Net
What might be best suited to place in the Application_Start and Session_Start:
Application level variables and settings initialization in App_Start
User specific variables and settings in Session_Start
asp.net,c# Asp.Net
Type Of Code in Code-Behind class:
Server-Side Code.
asp.net,c# Asp.Net
ASP.Net List Controls and differentiate between them?
RadioButtonList, CheckBoxList, DropDownList, Repeater, DataGrid, DataList
asp.net,c# Asp.Net
Page Life Cycle
Init, LoadViewState, LoadPostBackData, Load, RaisePostBackDataChangedEvent, RaisePostBackEvents, Pre-Render, SaveViewState, Render, Unload, (IpostBackDataChangedEventHandler and IpostBackEventHandler) Error, CommitTransaction, AbortTransaction, Abort
inetinfo.exe, aspnet_isapi.dll aspnet_wp.exe, HttpModules (OutputCache, Session, Authentication, Authorization, Custom Modules Specified) and Then HttpHandlers PageHandlerFactory for *.aspx
asp.net,c# Asp.Net
Role of Global.asax:
Optional file contains the code to handle Application level events raised by ASP.Net or By HttpModule. This file resides in application root directory. Application_Start, _End, _AuthenticateRequest, _Error, Session_Start, _End, BeginRequest, EndRequest. This file is parsed and compiled into dynamically generated class derived from HttpApplication.
asp.net,c# Asp.Net
What is web.config and machine.config:
machine.config is default configuration for all applications running under this version, located in %WinDir%\Microsfot.Net\Framework\Version. Settings can be overridden by Web.Config for an specific application Web.Config resides in application’s root/virtual root and exists in sub-sequent folders.
asp.net,c# Asp.Net
What is ViewState and How it is managed, Its Advantages/Benefits?
ViewState is a special object that ASP.NET uses to maintain the state of page and all webcontrols/ServerControls within it. It is in this object preserves the states of various FORM elements during post-backs. It is rendered to client(browser) as a Hidden variable __VIEWSTATE under
tag. We can also add custom values to it.
asp.net,c# Asp.Net
3 Types of Session State Modes?
InProc(cookieless, timeout), StateServer (Server, Port stateConnectionString="tcpip=server:port"), SQLServer (sqlconnectionstring) and Off.
asp.net,c# Asp.Net
Difference between User Control and Custom Control:
CUSTOM Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of webApp add reference and use. Normally designed to provide common functionality independent of consuming Application.
asp.net,c# Asp.Net
How to Manage State in ASP.Net?
Client based: ViewState, QueryString and Cookies Server based: Session, Application.
asp.net,c# Asp.Net
Different Types of Validators and Validation Controls
RequiredFieldValidator, RangeValidator, RegularExpressionValidator, CompareValidator, CustomValidator, ValidationSummary
asp.net,c# Asp.Net
Difference Server.Transfer and Response.Redirect
Both ends the processing for the current request immediately. Server.Transfer start executing the another resource specified as parameter without acknowledgement to client(browser) while Response.Redirect intimate client that your requested resource is available at this location and then client request for that resource.
asp.net,c# Asp.Net
Difference between Server-Side and Client-Side
Server-Side code is executed on web-server and does not transmitted to client, while client-side code executed on client(browser) and is rendered to client along with the content.
asp.net,c# Asp.Net
Different Types of Directives:
Page, Register, Control, OutputCache, Import, Implements, Assembly, Reference
asp.net,c# Asp.Net
Authentication and Authorization:
Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication. Authorization allowing access of specific resource to user.
asp.net,c# Asp.Net
Different Types of Caching?
Output Caching: stores the responses from an asp.net page. Fragment Caching: Only caches/stores the portion of page (User Control) Data Caching: is Programmatic way to Cache objects for performance.
asp.net,c# Asp.Net
Boxing and Un-Boxing
Implicit(automatic) conversion of value type to reference type is known as Boxing And Explicit (manual) conversion of Reference type to value type is said to be Un-boxing. (conversion of Integer variable to object type
DLL-HELL
Situations where we have to put same name Dlls in single directory where are Dlls are of different versions.
asp.net,c# Asp.Net
How does .NET Remoting work?
It involves sending messages along channels. Two of the standard channels are HTTP and TCP. TCP is for LANs only and HTTP can be used on LANs or WANs (internet). TCP uses binary serialization and HTTP uses SOAP (.Net Runtime Serialization SOAP Formatter). There are 3 styles of remote access: SingleCall: Each incoming request is handled by new instance. Singleton: All requests are served by single server object. Client-Activated Object: This is old state-full DCOM model. Where client receives reference to the remote object and keep until it finished with it.
IL Code
An assembly contains the IL code that the CLR executes at runtime. The IL code typically uses types defined within the same assembly, but it also may use or refer to types in other assemblies. There is one caveat: each assembly can have at most one entry point, such as DllMain( ), WinMain( ), or Main( ). You must follow this rule because when the CLR loads an assembly, it searches for one of these entry points to start assembly execution.
asp.net,c# Asp.Net
Metadata
Metadata is machine -readable information about a resource, or "data about data." Such information might include details on content, format, size, or other characteristics of a data source. In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information. In order for two components, systems, or objects to interoperate with one another, at least one must know something about the other. In COM, this "something" is an interface specification, which is implemented by a component provider and used by its consumers. In .NET, metadata is a common mechanism or dialect that the .NET runtime, compilers, and tools can all use. Microsoft .NET uses metadata to describe all types that are used and exposed by a particular .NET assembly. Metadata includes descriptions of an assembly and modules, classes, interfaces, methods, properties, fields, events, global methods, and so forth. .NET assemblies are deployable units and manifests are the metadata that describes the assemblies.
asp.net,c# Asp.Net
.NET Framework
.NET framework is an environment that facilitates Object Oriented Programming Model for multiple languages. It wraps Operating System and insulates Software Development from many Operating System specific tasks such as file handling, memory allocation & management. It has two main components CLR (Common Language Runtime) and .Net BCL (Base Class Libraries).
asp.net,c# Asp.Net
.NET Framework
.NET framework is an environment that facilitates Object Oriented Programming Model for multiple languages. It wraps Operating System and insulates Software Development from many Operating System specific tasks such as file handling, memory allocation & management. It has two main components CLR (Common Language Runtime) and .Net BCL (Base Class Libraries).
Assemblies are fundamental building blocks of .Net Framework. They contain the type and resources that are useful to make an application. Assemblies enables code reuse, version control, security and deployment. An assembly consists of: Manifest, Type Metadata, MSIL and resource file.
Assemblies are Private and Shared. Private are used for a single application and installed in application’s install directory or its sub-directory. Shared assembly is one that can be referenced by multiple application and resides in GAC(local cache for assemblies managed by .Net Framework).
gacutil /i myDll.dll can see and %windir%\assembly
asp.net,c# Asp.Net
Types of assemblies in .NET
Static assemblies: These are the .NET PE files that you create at compile time. You can create static assemblies using your favorite compiler: csc, cl, or vbc.
Dynamic assemblies: These are PE-formatted, in-memory assemblies that you dynamically create at runtime using the classes in the System.Reflection.Emit namespace.
Private assemblies: These are static assemblies used by a specific application.
Public or shared assemblies: These are static assemblies that must have a unique shared name and can be used by any application.
asp.net,c# Asp.Net
What might be best suited to place in the Application_Start and Session_Start:
Application level variables and settings initialization in App_Start
User specific variables and settings in Session_Start
asp.net,c# Asp.Net
Type Of Code in Code-Behind class:
Server-Side Code.
asp.net,c# Asp.Net
ASP.Net List Controls and differentiate between them?
RadioButtonList, CheckBoxList, DropDownList, Repeater, DataGrid, DataList
asp.net,c# Asp.Net
Page Life Cycle
Init, LoadViewState, LoadPostBackData, Load, RaisePostBackDataChangedEvent, RaisePostBackEvents, Pre-Render, SaveViewState, Render, Unload, (IpostBackDataChangedEventHandler and IpostBackEventHandler) Error, CommitTransaction, AbortTransaction, Abort
inetinfo.exe, aspnet_isapi.dll aspnet_wp.exe, HttpModules (OutputCache, Session, Authentication, Authorization, Custom Modules Specified) and Then HttpHandlers PageHandlerFactory for *.aspx
asp.net,c# Asp.Net
Role of Global.asax:
Optional file contains the code to handle Application level events raised by ASP.Net or By HttpModule. This file resides in application root directory. Application_Start, _End, _AuthenticateRequest, _Error, Session_Start, _End, BeginRequest, EndRequest. This file is parsed and compiled into dynamically generated class derived from HttpApplication.
asp.net,c# Asp.Net
What is web.config and machine.config:
machine.config is default configuration for all applications running under this version, located in %WinDir%\Microsfot.Net\Framework\Version. Settings can be overridden by Web.Config for an specific application Web.Config resides in application’s root/virtual root and exists in sub-sequent folders.
asp.net,c# Asp.Net
What is ViewState and How it is managed, Its Advantages/Benefits?
ViewState is a special object that ASP.NET uses to maintain the state of page and all webcontrols/ServerControls within it. It is in this object preserves the states of various FORM elements during post-backs. It is rendered to client(browser) as a Hidden variable __VIEWSTATE under
tag. We can also add custom values to it.
asp.net,c# Asp.Net
3 Types of Session State Modes?
InProc(cookieless, timeout), StateServer (Server, Port stateConnectionString="tcpip=server:port"), SQLServer (sqlconnectionstring) and Off.
asp.net,c# Asp.Net
Difference between User Control and Custom Control:
CUSTOM Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of webApp add reference and use. Normally designed to provide common functionality independent of consuming Application.
asp.net,c# Asp.Net
How to Manage State in ASP.Net?
Client based: ViewState, QueryString and Cookies Server based: Session, Application.
asp.net,c# Asp.Net
Different Types of Validators and Validation Controls
RequiredFieldValidator, RangeValidator, RegularExpressionValidator, CompareValidator, CustomValidator, ValidationSummary
asp.net,c# Asp.Net
Difference Server.Transfer and Response.Redirect
Both ends the processing for the current request immediately. Server.Transfer start executing the another resource specified as parameter without acknowledgement to client(browser) while Response.Redirect intimate client that your requested resource is available at this location and then client request for that resource.
asp.net,c# Asp.Net
Difference between Server-Side and Client-Side
Server-Side code is executed on web-server and does not transmitted to client, while client-side code executed on client(browser) and is rendered to client along with the content.
asp.net,c# Asp.Net
Different Types of Directives:
Page, Register, Control, OutputCache, Import, Implements, Assembly, Reference
asp.net,c# Asp.Net
Authentication and Authorization:
Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication. Authorization allowing access of specific resource to user.
asp.net,c# Asp.Net
Different Types of Caching?
Output Caching: stores the responses from an asp.net page. Fragment Caching: Only caches/stores the portion of page (User Control) Data Caching: is Programmatic way to Cache objects for performance.
asp.net,c# Asp.Net
Boxing and Un-Boxing
Implicit(automatic) conversion of value type to reference type is known as Boxing And Explicit (manual) conversion of Reference type to value type is said to be Un-boxing. (conversion of Integer variable to object type
DLL-HELL
Situations where we have to put same name Dlls in single directory where are Dlls are of different versions.
asp.net,c# Asp.Net
How does .NET Remoting work?
It involves sending messages along channels. Two of the standard channels are HTTP and TCP. TCP is for LANs only and HTTP can be used on LANs or WANs (internet). TCP uses binary serialization and HTTP uses SOAP (.Net Runtime Serialization SOAP Formatter). There are 3 styles of remote access: SingleCall: Each incoming request is handled by new instance. Singleton: All requests are served by single server object. Client-Activated Object: This is old state-full DCOM model. Where client receives reference to the remote object and keep until it finished with it.
IL Code
An assembly contains the IL code that the CLR executes at runtime. The IL code typically uses types defined within the same assembly, but it also may use or refer to types in other assemblies. There is one caveat: each assembly can have at most one entry point, such as DllMain( ), WinMain( ), or Main( ). You must follow this rule because when the CLR loads an assembly, it searches for one of these entry points to start assembly execution.
asp.net,c# Asp.Net
Metadata
Metadata is machine -readable information about a resource, or "data about data." Such information might include details on content, format, size, or other characteristics of a data source. In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information. In order for two components, systems, or objects to interoperate with one another, at least one must know something about the other. In COM, this "something" is an interface specification, which is implemented by a component provider and used by its consumers. In .NET, metadata is a common mechanism or dialect that the .NET runtime, compilers, and tools can all use. Microsoft .NET uses metadata to describe all types that are used and exposed by a particular .NET assembly. Metadata includes descriptions of an assembly and modules, classes, interfaces, methods, properties, fields, events, global methods, and so forth. .NET assemblies are deployable units and manifests are the metadata that describes the assemblies.
asp.net,c# Asp.Net
.NET Framework
.NET framework is an environment that facilitates Object Oriented Programming Model for multiple languages. It wraps Operating System and insulates Software Development from many Operating System specific tasks such as file handling, memory allocation & management. It has two main components CLR (Common Language Runtime) and .Net BCL (Base Class Libraries).
asp.net,c# Asp.Net
.NET Framework
.NET framework is an environment that facilitates Object Oriented Programming Model for multiple languages. It wraps Operating System and insulates Software Development from many Operating System specific tasks such as file handling, memory allocation & management. It has two main components CLR (Common Language Runtime) and .Net BCL (Base Class Libraries).
Subscribe to:
Posts (Atom)