1. What are the asp.net page life cycle, name cycle?

Answer:

  1. PreInit()
  2. Init()
  3. InitComplete()
  4. PreLoad()
  5. Load()
  6. LoadComplete
  7. PreRender()
  8. Render()
  9. Unload()

2. What are the different Types of ASP.Net Validation Controls?

Answer:

RequireFieldValidator: validates for require filed or user input

RangeValidator: it validates the range of input filed like (0-9), (A-Z), (100-2000)

CompareValidator: it is used to compare the input control value with certain fixed value or another control value.

RegularExpressionValidator: it is use to express the input value as in required format or expression i.e. for formatting of phone number (e.g. 402-345-2344), date time format etc.

CustomValidator: it is used to customize the validation logic as needs of application logic.

      Validation Summary: displays all error message of validation controls on page.

3. What are the various way to send content from one page to another page?

Answer:

Server.Transfer()

Response.Redirect()

WebClient.DowloadFile()

4. What is difference between Server.Transfer() and Response.Redirect() and which is best?

Answer:

In case of Response.Redirect(), a new request is generated from client-side for redirected page. It’s a kind of additional round trip. As new request is generated from client, so the new URL is visible to user in browser after redirection.

While in case of Server.Transfer(), a request is transferred from one page to another without making a round trip from client. For the end user, URL remains the same in browser even after transferring to another page.

Reference

5. Why Html Helper prefer than Asp Control?

Answer: The reason of preferring Html helper is light weight though these are like ASP Controls.

6. What is the difference between Custom Control and User Control?

Answer:

Custom control are compiled code e.g: DLL. These are complex to create than User Controls and can easily added in toolbox. These can be used in multiple project with drag and drop approach.

The user controls i.e. (ascx) are like design pages i.e. (aspx). These are comparatively easy to create than custom control and are tight coupled with respect to code and UserInterface. These can be used in multiple project with copy and paste method.

7. What is Global.aspx file and purpose of it?

Answer:

Global.asax is Asp.net Application File. It is located under App_Start Folder.

Main Purpose of it is to place the Application Level code such as Application start, Application End, Session Start, Session End and Application Error handle.

Main Events fired in Global.asax file are

 Application_Init:  fires for application initialization for the very first time.

Application_Start: fires when application starts.

 Session_Start: fires when user session starts.

Application_Error:fire when there occurs error in application.

Session_End: fire when user session ends.

Application_End: fire at the time of application end or timeout

8. What are the Type of Authentication available in ASP.net?

Answer:

Windows Authentication:

Form Authentication:

Passport Authentication:

9. What are Session State Mode in Asp.net?

Answer:

In-Proc:

State Server:

SQLServer:

Custom

Off

10. What are session state management process in Asp.net?

    Answer:

In-Proc: Stores the session in Web server Memory.

Out Proc: Stores the session in different external server either in State Server or SQL Server.

11. What is Difference between Session.Abandon() and Session.Clear()?

 Answer:

Session.Abandon(): Session.Abandon() destroy the running session with firing of Session_End event from Global.asax file. It releases the Session State Object and its items to free resources. 

Seesion.Clear(): It only clears the session object’s data and set value to null without killing session. Resource becomes reserved with null value.

12. What are the different Types of Catching inAsp.net?

Answer:

There are 3 types of catching.

OutPut Catching

Data Catching

Fragment Catching

13. Can we have web application running without web.config file?

Answer:YES

14. Can we have multiple webconfig file in Asp.net Application?

Answer:Yes

15. Is it possible to create web application with Asp.net webforms and MVC?

Answer:YES

We can create the hybrid application of Webforms and MVC by using following assembly references.

System.Web.MVC

System.Web.Razor

System.ComponentModel.DataAnnotations

16. Write a sample code to send email from Asp.net Application.

Answer:

MailMessage mailMsg=new MailMessage();

mailMsg.From=”sender@gmail.com”;

mailMsg.To=”receiver@gmail.com”;

mailMsg.Subject=”Email sending test”;

mailMsg.Body=”Email testing.”;

SmtpMail.SmtpServer=”Localhost”;

Smtp.Send(mailMsg);

17. What is the good practice for implementation of validation in Asp.net?

Answer:

Client Side validation is best way to validate data in Asp.net application. Its Benefits are.

-Low network traffics.

-Save Server Resources.

-Fast Response

18. What are the differences between WebConfig and Machine Config file?

Answer:

WeConfig File: It is specific to web application. There can have multiple web config file into an application.

MachineConfig File: It is specific to machine or server. There can be only one MachineConfig File into an application.

Leave a Reply

Your email address will not be published.