SimpleInterviewQuestions

1. Asp.net Page Lifecycle

Page Preinit

This will be executed before memory initialization for web page [before

Constructing web page]

 

Attaching theme master page dynamically to webpage is possible using preinit

Event proc

Page init

 

This will be executed when memory is initialized for webpage

Page load

This will be executed when submitted data and controls are loaded

Database connectivity reading submitted data can be placed within page load

Page Prerender

This will be executed before rendering html content from server side control

Control behavior can be changed b4 producing client side control

Page Unload

This will be executed once memory is released for webpage

Closing database connection

 

2. State management:

Question - Define state management in ASP.NET.

Answer - State management is implemented in order to retain information about the user requests. Web pages are stateless. Each request creates new page without retaining any previous information about the user requests. ASP.NET supports several State management techniques to maintain state information.

State management in ASP.NET can be classified into
Client-side state management
Server-side state management

Question - Define each mechanism of Client-side state management and Server-side state management.

Answer - Client-side state management
this maintains information on the client's machine using Cookies,
View State, and Query Strings.

Cookies.
A cookie is a small text file on the client machine either in the client's file system or memory of client browser session. Cookies are not good for sensitive data. Moreover, Cookies can be disabled on the browser. Thus, you can't rely on cookies for state management.

View State
Each page and each control on the page has View State property. This property allows automatic retention of page and controls state between each trip to server. This means control value is maintained between page post backs. View state is implemented using _VIEWSTATE, a hidden form field which gets created automatically on each page. You can't transmit data to other page using view state.

Query string
Query string can maintain limited state information. Data can be passed from one page to another with the URL but you can send limited size of data with the URL. Most browsers allow a limit of 255 characters on URL length. Server-side state management
this kind of mechanism retains state in the server.

Application State
the data stored in an application object can be shared by all the sessions of the application. The application object stores data in the key value pair.

Session State
Session state stores session-specific information and the information is visible within the session only. ASP.NET creates unique session Id for each session of the application. Session IDs are maintained either by an HTTP cookie or a modified URL, as set in the application's configuration settings. By default, Session ID values are stored in a cookie.

3. Difference between Server.Transfer and response. Redirect.

Following are the major differences between them:-

Server.Transfer

  • The browser is directly redirected to another page
  • There is no round trip
  • A Server transfer is possible within a website
  • Information can be preserved in Server transfer through a parameter called preserveForm

Response. Redirect

The browser is requested to redirect to some other page through a message.

  • There is a round trip.
  • Response redirect is possible within two websites too.
  • A state can be maintained in Response redirect but has a lot of drawbacks

4. What’s a bubbled event?

Bubble event is that control handled by another control means as data grid is control by combo box selection or another control.

5.What is Web.Config File?

Web.config file, as it sounds like is a configuration file for the Asp .net web application. An Asp .net application has one web.config file which keeps the configurations required for the corresponding application. Web.config file is written in XML with specific tags having specific meanings.

There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file..

1.      Database connections

2.      Session States

3.      Error Handling

4.      Security

6. What is Machine.config File?

   As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.

 

7. ASP.NET Authentication

                Authentication is the process of obtaining identification credentials from a user ( such as name and password ), and validating those credentials against some authority.

 

1.      Windows-based authentication, ASP.NET uses Windows-based authentication in conjunction with IIS authentication.
With Windows-based authentication, the user requests a secure Web page from the Web application, and the request then goes through IIS. If the user’s credentials do not match those of an authorized user, IIS rejects the request. The user then has to enter his or her name and password into the logon form. The credentials are again verified by IIS. If correct, IIS directs the original request to the Web application. The secure Web page is then returned to the user

2.      Forms-based authentication refers to a system where non-authenticated requests are redirected to a Hypertext Markup Language (HTML) form by using Hypertext Transfer Protocol (HTTP) client-side redirection. The user provides credentials and submits the form. If the application validates the credentials on the form, the system issues an authentication cookie to the user. Subsequent requests from the user are issued with the authentication cookie in the request headers, and then the user is authenticated based on those request headers.

3. Microsoft Passport authentication is a centralized authentication service that offers a single logon option and core profile services for member sites. Users who sign up to use Passport are authenticated for access to Web sites through a single Passport account. Microsoft Passport is an XML Web service, and it is an integral part of the .NET Framework

 

           8. Application Variable

 

Application Variables are actually global variables for each application..you can share these variables through out the applications..the life time of the application variables span thro the life time of the application until the application is unloaded.

 

9. Session variable


And the session variables are used to store the User based unique values..and you can set the time limit to store the values in the session state variables..

 

10. Example of Polymorphism in .Net

What is Polymorphism?
Polymorphism means same operation may behave differently on different classes.
Example of Compile Time Polymorphism: Method Overloading
Example of Run Time Polymorphism: Method Overriding

Example of Compile Time Polymorphism

Method Overloading
- Method with same name but with different arguments is called method overloading.
- Method Overloading forms compile-time polymorphism.
- Example of Method Overloading:
class A1
{
void hello()
{ Console.WriteLine(“Hello”); }

void hello(string s)
{ Console.WriteLine(“Hello {0}”,s); }
}


Example of Run Time Polymorphism

Method Overriding
- Method overriding occurs when child class declares a method that has the same type arguments as a method declared by one of its superclass.
- Method overriding forms Run-time polymorphism.
- Note: By default functions are not virtual in C# and so you need to write “virtual” explicitly. While by default in Java each function are virtual.
- Example of Method Overriding:
Class parent
{
virtual void hello()
{ Console.WriteLine(“Hello from Parent”); }
}

Class child : parent
{
override void hello()
{ Console.WriteLine(“Hello from Child”); }
}

static void main()
{
parent objParent = new child();
objParent.hello();
}
//Output
Hello from Child.

 

11 - What is AJAX?

A - Ajax stands for Asynchronous Javascript & XML. It is a web technology through which a postback from a client (browser) to the server goes partially, which means that instead of a complete postback, a partial postback is triggered by the Javascript XmlHttpRequest object. In such a scenario, web-application users won't be able to view the complete postback progress bar shown by the browser. In an AJAX environment, it is Javascript that starts the communication with the web server.
Ajax technology in a website may be implemented by using plain Javascript and XML. Code in such a scenario may tend to look little complex, for which the AJAX Framework in .NET can be embedded in ASP.NET web applications.
In addition to XML & Javascript,
AJAX is also based on DOM - the Document Object Model technology of browsers through which objects of the browser can be accessed through the memory heap using their address.
JSON - Javascript Object Notation is also one of the formats used in
AJAX, besides XML.
So basically, in an AJAX-based web application, the complete page does not need to reload, and only the objects in context of ajaxification are reloaded.
Ajax technology avoids the browser flickering.

12.What is the ASP.NET Ajax Framework?

A - ASP.NET AJAX is a free framework to implement Ajax in asp.net web applications, for quickly creating efficient and interactive Web applications that work across all popular browsers.
The Ajax Framework is powered with
1 - Reusable Ajax Controls
2 - Support for all modern browsers
3 - Access remote services and data from the browser without tons of complicated script.
Versions of
Ajax release

1 - ASP.NET Ajax Framework 1.0 (earlier release to this was called the Atlas)
2 - ASP.NET Ajax Framework 1.0 was available as a separate download for ASP.NET 2.0