1. What is IIS?
Internet Information Services (IIS) turns a computer into a web server that can provide World Wide Web publishing services, File Transfer Protocol (FTP) services, Simple Mail Transport Protocol (SMTP) services, and Network News Transfer Protocol (NNTP) services. We can use IIS to host and manage Web sites and other Internet content once we obtain an IP address, register our domain on a DNS server, and configure our network appropriately. IIS is a component of the Microsoft Windows operating system.
2. What is the current version of IIS & new thing in it?
IIS 10.0 is the latest version of Internet Information Services (IIS).IIS 10.0 adds support for the HTTP/2 protocol, which allows for numerous enhancements over HTTP 1.1 and results in an efficient reuse of connections and a reduction in latency.
3. What is the role of IIS Web Server in the ASP.NET Page Life Cycle?
Internet Information Services (IIS) supports a variety of resources that let developers create applications to configure, manage, and extend the functionality of IIS servers and Web applications that run on IIS servers.
4. What are the different IIS isolation levels?
IIS has three levels of isolation:-
Low (IIS Process):- In this main IIS process and ASP.NET application run in the same process due to which if one crashes, the other is also affected.
Medium (Pooled):- In Medium pooled scenario the IIS and web application run in a different process.
High (Isolated):-In high isolated scenarios every process is running is their own process. This consumes heavy memory but has the highest reliability.
5. What are the different namespaces in ASP.NET?
6. How to check IIS is installed or not in our system?
Go to Start->Run type inetmgr and press OK. If we get an IIS configuration screen. It is installed, otherwise, it is not installed
We can also check ControlPanel->Add Remove Programs, Click Add Remove Windows Components and look for IIS in the list of installed components.
7. What is ISAPI?
An interface that resides on an IIS server for the purpose of initiating software services that are tuned for the Windows operating system. ISAPI is an API for developing extensions to Internet Information Services (IIS) and other Hypertext Transfer Protocol (HTTP) services that support the ISAPI interface. When an ISAPI DLL is used to generate content to display to a client, it executes faster than an ASP page (which is not compiled code) or a COM component.
However, since ISAPI DLLs can only be written in C/C++, they are more difficult to develop.
8. What is the meaning of Page Life cycle?
When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering.
9. How the request is handled by IIS?
When we hit a URL on the browser, we are requesting something from the browser, which means indirectly we are requesting something from the Web Server that means IIS. IIS, based on the file extension, decides which ISAPI extension can serve the request.
And in the case of ASP.Net (.aspx) it will be aspnet_isapi_dll so the request is passed to it for processing.
10. What happens when we hit a url on browser?
When we are requesting something from the browser, which means indirectly we are requesting something from the Web Server that means IIS. IIS, based on the file extension, which decides which ISAPI extension can serve the request.
And in the case of ASP.Net (.aspx) it will be aspnet_isapi_dll so the request is passed to it for processing.
And finally we get the response in terms of rendered HTML.
11. What are the events which fire during ASP.NET page life cycle?
12. What are Httphandlers and HttpModules?
HTTP Modules:
HTTP Modules are plugged into the life cycle of a request. So when a request is processed it is passed through all the modules in the pipeline of the request. So generally http modules are used for:
HTTP Handler is the process that runs in response to an HTTP request. So whenever a user requests a file it is processed by the handler based on the extension. So, custom http handlers are created when we need special handling based on the file name extension.
13. When to use HTTP handlers?
RSS feeds: To create an RSS feed for a Web site, we can create a handler that emits RSS-formatted XML. We can then bind a file name extension such as .rss to the custom handler. When users send a request to your site that ends in .rss, ASP.NET calls our handler to process the request.
Image server: If we want a Web application to serve images in a variety of sizes, we can write a custom handler to resize images and then send them to the user as the handler’s response.
14. How to develop an ASP.NET handler?
First, we have to implement IHttpHandler interface
public class MyHandler: IHttpHandler
{
public bool IsReuseble
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{}
15. How many times the HTTP handler will be called?
During the processing of an HTTP request, only one HTTP handler will be called.
16. What is the main work of the HTTP Handler?
HTTP Handler actually processes the request and produces the response.
17. What are the Methods and Properties of HTTP Handler?
Process Request: This method is called when processing asp.net requests. Here we can perform all the things related to processing requests.
IsReusable: This property is to determine whether the same instance of HTTP Handler can be used to fulfill another request of the same type.
18. How do we write an HttpModule?
First, we have to imlement httpMoudule with inherit IHttpModule
public class HttpModule : IHttpModule
{
public void Init(HttpApplication context)
{
this.httpApp = context;
httpApp.Context.Response.Clear();
httpApp.AuthenticateRequest += new EventHandler(OnAuthentication);
}
voidOnAuthorization(object sender, EventArgs a)
{ //Implementation }
19. In which event are the controls fully loaded?
Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but we will see that view state is not fully loaded during this event.
20. How can we identify that the Page is Post Back?
Using the Ispostback Property we can identify the page is postback or not like. Ispostback = True/False.
21. What is the use of @ Register directives?
@Register directive informs the compiler of any custom server control added to the page.
22. What is the use of Smart Navigation property?
It’s a feature provided by ASP.NET to prevent flickering and redrawing when the page is posted back.
Note: This is only supported for the IE browser. Project with browser compatibility requirements have to think of other ways to avoid flickering.
23. What is the concept of Postback in ASP.NET?
A Postback is a request sent from a client to server from the same page user is already working with.
24. What is View State in ASP.NET?
View state is the method that the ASP.NET page framework uses to preserve page and control values between round trips. When the HTML markup for the page is rendered, the current state of the page and values that must be retained during post back are serialized into base64-encoded strings. This information is then put into the view state hidden field or fields.
25. Difference between IsPostBack and IsCallback?
Page.IsCallback: It is getting a value indicating whether the page request is the result of a call back. Its a special postback, so a round-trip always occurs; however, unlike the classic postback, the script callback doesn't redraw the whole page. ViewState is not updated during a callback, it is for postback.
Page.IsPostBack: Checks whether the Page is accessing the server for the first time or not. Unlike the IsCallBack, the ViewState is updated.
Page.IsPostback property will return true for both request types. The Page.IsCallback property will return true only when the request is a client callback.
26. Difference between Control State vs View State?
The ViewState and ControlState both stores the control properties, we can disable the ViewState Property only and that will not affect the ControlState at all which loads in the page first loading or if the page is postBack the control state already loads from saved memory.
Use control state only for small amounts of critical data that are essential for the control across postbacks. Do not use the control state as an alternative to view state.
27. Difference between Response.Redirect and Server.Transfer?
In case of Response.Redirect, a new request is generated from the client-side for the redirected page. It’s a kind of additional round trip. As new request is generated from client, so the new URL is visible to the user in the 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, the URL remains the same in the browser even after transferring to another page.
28. What is the use of "Global.asax" file?
Global.asax is basically ASP.NET Application file. It’s a place to write code for Application-level events such as Application start, Application end, Session start and end, Application error etc. raised by ASP.NET or by HTTP Modules.
29. What are the events in Global.asax?
Application_Init occurs in case of application initialization for the very first time.
Application_Start fires on application start.
Session_Start fires when a new user session starts
Application_Error occurs in case of an unhandled exception generated from application.
Session_End fires when user session ends.
Application_End fires when application ends or time out.
30. What is the difference between Render and PreRender event?
PreRender: This event used for modifying server controls just before sending them down to the client.
Render: This event is used to put the HTML output to the response stream.
31. What is the sequence in which ASP.NET events are processed?
Following is the sequence in which the events occur:
Note: Page_init event only occurs when the first time the page is started, but Page Load occurs in subsequent requests of the page.
32. What is event bubbling?
Server controls like DataGrid, DataList, and Repeater can have other child controls inside them. For example, DataGrid can have a Combobox inside DataGrid. These child controls do not raise their events by themselves, rather they pass the event to the container parent (which can be a DataGrid, DataList, Repeater), which are passed to the page as an ItemCommand event. As the child control sends events to the parent it is termed as event bubbling.
33. How do we assign page specific attributes?
Page attributes are specified using the @Page directive.
34. How do we ensure the view state does not tamper?
Using the @Page directive and setting the EnableViewStateMac property to true.
35. Where is the ViewState information stored?
In the HTML hidden fields.
36. What do you mean by AutoPostBack?
If we want the control to automatically post back in case of an event, we will need to check this attribute as true. For example, on a ComboBox change, we need to send the event immediately to the server-side then set the AutoPostBack attribute to true.
37. What is the difference between Web.config and Machine.Config?
Web.config files apply settings to each web application, while Machine.config file applies settings to all ASP.NET applications.
38. What is a SESSION and APPLICATION object?
The Session object stores information between HTTP requests for a particular user, while the Application object is global across users.
39. What is ASP?
Active Server Pages (ASP), also known as Classic ASP, is Microsoft's server-side technology, which helps in creating dynamic and user-friendly Web pages. It uses different scripting languages to create dynamic Web pages, which can be run on any type of browser. The Web pages are built by using either VBScript or JavaScript and these Web pages have access to the same services as Windows application, including ADO (ActiveX Data Objects) for database access, SMTP (Simple Mail Transfer Protocol) for e-mail, and the entire COM (Component Object Model) structure used in the Windows environment. ASP is implemented through a dynamic-link library (asp.dll) that is called by the IIS server when a Web page is requested from the server.
40. What is ASP.NET?
ASP.NET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services. It is a part of the .NET Framework. We can create ASP.NET applications in most of the .NET compatible languages, such as Visual Basic, C#, and J#. The ASP.NET compiles the Web pages and provides much better performance than scripting languages, such as VBScript. The Web Forms support to create powerful forms-based Web pages. We can use ASP.NET Web server controls to create interactive Web applications. With the help of Web server controls, we can easily create a Web application.
or
"ASP.NET is a web application development framework for building web sites and a web application that follows objects oriented programming approach".
41. What is an ASP.NET Web Form?
ASP.NET Webforms are designed to use controls and features that are almost as powerful as the ones used with Windows forms, and so they are called as Web forms. The Webform uses a server-side object model that allows us to create functional controls, which are executed on the server and are rendered as HTML on the client. The attribute, runat="server", associated with a server control indicates that the Webform must be processed on the server.
42. Which two new properties are added in ASP.NET 4.0 Page class?
The two new properties added in the Page class are MetaKeyword and MetaDescription.
43. Which method has been introduced in ASP.NET 4.0 to redirect a page permanently?
The RedirectPermanent() method added in ASP.NET 4.0 to redirect a page permanently. The following code snippet is an example of the RedirectPermanent() method:
RedirectPermanent("/path/Aboutus.aspx");
44. What are the events that happen when a client requests an ASP.NET page from the IIS server?
The following events happen when a user requests an ASP.NET page from the IIS server:
45. What are the major built-in objects in ASP.NET?
The major built-in objects in ASP.NET are as follows:
46. What is the code-behind feature in ASP.NET?
The code behind feature divides ASP.NET page files into two files where one defines the user interface (.aspx), while the other contains all of the logic or code (.aspx.cs for C# and .aspx.vb for VB.NET).
These two files are glued together with page directives like the following line, which ties the page to the specific code-behind class.
47. What is the difference between ASP Session and ASP.NET session?
ASP does not support cookie-less sessions; whereas, ASP.NET does. In addition, the ASP.NET session can span across multiple servers.
48. What is web.config file in asp.net?
Web.config is the main settings and configuration file for an ASP.NET web application. The file is an xml document that defines configuration information regarding the web application. This file stores information about how the web application will act.
49. Does web.config file case-sensitive?
Yes.
50. Can one directory contain multiple web.config files?
No. One directory can contain only one file.
51. Can you tell the location of the root web.config file from which all web.config file inherit?
All the Web.config files inherit the root Web.config file available at the following location systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Web.config
52. What is the root tag of web.configfile?
<configuration> tag is the root element of the Web.config file under which it has all the remaining sub-elements.
53. What is the use of customErrors tag in web.config file?
CustomErrors tag provides information about custom error messages for an ASP.NET application. The customErrors element can be defined at any level in the application file hierarchy.
Code:
<customErrors defaultRedirect ="Error.aspx" mode ="Off">
<error statusCode ="401" redirect ="Unauthorized.aspx"/>
</customErrors>
54. What is the authentication tag/section in web.config?
ASP.NET supports the following authentication providers:
To enable an authentication provider for an ASP.NET application, use the authentication element in either machine.config or Web.config as follows:
Code:
<system.web>
<!-- mode=[Windows|Forms|Passport|None] -->
<authentication mode="Windows" />
</system.web>
55. For which purpose you use <appSettings> tag?
appSettings tag helps us to store the application settings information like connection strings, file paths, URLs, port numbers, custom key-value pairs, etc.
Ex:-
Code:
<appSettings>
<add key="ConString" value="Data Srouce=....."/>
</appSettings>
56. What is the use of connectionStrings tag?
<connectionStrings> is the most common section of web.config file which allows you to store multiple connection strings that are used in the application.
Code:
<connectionStrings>
<add name ="ConString" connectionString ="Initial Catalog = abc;
Data Source =localhost; Integrated Security = true"/>
</connectionStrings>
57. How would you enable impersonation in the web.config file?
In order to enable the impersonation in the web.confing file, take the following steps:
Include the <identity> element in the web.config file.
Set the impersonate attribute to true as shown below:
<identity impersonate = "true" />
58. Will an application execute, if web.config file is not present with that particular application?
It means that the default configuration will be loaded from MACHINE.CONFIG file.
it is something like if we had not defined the web.config the application will take the settings from the machine.config.the machine.config settings are overridden by the web.config if we define the web.config for each running app.
In 2005 The VS When we trying to run the first time any application the 2005 VS gives us a warning that wants to run an application without web.config file.
Internet Information Services (IIS) turns a computer into a web server that can provide World Wide Web publishing services, File Transfer Protocol (FTP) services, Simple Mail Transport Protocol (SMTP) services, and Network News Transfer Protocol (NNTP) services. We can use IIS to host and manage Web sites and other Internet content once we obtain an IP address, register our domain on a DNS server, and configure our network appropriately. IIS is a component of the Microsoft Windows operating system.
2. What is the current version of IIS & new thing in it?
IIS 10.0 is the latest version of Internet Information Services (IIS).IIS 10.0 adds support for the HTTP/2 protocol, which allows for numerous enhancements over HTTP 1.1 and results in an efficient reuse of connections and a reduction in latency.
3. What is the role of IIS Web Server in the ASP.NET Page Life Cycle?
Internet Information Services (IIS) supports a variety of resources that let developers create applications to configure, manage, and extend the functionality of IIS servers and Web applications that run on IIS servers.
4. What are the different IIS isolation levels?
IIS has three levels of isolation:-
Low (IIS Process):- In this main IIS process and ASP.NET application run in the same process due to which if one crashes, the other is also affected.
Medium (Pooled):- In Medium pooled scenario the IIS and web application run in a different process.
High (Isolated):-In high isolated scenarios every process is running is their own process. This consumes heavy memory but has the highest reliability.
5. What are the different namespaces in ASP.NET?
- System.Data.Odbc
- System.Data.OleDb
- System.Data.OracleClient
- System.Data.Services
- System.Data.Services.BuildProvider
- System.Data.Services.Client
- System.Data.Sql
- System.Data.SqlClient
- System.Data
- System.Data.Design
6. How to check IIS is installed or not in our system?
Go to Start->Run type inetmgr and press OK. If we get an IIS configuration screen. It is installed, otherwise, it is not installed
We can also check ControlPanel->Add Remove Programs, Click Add Remove Windows Components and look for IIS in the list of installed components.
7. What is ISAPI?
An interface that resides on an IIS server for the purpose of initiating software services that are tuned for the Windows operating system. ISAPI is an API for developing extensions to Internet Information Services (IIS) and other Hypertext Transfer Protocol (HTTP) services that support the ISAPI interface. When an ISAPI DLL is used to generate content to display to a client, it executes faster than an ASP page (which is not compiled code) or a COM component.
However, since ISAPI DLLs can only be written in C/C++, they are more difficult to develop.
8. What is the meaning of Page Life cycle?
When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering.
9. How the request is handled by IIS?
When we hit a URL on the browser, we are requesting something from the browser, which means indirectly we are requesting something from the Web Server that means IIS. IIS, based on the file extension, decides which ISAPI extension can serve the request.
And in the case of ASP.Net (.aspx) it will be aspnet_isapi_dll so the request is passed to it for processing.
10. What happens when we hit a url on browser?
When we are requesting something from the browser, which means indirectly we are requesting something from the Web Server that means IIS. IIS, based on the file extension, which decides which ISAPI extension can serve the request.
And in the case of ASP.Net (.aspx) it will be aspnet_isapi_dll so the request is passed to it for processing.
And finally we get the response in terms of rendered HTML.
11. What are the events which fire during ASP.NET page life cycle?
- PreInit
- Init
- InitComplete
- PreLoad
- Load
- LoadComplete
- PreRender
- Render
- UnLoad
- SaveStateComplete
12. What are Httphandlers and HttpModules?
HTTP Modules:
HTTP Modules are plugged into the life cycle of a request. So when a request is processed it is passed through all the modules in the pipeline of the request. So generally http modules are used for:
Security: For authenticating a request before the request is handled.
Statistics and Logging: Since modules are called for every request they can be used for gathering statistics and for logging information.
Custom header: Since the response can be modified, one can add custom header information to the response.
HTTP Handlers:HTTP Handler is the process that runs in response to an HTTP request. So whenever a user requests a file it is processed by the handler based on the extension. So, custom http handlers are created when we need special handling based on the file name extension.
13. When to use HTTP handlers?
RSS feeds: To create an RSS feed for a Web site, we can create a handler that emits RSS-formatted XML. We can then bind a file name extension such as .rss to the custom handler. When users send a request to your site that ends in .rss, ASP.NET calls our handler to process the request.
Image server: If we want a Web application to serve images in a variety of sizes, we can write a custom handler to resize images and then send them to the user as the handler’s response.
14. How to develop an ASP.NET handler?
First, we have to implement IHttpHandler interface
public class MyHandler: IHttpHandler
{
public bool IsReuseble
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{}
15. How many times the HTTP handler will be called?
During the processing of an HTTP request, only one HTTP handler will be called.
16. What is the main work of the HTTP Handler?
HTTP Handler actually processes the request and produces the response.
17. What are the Methods and Properties of HTTP Handler?
Process Request: This method is called when processing asp.net requests. Here we can perform all the things related to processing requests.
IsReusable: This property is to determine whether the same instance of HTTP Handler can be used to fulfill another request of the same type.
18. How do we write an HttpModule?
First, we have to imlement httpMoudule with inherit IHttpModule
public class HttpModule : IHttpModule
{
public void Init(HttpApplication context)
{
this.httpApp = context;
httpApp.Context.Response.Clear();
httpApp.AuthenticateRequest += new EventHandler(OnAuthentication);
}
voidOnAuthorization(object sender, EventArgs a)
{ //Implementation }
19. In which event are the controls fully loaded?
Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but we will see that view state is not fully loaded during this event.
20. How can we identify that the Page is Post Back?
Using the Ispostback Property we can identify the page is postback or not like. Ispostback = True/False.
21. What is the use of @ Register directives?
@Register directive informs the compiler of any custom server control added to the page.
22. What is the use of Smart Navigation property?
It’s a feature provided by ASP.NET to prevent flickering and redrawing when the page is posted back.
Note: This is only supported for the IE browser. Project with browser compatibility requirements have to think of other ways to avoid flickering.
23. What is the concept of Postback in ASP.NET?
A Postback is a request sent from a client to server from the same page user is already working with.
24. What is View State in ASP.NET?
View state is the method that the ASP.NET page framework uses to preserve page and control values between round trips. When the HTML markup for the page is rendered, the current state of the page and values that must be retained during post back are serialized into base64-encoded strings. This information is then put into the view state hidden field or fields.
25. Difference between IsPostBack and IsCallback?
Page.IsCallback: It is getting a value indicating whether the page request is the result of a call back. Its a special postback, so a round-trip always occurs; however, unlike the classic postback, the script callback doesn't redraw the whole page. ViewState is not updated during a callback, it is for postback.
Page.IsPostBack: Checks whether the Page is accessing the server for the first time or not. Unlike the IsCallBack, the ViewState is updated.
Page.IsPostback property will return true for both request types. The Page.IsCallback property will return true only when the request is a client callback.
26. Difference between Control State vs View State?
The ViewState and ControlState both stores the control properties, we can disable the ViewState Property only and that will not affect the ControlState at all which loads in the page first loading or if the page is postBack the control state already loads from saved memory.
Use control state only for small amounts of critical data that are essential for the control across postbacks. Do not use the control state as an alternative to view state.
27. Difference between Response.Redirect and Server.Transfer?
In case of Response.Redirect, a new request is generated from the client-side for the redirected page. It’s a kind of additional round trip. As new request is generated from client, so the new URL is visible to the user in the 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, the URL remains the same in the browser even after transferring to another page.
28. What is the use of "Global.asax" file?
Global.asax is basically ASP.NET Application file. It’s a place to write code for Application-level events such as Application start, Application end, Session start and end, Application error etc. raised by ASP.NET or by HTTP Modules.
29. What are the events in Global.asax?
Application_Init occurs in case of application initialization for the very first time.
Application_Start fires on application start.
Session_Start fires when a new user session starts
Application_Error occurs in case of an unhandled exception generated from application.
Session_End fires when user session ends.
Application_End fires when application ends or time out.
30. What is the difference between Render and PreRender event?
PreRender: This event used for modifying server controls just before sending them down to the client.
Render: This event is used to put the HTML output to the response stream.
31. What is the sequence in which ASP.NET events are processed?
Following is the sequence in which the events occur:
- Page_Init
- Page load
- Control events
- Page unload event
Note: Page_init event only occurs when the first time the page is started, but Page Load occurs in subsequent requests of the page.
32. What is event bubbling?
Server controls like DataGrid, DataList, and Repeater can have other child controls inside them. For example, DataGrid can have a Combobox inside DataGrid. These child controls do not raise their events by themselves, rather they pass the event to the container parent (which can be a DataGrid, DataList, Repeater), which are passed to the page as an ItemCommand event. As the child control sends events to the parent it is termed as event bubbling.
33. How do we assign page specific attributes?
Page attributes are specified using the @Page directive.
34. How do we ensure the view state does not tamper?
Using the @Page directive and setting the EnableViewStateMac property to true.
35. Where is the ViewState information stored?
In the HTML hidden fields.
36. What do you mean by AutoPostBack?
If we want the control to automatically post back in case of an event, we will need to check this attribute as true. For example, on a ComboBox change, we need to send the event immediately to the server-side then set the AutoPostBack attribute to true.
37. What is the difference between Web.config and Machine.Config?
Web.config files apply settings to each web application, while Machine.config file applies settings to all ASP.NET applications.
38. What is a SESSION and APPLICATION object?
The Session object stores information between HTTP requests for a particular user, while the Application object is global across users.
39. What is ASP?
Active Server Pages (ASP), also known as Classic ASP, is Microsoft's server-side technology, which helps in creating dynamic and user-friendly Web pages. It uses different scripting languages to create dynamic Web pages, which can be run on any type of browser. The Web pages are built by using either VBScript or JavaScript and these Web pages have access to the same services as Windows application, including ADO (ActiveX Data Objects) for database access, SMTP (Simple Mail Transfer Protocol) for e-mail, and the entire COM (Component Object Model) structure used in the Windows environment. ASP is implemented through a dynamic-link library (asp.dll) that is called by the IIS server when a Web page is requested from the server.
40. What is ASP.NET?
ASP.NET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services. It is a part of the .NET Framework. We can create ASP.NET applications in most of the .NET compatible languages, such as Visual Basic, C#, and J#. The ASP.NET compiles the Web pages and provides much better performance than scripting languages, such as VBScript. The Web Forms support to create powerful forms-based Web pages. We can use ASP.NET Web server controls to create interactive Web applications. With the help of Web server controls, we can easily create a Web application.
or
"ASP.NET is a web application development framework for building web sites and a web application that follows objects oriented programming approach".
41. What is an ASP.NET Web Form?
ASP.NET Webforms are designed to use controls and features that are almost as powerful as the ones used with Windows forms, and so they are called as Web forms. The Webform uses a server-side object model that allows us to create functional controls, which are executed on the server and are rendered as HTML on the client. The attribute, runat="server", associated with a server control indicates that the Webform must be processed on the server.
42. Which two new properties are added in ASP.NET 4.0 Page class?
The two new properties added in the Page class are MetaKeyword and MetaDescription.
43. Which method has been introduced in ASP.NET 4.0 to redirect a page permanently?
The RedirectPermanent() method added in ASP.NET 4.0 to redirect a page permanently. The following code snippet is an example of the RedirectPermanent() method:
RedirectPermanent("/path/Aboutus.aspx");
44. What are the events that happen when a client requests an ASP.NET page from the IIS server?
The following events happen when a user requests an ASP.NET page from the IIS server:
- User requests for an application resource.
- The integrated request-processing pipeline receives the first user request.
- Response objects are created for each user request.
- An object of the HttpApplication class is created and allocated to the Request object.
- The HttpApplication class processes the user request.
45. What are the major built-in objects in ASP.NET?
The major built-in objects in ASP.NET are as follows:
- Application
- Request
- Response
- Server
- Session
- Context
- Trace
46. What is the code-behind feature in ASP.NET?
The code behind feature divides ASP.NET page files into two files where one defines the user interface (.aspx), while the other contains all of the logic or code (.aspx.cs for C# and .aspx.vb for VB.NET).
These two files are glued together with page directives like the following line, which ties the page to the specific code-behind class.
47. What is the difference between ASP Session and ASP.NET session?
ASP does not support cookie-less sessions; whereas, ASP.NET does. In addition, the ASP.NET session can span across multiple servers.
48. What is web.config file in asp.net?
Web.config is the main settings and configuration file for an ASP.NET web application. The file is an xml document that defines configuration information regarding the web application. This file stores information about how the web application will act.
49. Does web.config file case-sensitive?
Yes.
50. Can one directory contain multiple web.config files?
No. One directory can contain only one file.
51. Can you tell the location of the root web.config file from which all web.config file inherit?
All the Web.config files inherit the root Web.config file available at the following location systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Web.config
52. What is the root tag of web.configfile?
<configuration> tag is the root element of the Web.config file under which it has all the remaining sub-elements.
53. What is the use of customErrors tag in web.config file?
CustomErrors tag provides information about custom error messages for an ASP.NET application. The customErrors element can be defined at any level in the application file hierarchy.
Code:
<customErrors defaultRedirect ="Error.aspx" mode ="Off">
<error statusCode ="401" redirect ="Unauthorized.aspx"/>
</customErrors>
54. What is the authentication tag/section in web.config?
ASP.NET supports the following authentication providers:
- Windows (default)
- Forms
- Passport
- None
To enable an authentication provider for an ASP.NET application, use the authentication element in either machine.config or Web.config as follows:
Code:
<system.web>
<!-- mode=[Windows|Forms|Passport|None] -->
<authentication mode="Windows" />
</system.web>
55. For which purpose you use <appSettings> tag?
appSettings tag helps us to store the application settings information like connection strings, file paths, URLs, port numbers, custom key-value pairs, etc.
Ex:-
Code:
<appSettings>
<add key="ConString" value="Data Srouce=....."/>
</appSettings>
56. What is the use of connectionStrings tag?
<connectionStrings> is the most common section of web.config file which allows you to store multiple connection strings that are used in the application.
Code:
<connectionStrings>
<add name ="ConString" connectionString ="Initial Catalog = abc;
Data Source =localhost; Integrated Security = true"/>
</connectionStrings>
57. How would you enable impersonation in the web.config file?
In order to enable the impersonation in the web.confing file, take the following steps:
Include the <identity> element in the web.config file.
Set the impersonate attribute to true as shown below:
<identity impersonate = "true" />
58. Will an application execute, if web.config file is not present with that particular application?
It means that the default configuration will be loaded from MACHINE.CONFIG file.
it is something like if we had not defined the web.config the application will take the settings from the machine.config.the machine.config settings are overridden by the web.config if we define the web.config for each running app.
In 2005 The VS When we trying to run the first time any application the 2005 VS gives us a warning that wants to run an application without web.config file.
No comments:
Post a Comment