Top 21 J2EE Interview Questions and Answers
March 3, 2015
10 Best Python Frameworks for Web Development
March 13, 2015
Show all

Top 15 ASP.Net Interview Questions and Answers

ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.

ASP.NET supports three different development models:
Web Pages, MVC (Model View Controller), and Web Forms.

The ASP.Net application codes could be written in either of the following languages:
1. C#
2. Visual Basic .Net
3. Jscript
4. J#

ASP.Net is used to produce interactive, data-driven web applications over the internet. It consists of a large number of controls like text boxes, buttons and labels for assembling, configuring and manipulating code to create HTML pages.

Top 15 ASP.Net Interview Questions and Answers

1. What is ASP?
Active Server Pages (ASP), is a Microsoft’s server-side technology, which helps in creating dynamic and user-friendly Web pages.

2. What is ASP.Net?
ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.

3. Advantage of ASP.net?
ASP.Net is the next generation of Microsoft’s Active Server Page (ASP) technology platform.

ASP.Net is superior to ASP in the following ways:
Compiled Code
Language Support
Strict Coding Requirements
Event-Driven Programming Model
Third-Party Controls
User Authentication
Easier Configuration & Deployment
Object and Page Caching
Higher Scalability

4. What are different methods of session maintenance in ASP.NET?
In-process storage.
Session State Service.
Microsoft SQL Server.

In-Process Storage
The default location for session state storage is in the ASP.NET process itself.

Session State Service
As an alternative to using in-process storage for session state, ASP.NET provides the ASP.NET State Service. The State Service gives you an out-of-process alternative for storing session state that is not tied quite so closely to ASP. Net’s own process.

Microsoft SQL Server
The final choice for storing state information is to save it in a Microsoft SQL Server database.

5. What is the difference between Server.Transfer and Response.Redirect?
Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page.
Response.Dedirect() :client know the physical location (page name and query string as well).

6. Types of comments in asp.net
Single line comments
// for single line comments

Multiple line comments
/* for multi line comments */

XML tags comments

/// XML tags displayed in a code comment

7. Use of @RenderPage() method?
@RenderPage() method use to import content from separate files.

Example:
<html>
<body>
@RenderPage(“header.cshtml”)
<h1>Hello Web Pages</h1>
<p>This is a paragraph</p>
@RenderPage(“footer.cshtml”)
</body>
</html>

8. ASP.NET Web Pages – Folders structure
Logical Folder Structure
Below is a typical folder structure for an ASP.NET web pages web:

Folders
The “Account” folder contains logon and security files
The “App_Data” folder contains databases and data files
The “Images” folder contains images
The “Scripts” folder contains browser scripts
The “Shared” folder contains common files (like layout and style files)

Physical Folder Structure
The physical structure for the “Images” folder at the website above might look like this on a computer:
C:userDocumentsMyWebSitesDemoImages

Virtual and Physical Names
From the example above:
The virtual name of a web picture might be “Images/pic31.jpg”.
But the physical name is “C:usereDocumentsMyWebSitesDemoImagespic31.jpg”

URLs and Paths
URLs are used to access files from the web: http://www.demo.com/html/html5_intro.asp

9. Differentiate globalization and localization.
“Globalization is the process of designing and developing a software product that functions in multiple cultures/locales.”

“Localization is the process of adapting a globalized application, which you have already processed for localizability, to a particular culture/locale.”

10. What is ViewState?
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 postback are serialized into base64-encoded strings.
11. name of method tha used to force all the validation controls to run?
Page.Validate() method

12. difference between Response.Write() and Response.Output.Write() methods?
Response.write() don’t give formatted output. The latter one allows you to write formatted output.

Response.write – it writes the text stream Response.output.write – it writes the HTTP Output Stream.

13. What is a Cookie?
A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user’s computer. Each time the same computer requests a page with a browser, it will send the cookie too. With ASP, you can both create and retrieve cookie values.

14. How to Create a Cookie?
The “Response.Cookies” command is used to create cookies.

Note: The Response.Cookies command must appear BEFORE the <html> tag.

In the example below, we will create a cookie named “fname” and assign the value “ABC” to it:
<%
Response.Cookies(“fname”)=”ABC”
Response.Cookies(“fname”).Expires=#Jan 10,2015#
%>

15. How to Retrieve a Cookie Value?
The “Request.Cookies” command is used to retrieve a cookie value.

Example:
<%
firstname=Request.Cookies(“fname”)
response.write(“Firstname=” & firstname)
%>

More question coming soon.. we are updating our list of ques and answer.

//]]>