ASP.Net Interview Questions and Answers

    16 Votes

124) Which method is used to remove the cache object?

To remove the cache object we can use - cache.remove() method.

125) List down at least five Gridview events?

GridView Events are as below –
  • PageIndexChanging - This event will be fired when pager button is clicked and before Gridview control handles this operation.
  • PageIndexChanged - This event will be fired when pager button is clicked and after Gridview control handles this operation.
  • RowCommand - This event will be fired when any button is clicked in Gridview.
  • RowDataBound - This event will be fired when data is bounded to GridView.
  • RowCreated - This event will be fired when row is created in GridView.
  • RowDeleted - This event will be fired when row is deleted in GridView.
126) How many object are there in ASP.NET?
There are six objects are there in ASP.NET and they are following –
  • Session
  • Request
  • Response
  • Object Request
  • Server
  • Application
127) Why PDB files are useful?

PDB files are useful for debugging. PDB files contain the debug information and project information. When project is built under Debug mode PDB files are generated and it would not generate in Release mode. These files should not be included in production deployment.

128) What is ASP.NET membership?

ASP.NET membership allows you to store and validate the user credentials. Forms Authentication can be used for storing the user credentials in ASP.NET membership using login controls of ASP.NET. Membership supports storing user credentials in SQL Server , Active Directory etc.

129) How to disable Session at the Page Level?

<%@ Page language="c#" Codebehind="TestMyPage1.aspx.cs" 
AutoEventWireup="false" Inherits="WebApplication1.TestMyPage1 "
EnableSessionState="false" %>

Using “EnableSessionState” property we can disable the session at page level as shown above.

130) How we can handle SQL Exceptions in ASP.NET?

We can use try, catch and finally block for error handling. Use SqlException class to handle exceptions specific to SQL Server.

try
{
//some code
}
catch(SQLException ex)
{
//Handle SQL Exception
}

131) How to set maximum length of Textbox in ASP.NET?

Textbox maximum length can be controlled from “MaxLength” property. By default length of the textbox will be 65535.

132) How many validations can be applied on customer’s “Age” field?

Two validations can be applied for this field and they are –

  • Required – For checking mandatory value.
  • Range – For checking the age range, age should be between the ranges.

133) What is the difference between Web Services and Remoting?

Both these applications support distributed applications.

  • Remoting is used to talk in binary format and is not cross platform. It expects consumer to be .NET application. It uses SMTP, HTTP and TCP protocols for communication.
  • Web Services can be either WCF or XML Web Services. Web Services are hosted in internet and it is cross platform. Client will be created for using web service and client can consume the methods of web service.

134) Why to use web.sitemap in ASP.NET?

For using navigation controls like menu, treeview etc we have to define xmlsitemap, which is called web.sitemap.

Eg : 
<?xml version="1.0" encoding="utf-8"?>
<siteMap
xmlns=" ">
<siteMapNode url="~/Home.aspx" title="Home" description="">
<siteMapNode url="~/ About.aspx" title="About"
description=""/>
<siteMapNode url="~/ Details.aspx" title="Details"
description=""/>
<siteMapNode url="~/ Contact.aspx" title="Contact"
description="" >
<siteMapNode url="~/ Comment.aspx" title="Comment"
description=""/>
</SiteMapNode>
</SiteMapNode>
</SiteMap>

135) Is it possible to use multiple web.config files of ConnectionString in one page?

Yes. We can have multiple web.config in an application. But these web.config files should be under different folders, it should not be in same place in an application.

136) Why to use UpdatePanel control in AJAX ASP.NET?

AJAX is a client side technology and it supports asynchronous communication between client and server. If the part of page need to be refreshed, then we can use this Update panel control, which uses AJAX request and does not harm the other part of the page.

137) How can I disable the Session at page level and at the application level?

Disabling Session at page level –

<%@ Page language="c#" Codebehind="MyPageTesting1.aspx.cs" 
AutoEventWireup="false" Inherits="WebApplication1. MyPageTesting1"
EnableSessionState="false" %>

Disabling Session at application level – This can be done in Web.Config of our application in following way.

<sessionstate mode="off"> under <system.web>
Page 9 of 10

Popular Videos

communication

How to improve your Interview, Salary Negotiation, Communication & Presentation Skills.

Got a tip or Question?
Let us know

Related Articles

C# Interview Questions
.Net Framework Interview Questions and Answers
ADO.Net Interview Questions and Answers for Freshers, Experienced
ASP.Net MVC Interview questions and Answers
WCF Interview Questions and Answers
ASP.Net Web API Interview Questions
Top 50 Entity framework interview questions & answers