asp.net my tutorial

27
ASP.NET FUNDAMENTALS ASP.NET is tool for creating web application and web services . ASP.NET is server side scripting technology. ASP.NET is a part of microsoft .net framework. .NET Framework includes an execution engine called common language runtime , CLR and class library. Like Asp, ASP.NET also runs inside IIS. It is tightly integrated with the microsoft server, programming, data access, and security tools . When browser requests an ASP.NET file, IIS passes the request to ASP.NET engine which after having executed the script sends file back to browser as a simple HTML page. ASP.NET is not backward compatible with classic ASP. Unlike interpreted classic ASP, ASP.NET is compiled CLR code. Being part of CLR , it has advantages of early binding, JIT compilation, caching services, garbage collection etc. ASP.NET uses ADO.NET for data access and is well integrated with VB.NET, C#.Net, Jscript etc. ASP.NET provides two sets of controls - HTML and server control. ASP.NET employs a text-based configuration settings and thus, server does't get restarted in case of change in setting.

Upload: sagar-viradiya

Post on 05-Feb-2016

15 views

Category:

Documents


2 download

DESCRIPTION

oiu

TRANSCRIPT

Page 1: ASP.net My Tutorial

ASP.NET FUNDAMENTALSASP.NET is tool for creating web application and web services.

ASP.NET is server side scripting technology.

ASP.NET is a part of microsoft .net framework.

.NET Framework includes an execution engine called common language runtime, CLR and class library.

Like Asp, ASP.NET also runs inside IIS. It is tightly integrated with the microsoft server, programming, data access, and security tools.

When browser requests an ASP.NET file, IIS passes the request to ASP.NET engine which after having executed the script sends file back to browser as a simple HTML page.

ASP.NET is not backward compatible with classic ASP.

Unlike interpreted classic ASP, ASP.NET is compiled CLR code.

Being part of CLR, it has advantages of early binding, JIT compilation, caching services, garbage collection etc.

ASP.NET uses ADO.NET for data access and is well integrated with VB.NET, C#.Net, Jscript etc.

ASP.NET provides two sets of controls - HTML and server control.

ASP.NET employs a text-based configuration settings and thus, server does't get restarted in case of change in setting.

ASP.NET executes new code on request and thus, server restarts only when new code executes.

ASP.NET  is part of the .NET framework and is made up of several components like Visual Studio .NET Web development tools, System.Web namespaces, Server and HTML controls.   

System.Web namespaces is the part of the .NET Framework that include classes.

Server and HTML controls are the two sets of user-interface components of ASP.NET

Page 2: ASP.net My Tutorial

Advantages of ASP.NETExecutable of  ASP.NET application is compiled that runs faster than interpreted scriptsAutomatic state management for controlsAccess to the .NET FrameworkIntroduction of VB.NET that is evolution version of VBFully supports object-oriented programming,Can create new and customized server controls from existing controlsBuilt-in security through the windows server or other authentication/authorization methodsIntegration with ADO.NETFull support for XML and CSSBuilt-in features for caching frequently requested web pages on the server.

Navigation sequence of ASP.NET web formIIS starts the ASP.NET worker process that in turn, loads the assembly,The assembly composes a response to the user andIIS returns the response to the user in the form of HTML.

ASP.NET web form componentsServer controls define the user interface of a Web form and built-in features for saving data.

HTML controls are visual element provided by HTML. They are useful when complete features of server controls are not needed.

Data controls connect to SQL and OLE databases and XML data files.Examples of such controls are SqlConnection, SqlCommand, OleDbConnection, OleDbCommand, DataSet.

System components provide access to various system-level events that occur on the server. Ex. EventLog, MessageQueue.

.NET Framework includes an execution engine called CLR and class library.

Shared (VB.NET) or static members (C#) - These are class methods that can be used directly without first creating an object from the class. These members can be called from the class name. Example of such member is Math class.

Virtual folder: Web applications can exist only in a location that has been published by IIS as a virtual folder. It is shared resource identified by an alias that represents a physical location on a server. The virtual folder named //localhost is the web root folder on your computer. IIS determines the physical location of your Web root folder. By default, IIS installs the folder on your root drive at \Inetpub\wwwroot.

View state: ASP.NET preserves data between requests using view state. View state is available only within the web page.

Page 3: ASP.net My Tutorial

State variable:  It allows data entered on a web page available on other web pages in an application.  Application state variables: The value of these variables are available to all users of an application.Session state variables: The value of these variables are available only to a single session (user).

Application event handlers in ASP.NETApplication_Start: occurs when first user visits a page.

Application_End: occurs when last user exit from the site.

Application_BeginRequest: occurs at the beginning of each request to the server.

Application_EndRequest: occurs at the end of each request to the server.

Session_Start: occurs when a new user visits a page within your application.

Session_End: occurs when a user stops requesting pages from the web application.

ASP.NET web form eventsPage_Init: server controls are loaded and initialized.

Page_Load: server controls are loaded in the page object.

Page_PreRender: application is about to render the Page object. 

Page_Unload: page is unloaded from memory.

Page_Disposed: page object is released from memory.

ASP.NET transaction events are Page_AbortTransaction: occurs when transaction is aborted.

Page_CommitTransaction: occurs when transaction is accepted.

Page_DataBinding: occurs when server control on the page binds to a data source.

Server control events in ASP.NETPostback events cause the web page to be sent back to the server for immediate processing. These events have performance issue because they trigger a round-trip to the server. 

Cached events save controls in the page’s view state to be processed when a postback event occurs. 

Page 4: ASP.net My Tutorial

Validation events occur before the page is post back to the server. .

Application domain: The process space where ASP.NET worker process loads the Web application’s assembly.

Namespaces organizes code and provide protection from conflicting names (namespace collisions)

Access modifier for classes and modulesPublic (VB.NET) or public (C#) can be accessed by all members in all classes and projects. 

Friend (VB.NET) or internal(C#) can be accessed by all members in the current project

Protected (VB.NET) or protected(C#) can be accessed in the current class and in classes derived from this member’s class

Protected Friend (VB.NET) or protected internal(C#) can be accessed by all members in the current project and all members in classes derived from this member’s class

Private (VB.NET) or private(C#) can be accessed by members of the current class only

Inheritance: With this facility, base class provides methods, properties, and other members to a derived class.

Abstract classes defines an interface for derived classes. Abstract classes are declared with the MustInherit (in VB.NET) or abstract (in C#) keyword. Methods and properties of these classes are declared as MustOverride (in VB.NET) or as abstract in C#.

Delegates are strong types function pointer used to invoke one or more methods where the actual method invoked is determined at run time.

Interfaces are similar to abstract classes except interfaces don’t provide any implementation of class members.

Global.asax: The Global object is defined in Global.asax that starts automatically when an application starts. A developer can use events in global object to initialize application-level state variables.

Maintaining state information: Context.Handler, Query strings, Cookies, View state, Session state, Application state.

Page 5: ASP.net My Tutorial

Point to be considered for state variables: Maintaining session state affects performance and should be turned off at the application and page levels when not required.

Application state variables are available throughout the current process, but not across processes. If an application is scaled to run on multiple servers or on multiple processors within a server, each process has its own application state. The web application’s boundaries determine the scope of the application state.

System.Web and System.Web.UI namespaces define most of the objects including Application, Page, Request, and Response objects.

Server Controls vs. HTML ControlsServer controls trigger control events on the server whereas HTML controls can’t.

Server controls maintains data across requests but with HTML controls data is not maintained. 

Server controls is provided with set of properties by .Net framework whereas HTML controls has attributes only.

AutoPostBack property associated with each control which causes the control to fire postback event. By default, this property is set to False. 

ASP.NET List and Table Controls are ListBox, DropDownList, Table, DataGrid, DataList, Repeater.

The validation controls check the validity of data just before the page is posted back to the server, without a round-trip to the server.

ASP.NET performs control validation on the client side just before posting the Web form back to the server. Once client-side validation succeeds, the web form is validated again on the server side before the Page_Load event occurs.

To open new window, we can use onclick=”window.open()” attribute. Web application supports client script that runs on the client.

ASP.NET Validation Controls: RequiredFieldValidator, CompareValidator, RangeValidator, RegularExpressionValidator, CustomValidator, ValidationSummary.

To use the validation controls, follow these steps:Draw a validation control,

Set ControlToValidate or ControltoCompare property,

Set control’s ErrorMessage property,

Page 6: ASP.net My Tutorial

Set validation control’s text property to show longer error message in a ValidationSummary.

Navigating between pages in ASP.NETHyperlink control, Response.Redirect, Server.Transfer is only for aspx page, end the currect page and begin executing the new one. Server.Execute begins new one while still displaying the currect one. Window.Open displays new browser window.

Layers to data access in ADO.NETPhysical data store: SQL, an OLE, or an Oracle database or an XML file.Data provider: Connection and command objects that create in-memory representation of dataData set: In-memory representation of the tables and relationships. Data view: Presentation of a table in the data set use for filtering or sorting of data. 

Types of database connection in ADO.NET: OleDbConnection, SqlConnection, OracleConnection.

Steps to access a database through ADO.NET Create a connection using a connection object.

Invoke a command to create a DataSet object using an adapter object.

Use the DataSet object in code to display data or to change items in the database.

The database command object provides these three command methods: ExecuteScalar, ExecuteNonQuery, ExecuteReader.

To establish database connection using command object Create a connection to the database.

Open the connection.

Create a command object containing the SQL command or stored procedure to execute.

Execute the method on the command object.

Close the database connection..

Transactions is a set of database commands that are treated as a single unit.

Page 7: ASP.net My Tutorial

Commands can be treated as transaction if Atomic: Each command should perform single unit of work independently. 

Consistent: All the relationships between data are maintained correctly. 

Isolated: Changes made by other clients can’t affect the current changes. 

Durable: Once a change is made, it is permanent.  

Transaction processing follows these steps Begin a transaction, 

Process database commands, 

Check for errors. If errors occurred, restore the database to its state at the beginning of the transaction, 

If no errors occurred, commit the transaction to the database. 

IsolationLevel property is the property of transaction objects that handles concurrent changes to a database.

Isolation Level SettingsReadUncommitted does not lock the records being read, 

Chaos, 

ReadCommitted locks the records being read and immediately frees the lock as soon as the records have been read, 

RepeatableRead locks the records being read and keeps the lock until the transaction completes, 

Serializable locks the entire data set being read and keeps the lock until the transaction completes. 

Exceptions are unusual occurrences in the code of application. Dealing with unusual occurrences is called exception handling. Errors that are not handled are called unhandled exceptions.

Ways to handling exceptions in ASP.NET areException-handling structures, Error events, Custom error pages. 

Page 8: ASP.net My Tutorial

Exception-Handling Keywords: Try/try, Catch/catch, Finally/finally, End Try and Throw/throw

Finally/finally: Free resources used within the Try/try section and process any other statements that must run, whether or not an exception has occurred

Exception-Handling Error Events Page_Error resides in the web form, 

Global_Error resides in the Global.asax file, 

Application_Error resides in the Global.asax file. 

Server Object’s Exception-Handling Events GetLastError ClearError 

Error pages can be .htm or .aspx where users are redirected when unhandled exception occurs.

We can define error page at two level: CustomErrors section of the Web.config file. ErrorPage attribute of the Web form’s @ Page directive. 

The customErrors mode attribute must be On to view the error pages. RemoteOnly (the default) means error will be displayed at the client machine and not locally. 

The page-level setting supersedes the application-level settings in the Web.config file.

Exception log provides a list of handled exceptions. Use the Throw/throw keyword to intentionally cause an exception. 

Tracing records events, a way to record errors by writing error message in the file.

Steps to use tracing in ASP.NET   Turn tracing on

Write to the trace log

Read the trace log

Tracing can be turned on or off for an entire Web application or for an individual page 

For an entire application, set the element’s Enabled attribute to True in Web.config file. 

For a single page, set the @ Page directive’s Trace attribute to True in the Web form’s HTML. 

Page 9: ASP.net My Tutorial

The Trace object provides the Write and Warn methods.

Messages written with Write are in black, whereas messages written with Warn are in red.

By default, trace output is displayed at the bottom of each Web page, if the element’s PageOutput attribute is set to False in the Web.config file, otherwise written to the Trace.axd file.

By default, you can view Trace.axd only from the local server running the application.

To view the trace log from a remote machine, such as when debugging remotely, set theelement’s LocalOnly attribute to False in the Web.config file. 

Users can be identified using Cookies. Cookies are small files that a web application can write to the client. Cookies allow interaction with user invisibly. Users can set their browsers not to accept cookies. Approaches when storing and retrieving user information through cookies: Store all the user information as a cookie on the client’s machine. Store an identification key and retrieve user information from a data source using key. 

Steps to store cookies in ASP.NETCheck if the client supports cookies by using the Browser object’s Cookies property.

Check if the cookie already exists by using the Request object’s Cookies collection.

Create a new cookie object using the HttpCookie class, if not exist.

Set the cookie object’s Value and Expiration properties.

Add the cookie object to the Response object’s Cookies collection.

Cookie object’s Expires property to Now – to delete Cookies

DllImport attribute to declare unmanaged procedures for use within .NET assemblies.

To hide public .NET members from COM, use the ComVisible attribute.

Mailto protocol to create a message that will be sent from the user’s mail system. 

The Mailto protocol is used as part of a hyperlink.

MailMessage and SmtpMail classes are used to compose and send messages from the server’s mail system.

Authentication is the process of identifying users.

Page 10: ASP.net My Tutorial

Authorization is the process of granting access to authenticated users based on identity. 

Access by anonymous users is the way most public web sites work allows anyone to view info.

ASP.NET web applications provide anonymous access by impersonation.

Impersonation is the process of assigning a user account to an unknown user.

By default, the anonymous access account is named IUSER_machinename. 

Ways to authenticate and authorize users in ASP.NETWindows authentication uses windows user list and privileges to identify and authorize users.

Forms authentication directs users to a logon web form that collects user name and password information, and then authenticates the user against a user list or database that the application maintains. 

Passport authentication directs new users to a site hosted by microsoft.

The FormsAuthentication class is part of the System.Web.Security namespace. Authenticate method of this class checks the user name and password against the user list found in theelement of Web.config. RedirectFromLoginPage method of this class displays the application’s start page. Use the FormsAuthentication class to sign out when the user has finished with the application. 

Passport authentication identifies users via Microsoft Passport’s single sign-on service. The advantage of Passport authentication is that the user doesn’t have to remember separate user names and passwords for various web sites

IIS supports ways of encrypting and decrypting Web requests and responses.This cryptography requires that you request an encryption key called a server certificate from an independent third party called a certificate authority. The Secure Sockets Layer (SSL) is the standard means of ensuring that data sent over the internet can’t be read by others. When a user requests a secure Web page, the server generates an encryption key for the user’s session and then encrypts the page’s data before sending a response. On the client side, the browser uses that same encryption key to decrypt the requested web page and to encrypt new requests sent from that page.

Steps to be taken before deployment of application

Set the build options: Make the project compatible with an earlier Microsoft .NET. Select the Enable Optimizations check box to make the compiled code smaller, faster, and more efficient. Disable integer overflow checks:Allow classes to be used from the

Page 11: ASP.net My Tutorial

Component Object Model (COM).

Identify the application: To identify your application, open the AssemblyInfo file and enter the application’s information. 

Configure the application: Configuration files are Web.config and Machine.config. 

The Machine.config file located in the Windows\Microsoft.NET\Framework\version\config directory. Machine.config sets the base configuration for all .NET assemblies running on the server.

Web.config Attributes: Compilation, CustomErrors, Authentication, Authorization, Trace, SessionState, Globalization.

The global assembly cache (GAC) is a special subfolder within the Windows folder that stores the shared .NET components. When you open the folder, Windows Explorer starts a Windows shell extension called the Assembly Cache Viewer (ShFusion.dll)

You can install strong-named .NET components by dragging them into the Assembly Cache Viewer, or by using the Global Assembly Cache tool (GacUtil.exe).

Monitoring the Server: Windows provides MMC snap-ins for monitoring security, performance, and error events. Event Viewer snap-in: Lists application, system, and security events on the system. Performance snap-in: Lets you create new events to display in the Event Viewer.

Tuning Deployed Applications

ProcessModel element’s attributes in the server’s Machine.config file: control the number of threads and the time-out behavior etc.

Use the sessionState element’s attributes in the application’s Web.config file: control how session state information is saved. 

ProcessModel AttributesMaximum number of requests to be queued, How long to wait before checking whether a client is connected, How many threads to allow per processor etc. 

Optimization Tips Turn off debugging for deployed applications. 

Avoid round-trips between the client and server. 

Turn off Session state if it isn’t needed. 

Turn off ViewState for server controls that do not need to retain their values. Use stored

Page 12: ASP.net My Tutorial

procedures with databases. 

Use SqlDataReader rather than data sets for read-forward data retrieval. 

The ability to add capacity to an application is called scalability. ASP.NET Web applications support this concept through their ability to run in multiple processes and to have those processes distributed across multiple CPUs and/or multiple servers. 

A Web application running on a single server that has multiple CPUs is called a Web gardenand application running on multiple servers is called a Web farm. 

Web Garden Attributes in processModel are 

webGarden: Set to “true” to run applications on more than one processor on this server. 

cpuMask: Specifies which CPUs should run ASP.NET Web applications. 

Multiple ServersFor multiple servers to handle requests for a single HTTP address, you need to install load balancing to your network. Load-balancing services can be provided by hardware or software solutions. 

Running a web application on multiple servers requires that you take special steps to handle application and session state information. To share data across multiple sessions in a web garden or web farm, you must save and restore the information using a resource that is available to all the processes. This can be done through an XML file, a database, or some other resource using the standard file or database access methods. You can share session state using: A state server, as specified by a network location. A SQL database, as specified by a SQL connection. 

ASP.NET Web applications also have a limited ability to repair themselves through process recycling. 

Process recycling is the technique of shutting down and restarting an ASP.NET worker process (aspnet_wp.exe) that has become inactive or is consuming excessive resources. You can control how ASP.NET processes are recycled through attributes in the processModel element in the Machine.config file. 

Types of Tests Unit test, Integration test, Regression test, Load test (also called stress test), Platform test. 

Web user controls combine one or more server or HTML controls on a Web user control page. User controls create a single visual component that uses several controls.

Page 13: ASP.net My Tutorial

User controls can be used on Web forms throughout a project. User controls are not compiled into assemblies. 

Steps to create user control 

Add a Web user control page (.ascx) to your project. 

Draw the visual interface of the control in the designer. 

Write code to create the control’s properties, methods, and events. 

Use the control by dragging it from Solution Explorer to the Web form. 

Use the control from a Web form’s code by declaring the control at the module level. 

Composite custom controls combine one or more server or HTML controls composite custom compiles to create an assembly (.dll) 

Rendered custom controls are created almost entirely from scratch.

Caching

@OutputCache page directive caches a Web form in the server’s memory. 

OutputCache directive has two required attributes: Duration and VaryByParam. 

The VaryByParam attribute caches multiple responses from a single Web form. VaryByParam to None caches only one response for the Web form. 

XSL TransformationsXSL transformations generate formatted output from an XML input file. XSL positions elements anywhere on the Web form. XSL performs logical operations like repeating and conditional operations. XSL places structured data on a Web form. 

Steps to perform an XSL transformation in ASP.NET 

Add an XML server control to a Web form. 

Set the control’s DocumentSource property to the XML file to format. 

Set the TransformSource property to the XSL file to use to format the output. 

Creating an XML FileXML files describe structured data in text format. XML identifies data items using … tags. Each item must have a begin tag and an end tag. Item tag names are case sensitive. Attribute values must always be enclosed in double quotation marks.

Page 14: ASP.net My Tutorial

The nested items must be terminated before the containing item is terminated. The XML structure is strictly hierarchical. XML refers to the items in this hierarchy as XML nodes. Nodes have parent-child relationships that are identified using the XPath. 

Globalization Approaches in ASP.NETCreate separate web application corresponding to each culture, detect the culture and redirect to appropriate application. Create single web application and adjust output at run time as per culture detected. Create a single Web application that stores culture-dependent strings in resource files that are compiled into satellite assemblies. At run time, detect the user’s culture and load strings from the appropriate assembly.

C#.NET  is a major component of Microsoft Visual Studio .NET suite.  

Being part of VS.net suite, C#.NET can access a common .NET library and supports all CLS features.

C#.NET is a complete object oriented language which supports inheritance, overloading, interfaces, shared members and constructors. 

.Net Framework  is a primary element for software development in VS.Net suite.

.Net Framework includes loads of code required for application development.

.Net Framework is divided into CLS (Common language Runtime) and base class library.

CLS offers many service required for execution of application developed in .Net platform

Base class library has many pre-developed classes that can be used by the developer.

Base class library is organized into namespaces.

Assembly is a primary unit of the .Net application.

Assembly  contains manifest which describes the assembly and its modules.

Modules contain source code for the application.

An assembly may exist in the form of either DLL or .Exe.

An assembly is stored as an intermediate language (IL) file. Before running, the assembly goes through security check against the local system. After

Page 15: ASP.net My Tutorial

having cleared from security check, it gets loaded into memory and compiled into native code by JIT compiler.

A variable in .Net can be of two types.

Value type and reference type.

Value type contains data of the type whereas reference type contains pointer to an instance of an object of that type.

Value type is created at the time of declaration whereas reference type must be instantiated after declaration to create object.

If we assign a reference type variable to another reference type variable, only reference to the object is copied, not value and both the variable will refer to the same object.

Use of 'using' keyword will allow to reference to the member of a namespace. Classes and structures contain data and methods. Methods perform data manipulation and provide behavior to classes and structures. Method can return values. The method which returns value is called as function and which doesn’t return value is called as Subs.

Method can have parameters that are passed by value by default. We can pass parameters by reference with the ref keyword in C#.NET and byref in VB.NET.

The constructor is like any method of the class, but gets created before the object is available for use. This is the first method to get called on the instantiation of the class.

The destructor is called just before an object is destroyed. It is used for code clean-up when object is no longer in use. Developer has no control when a destructor is called, since it gets called by CLR.

.Net Framework provides utility like garbage collection.

The garbage collection is responsible for automatic memory reclamation when object is no more in use.

The garbage collection is a low-priority thread that runs in the background of the application.

The GC gets high priority when memory resource is scarce.

Page 16: ASP.net My Tutorial

We should remember that GC is called by CLR, so developer has no control when GC is called. So, we shouldn’t rely on the code placed inside destructors or finalizers. If we need to reclaim recourses urgently, we can use dispose () method which can be called explicitly.

The GC also gets ride of circular references, commonly known as memory leak.

Form is the basic unit of user interface. We can add form in the application at design time or run time. We can create one general parent form and can inherit forms from parent form using visual inheritance. While using visual inheritance, we ensures uniform look to all the forms of the application.

Forms have various properties that control their appearance, namely text, font, cursor, background Image, Opacity, backcolor and forecolor.

Forms have various intrinsic methods like Form.show, form.showdialog, form.activate, form.hide and form.close.

Form’s intrinsic methods cause changes in the visual interface and various events get raised like load, activated/deactivate, visiblechanged, closing, closed.

We can also create our own event handler which will get called when associated event is raised.

Each control on the form can have order of navigation which can be set using tabindex property of the control.

A control can contain other controls. For example panel, groupbox and tabpage.

We can resize and change position of the form and controls on it, manually. We can make use of docking and anchor properties for automatic resizing and positioning of the controls as we change size or position of the form.

Dock property ensures the controls to an edge of the form on change in size or repositioning of the form.

Anchor property ensures if controls should be fixed, floats, or change size in response to the change in size of form.

We can create control at run-time by declaring control and instantiating of the type. We can then add instantiated control to the control collection of the form.

Page 17: ASP.net My Tutorial

Each control’s property on the form can be enhanced by using Extender Provider component. These properties mostly used to provide information to the user like help or tool tip.

Menu is the best navigation way in the application. We can create MainMenu control that allows rapid creating of menu for the application. Developer can apply separator bars, access keys and shortcut keys.

Context menu allows us to get access to various commands on the specific situation.

Developer can create this kind of menu same as MainMenu but at run-time.

We can control the menu dynamically at run-time. We can enable and disable the menu items, make menu items invisible etc. We can change the structure of menu dynamically at run-time by creating new menu with the CloneMenu method.

We can have form-level validation as well as field level validations.

We can validate each field as data entered using field-level validation.

We can validate all fields of the form at one shot using form-level validation.

The textbox control contains properties like MaxLength, PasswordChar, ReadOnly, Multiline. These properties are used to restrict user to enter unwanted data in the field. Developer can tap keyboard events of the control like Keydown, KeyUp and Keypress.

Developer can validate character input by using static methods of char structure like char.IsDigit, CharIsletter, Char.Islower, Char.IsUpper etc.

The CauseValidation property of the control allows us to disable the event to occur. The event occurs only when CauseValidation property of the control is set to true.

We can set CancelEventArgs.Cancel property to true in the event handler to restrict focus from moving away from the control.

The ErrorProvoider component of the control can be used at run time for displaying informative error message to the user.

Page 18: ASP.net My Tutorial

ASP.NET FREQUENTLY ASKED QUESTIONS

ASP.NET frequently asked interview questions 

Next>>

Part 1 | Part 2 | Part 3 | Part 4 | part 5 | part 6 | part 7 | part 8 | part 9  

What is AppSetting Section in “Web.Config” file?  

Latest answer: AppSetting section is used to set the user defined values. For e.g.: The ConnectionString which is used through out the project for database connection.........Read answer

Difference between Server.Transfer and response.Redirect.

Latest answer: Following are the major differences between them: Server.Transfer - The browser is directly redirected to another page. There is no round trip...........Read answer

Difference between authentication and authorization.

Latest answer: Authentication is the process of verifying the identity of a user. Authorization is process of checking whether the user has access rights to the system..............Read answer

What is impersonation in ASP.NET?

Latest answer: By default, ASP.NET executes in the security context of a restricted user account on the local machine. However, at times it becomes necessary to access network resources which require additional permissions.............Read answer

What is event bubbling in .NET?

Latest answer: The passing of the control from the child to the parent is called as bubbling. Controls like DataGrid, Datalist, Repeater, etc can have child controls..........Read answer

Describe how the ASP.NET authentication process works.

Latest answer: ASP.NET runs inside the process of IIS due to which there are two authentication layers which exist in the system.............Read answer

Explain the ways of authentication techniques in ASP.NET

Latest answer: Selection of an authentication provider is done through the entries in the web.config file for an application.The modes of authentication are:.........

Page 19: ASP.net My Tutorial

Read answer

Windows authentication.

Latest answer: If windows authentication mode is selected for an ASP.NET application, then authentication also needs to be configured within IIS since it is provided by IIS............Read answer

Passport authentication

Latest answer: Passport authentication provides authentication using Microsoft’s passport service. If passport authentication is configured and users login using passport then the authentication duties are off-loaded to the passport servers.............Read answer

Forms authentication

Latest answer: Using form authentication, ones own custom logic can be used for authentication. ASP.NET checks for the presence of a special session cookie when a user requests a page for the application. ............Read answer

Explain how authorization works in ASP.NET

Latest answer: ASP.NET impersonation is controlled by entries in the applications web.config file. Though the default setting is no impersonation, it can be explicitly set using: ...........Read answer

Difference between Datagrid, Datalist and repeater.

Latest answer: Datagrid: The HTML code generated has an HTML TABLE element created for the particular DataRow and is a tabular representation with Columns and Rows. Datagrid has a in-built support for Sort, Filter and paging the Data........... Read answer

What are the events in GLOBAL.ASAX file?

Latest answer: Global.asax file contains the following events: Application_Init - Fired when an application initializes or is first called. It is invoked for all HttpApplication object instances.............Read answer

What are different IIS isolation levels supported in ASP.NET?

Latest answer: IIS has three level of isolation:- LOW (IIS process): In this main IIS process and ASP.NET application run in same process due to which if one crashes, the other is also affected............Read answer

Difference between Gridlayout and FlowLayout.

Latest answer: GridLayout provides absolute positioning for controls placed on the page. FlowLayout positions items down the page like traditional HTML.........Read answer

Page 20: ASP.net My Tutorial

What is Authentication in ASP.NET?

Latest answer: Authentication is the process of verifying user’s details and find if the user is a valid user to the system or not.......Read answer

What is Authorization in ASP.NET?

Latest answer: Authorization is a process that takes place based on the authentication of the user....... Read answer Explain the concept of Automatic Memory Management in ASP.NET.

Latest answer: The .NET framework has introduced a concept called Garbage collector. This mechanism keeps track of the allocated memory references and releases the memory when it is not in reference..........Read answer

What is Finalizer in .NET?

Latest answer: Finalizer in .NET are the methods that help in cleanup the code that is executed just before the object is garbage collected.............. Read answer

Explain the types of cookies in ASP.NET.

Latest answer: There are two types of cookies in ASP.NET -Single valued cookies................Read answer

What are the ways to retain variables between requests?

Latest answer: Following are the ways to retain variables between requests:Context.Handler -This object can be used to retrieve public members of the web form from a subsequent web page...........Read answer

Describe the Cookies collection in ASP.NET.

Latest answer: Cookies are text files that store information about the user. A user is differentiated from the other by the web server with the help of the cookies. It can also determine where the user had been before with them............. Read answer

What is the Common Language Specification (CLS)?

Latest answer: The CLS contains constructs and constraints which provides a guideline for library and compiler writers.Any language that supports CLS can then use the libraries due to whic the languages can integrate with each other................Read answer

Test your ASP.NET knowledge with our multiple choice questions!

Part 1 | Part 2 | Part 3 | Part 4 | part 5 | part 6 | part 7 | part 8 | part 9  

Next>>

Page 21: ASP.net My Tutorial