ASP.NET Interview Questions and Answers (1544) - Page 53

You are developing DAL with an object-oriented approach and strongly-type data objects for your WCF application.

NOTE: This is objective type question, Please click question title for correct answer.
In which scenario WCF data services provides better result ?

You can select WCF data services when you

Want to implement the Data layer.
Want to access it from javascript.
Want to connect with database server by using HTTP protocol.
life span of items in the view-state

NOTE: This is objective type question, Please click question title for correct answer.
Difference between View State and Session

ViewState: We can hold the values in the viewstate and we can retrieve it wherever it is needed within a page.
The value will be saved on the client side.
Session : We can hold the values in the session and we can retrieve it back wherever it is needed in an application
The value will be saved on the server side.
how to disable right click on any web page or image?

In the body tag write property name oncontextmenu="return false"

this will stop right click on web page..

same thing write on img tag to disable right click ..
Difference between label and literal controls in asp.net?

label:
Label control renders text within span tag to browser. It is possible to apply style and style sheet class to label.
Literal:
Literal will render it's text that is assign to text property. It cannot render any additional html tag. Default mode for literal is “Transform”. Best practice to set Mode="Encode" for literal control

It is best practice to use literal instead of Label control wherever it possible in asp.net application.
Difference between Typed DataSet and UnTypedDataSet

Typed DataSet is a Custom class generated by visual studio
It adds things like named properties that match column and row data in the tables. It's generated code and not a part of .NET, so you can't use typed datasets without Visual Studio unless you copy all of the code and manually customize it for your project. An untyped dataset is an object of the DataSet class. It's a part of .NET and you can use it even if you don't have Visual Studio.
typed dataset is generally used as it is easy to use and moreover gives errors at compile time...compared to untyped which gives on run time
What is X.D.T ?

XML Document Transform (XDT) introduced in VS 2010, a simple and straight forward method of transforming web.config during publishing/packaging process.

It allows you to trransform any XML file, not just web.config
What is Page Inspector?

- Page Inspector is a new tool and has been shipped with Asp.net 4.5.
- It is a browser diagnostics tools to Visual Studio.
- It provides an integrated experience among the browser, ASP.NET, and source code.
- It renders a web page directly within the Visual Studio IDE and examine both the source code and the resulting output.
- Using this we can see what elements in the source files (including server-side code) have produced the HTML markup that is rendered to the browser.
- It also allows to modify CSS properties and DOM element attributes and see the changes reflected immediately in the browser.
What is ServiceStask ?

It really lightweight, easy to configure open source .NET and Mono REST Web Services framework.

It support multiple technologies: RPC / REST, SOAP 1.1/1.2, JSON / XML / CSV etc

Can be deployed as standalone service (console, Windows service, Linux daemon) also on IIS / Apache / Nginx etc.

Provides built-in OAuth providers for Twitter/Facebook.
Mention some differences between Asp.net and JSP

1) ASP.NET code can be written in any .NET complaint language, whereas, JSP pages can only be written in Java language and HTML.

2)ASP.NET pages support server controls, also called Web controls. Though these controls ASP .NET page can be linked with the database. JSP does not have any such provision.

3)ASP .NET forms retain their view state even when we move to the next page. This is not the case in JSP.

4)ASP.NET pages are compiled to a DLL, whereas, JSP pages are compiled to servlets.
What are the new improvements in AJAX Library in ASP.NET 4.0?

Following are some major improvements in the AJAX Library in ASP.NET 4.0.

Script Loader : The new script loader control enables developers to load all the required scripts only once, thereby eliminating the unnecessary subsequent requests to the server. It supports lazy loading so it loads scripts only when necessary. It also supports the jQuery script and custom scripts.

JQuery Integration : ASP.NET 4.0 extensively supports the integration for jQuery by mixing the jQuery and Ajax plug-ins seamlessly.

Client Data Access : By using predefined client controls inside the Ajax Library, developers can easily build asynchronous data-driven applications. For example, client DataView control will display one or more records by consuming a WCF service. All operations will be handled by the Ajax asynchronously.
What is Web.config file Refactoring provided in ASP.NET 4.0?

Web.config file contains configuration information for a web application has grown over the past few releases of the .NET Framework. So in .NET Framework 4, major configuration elements have been moved to the machine.config file. This allows the Web.config file to be empty or to specify only version of the framework which application is using.

<?xml version="1.0"?>
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
</configuration>
Difference between cookies and sessions

1> Cookies is client side(Browser) and session is server side
2>The main difference between cookies and sessions is that cookies are stored in the user's browser, and sessions are not.
3> A cookie can keep information in the user's browser until deleted.
3> The problem with sessions is that when you close your browser you also lose the session
5>Sessions work instead like a token allowing access and passing information while the user has their browser open.
Is it possible to host web site from desktop?

NOTE: This is objective type question, Please click question title for correct answer.
which statements is used to replace multiple if-else statements in code?

In Vb.Net the select case statement is used to replace multiple if-else statement.
and in c# the switch-case statement is used to replace multiple if-else statement.
In which events controls are fully loaded?

In page load events all controls are loaded
controls are accessed in page_init event but you see that view state is not fully loaded during this event
If i write system.exit(0);at the end of try block is finally block will execute?

No,the finally block can't execute in this case because when you mention system.exit(0);
the control goes out of the program and the finally block never execute.
Is validation is done by server side or client side validation?

NOTE: This is objective type question, Please click question title for correct answer.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories