Floating FB popout byF5debug

Interview Questions and Answers on .Net Framework, OOPS, ASP.Net, C#.Net, SQL Server, WCF Series – Part 24


Question 231 - What is the use of <compilation> tag in ASP.Net Web.Config File?

  • Compilation tag configure the settings of the compiler.
  • debug and defaultLanguage are the common attributes used.
  • Setting debug to true means we want the debugging information in the browser, but it has a performance tradeoff, so normally, it is set as false.
  • The defaultLanguage attribute tells ASP.NET which language compiler to use: VB or C#.

Question 232 - What is the use of <customErrors> tag in ASP.Net Web.Config File?

  • Custom Error tags includes the error settings for the application, and is used to give custom error pages (user-friendly error pages) to end users.
  • If an error occurs then, the website is redirected to the default URL.
  • For enabling and disabling custom errors, we need to specify the mode attribute.
  • Example of <customErrors> tag:
    <customErrors defaultRedirect="url" mode="Off">
      <error statusCode="403" redirect="/accesdenied.html" />
      <error statusCode="404" redirect="/pagenotfound.html" />
  • "On" means if there is any error, the website is redirected to the default URL.
    "Off" means the custom errors are disabled.
    "RemoteOnly" shows that custom errors will be shown to remote clients only.

Question 233 - What is the use of <globalization> tag in ASP.Net Web.Config File?

  • Globalization tag is used when we want to use encoding or specify a culture for the application.
  • We need to define the character set for the server to send the response to the client, which is by default is UTF-8, and the settings of which the server should use to interpret and display culturally specific strings, such as numbers and dates.
  • Example of <globalization> tag
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />

Question 234 - What is the use of <httpRuntime> tag in ASP.Net Web.Config File?

  • Httpruntime tag can be used to configure the general runtime settings of the application.
    The 2 main settings are: <httpRuntime appRequestQueueLimit="50" executionTimeout="600" />
  • The appRequestQueueLimit attribute defines the number of requests that can be queued up on the server for processing. If there are 51 or more requests, then server would return the 503 error ("Server too busy").
  • The executionTimeout attribute defines the number of minutes ASP.NET will process a request before it gets timeout.

Question 235 - What is the use of <trace> tag in ASP.Net Web.Config File?

  • Trace tag is used for tracing the execution of an application.
  • We have here two levels of tracing: page level and application level.
  • Application level enables the trace log of the execution of every page available in the application. If pageOutput="true", trace information will be displayed at the bottom of each page. Else, we can view the trace log in the application root folder, under the name trace.axd.
  • Example of <trace> tag
    <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
    Set the attribute localOnly to false for not viewing the trace information from the client. For enabling trace at page level, set Trace="True" in the Page tag (on the top of the page).

Question 236 - What is the use of <identity> tag in ASP.Net Web.Config File?

Identity tag is used to control the identity of the application. By default, Impersonation is disabled. Using Impersonation, an ASP.NET application can execute optionally with the identity of a client on whose behalf they are operating.
<identity impersonate="false" userName="domain\username" password="password" />

Question 237 - What is the use of <sessionState> tag in ASP.Net Web.Config File?

  • Sessionstage tag is used to tell the ASP.NET framework where to store the session. By default, it's inproc which means storing the session values on the server. But we have four options:
  • "Off" means session is not enabled for the application.
    "inproc" means storing the session values on the server.
    "StateServer" means session states are stored in a remote server.
    "SQLServer" means session states are stored in a SQL Server database. For this, we need to install the InstallSQLState.sql script in the SQL Server database. It is mainly used when the we use web farms (an application deployed on multiple servers), but it makes the performance slow as compared to "inproc".
  • Other Basic Settings:
    "cookieless": when it is true, it means the session used is without cookies.
    “timeout” specifies after how much time the session would expire 
    "stateConnectionString" needs to be specified when the session mode is StateServer.
    "sqlConnectionString" is connection string of the SQL Server database if the session mode is SQLServer.
    "stateNetworkTimeout" attribute, when using the StateServer mode to store session state, specifies the number of seconds the TCP/IP network connection between the web server and the state server can be idle before the session is abandoned. The default is 10.
  • Example
    <sessionState mode="Off"   cookieless="true"
         sqlConnectionString="sql connection string"
         stateNetworkTimeout="number of seconds"/>

Question 238 - What is the use of <appSettings> tag in ASP.Net Web.Config File?

  • AppSetting tag is used to store custom application configuration like database connection strings, file paths etc.
  • This also can be used for custom application-wide constants to store information over multiple pages. It is based on the requirements of the application.
  • Example:
        <add key="Emailto" value="me@microsoft.com" />
        <add key="cssFile" value="CSS/text.css" />
    It can be accessed from code like:
    ConfigurationSettings.AppSettings("Emailto"); All the values returned from it are strings.

Question 239 - What is HTTP GET in ASP.Net?

  • In HTTP GET method data passed through url QueryString using name value pair. It’s simpler and you can troubleshoot any problems simply by looking at the address bar in your browser because all values passed are displayed there.
  • This is also the primary weakness of this method. The data being passed is visible and is limited in size to the maximum length of a request string.

Question 240 - What is HTTP POST in ASP.Net?

  • In HTTP POST request data are embedded in a HTTP HEADER.  So data are NOT visible to end user while you can see the data passed in HTTP GET method. 
  • If you want to pass sensitive information/data, you should have to use HTTP POST request. Another advantage is that you can send larger amounts of information compare to HTTP GET method.

Disclaimer – F5debug Interview Questions & Answers Series:

You may recopy extracts from these pages ("the material") to individual third party websites or to any intranet websites, but only if:
You acknowledge www.f5debug.net as the source of the material. Such acknowledgment should include reference to www.f5debug.net in the copy of the material and should also include “© Karthikeyan Anbarasan, www.f5debug.net ". You inform the third party that these conditions apply to him/her and that he/she must comply with them.

About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Add comment

  Country flag

  • Comment
  • Preview

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters


This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter