You are on page 1of 14

ASP.

NET Interview Questions with Answers - Set 3

Where would you use an iHTTPModule, and what are the limitations of any
approach you might take in implementing one?
Ans : One of ASP.NET's most useful features is the extensibility of the HTTP pipeline, the
path that data takes between client and server. You can use them to extend your ASP.NET
applications by adding pre- and post-processing to each HTTP request coming into your
application. For example, if you wanted custom authentication facilities for your
application, the best technique would be to intercept the request when it comes in and
process the request in a custom HTTP module..

Explain what a diffgram is and a good use for one?


A DiffGram is an XML format that is used to identify current and original versions of data
elements. The DataSet uses the DiffGram format to load and persist its contents, and to
serialize its contents for transport across a network connection. When a DataSet is written
as a DiffGram, it populates the DiffGram with all the necessary information to accurately
recreate the contents, though not the schema, of the DataSet, including column values
from both the Original and Current row versions, row error information, and row order..

What's the difference between the System.Web.UI.WebControls.DataGrid and and


System.Windows.Forms.DataGrid?
Ans : The Web UI control does not inherently support master-detail data structures. As
with other Web server controls, it does not support two-way data binding. If you want to
update data, you must write code to do this yourself. You can only edit one row at a time.
It does not inherently support sorting, although it raises events you can handle in order to
sort the grid contents. You can bind the Web Forms DataGrid to any object that supports
the IEnumerable interface. The Web Forms DataGrid control supports paging. It is easy to
customize the appearance and layout of the Web Forms DataGrid control as compared to
the Windows Forms one..

How do you display an editable drop-down list?


Ans : Displaying a drop-down list requires a template column in the grid. Typically, the
ItemTemplate contains a control such as a data-bound Label control to show the current
value of a field in the record. You then add a drop-down list to the EditItemTemplate. In
Visual Studio, you can add a template column in the Property builder for the grid, and then
use standard template editing to remove the default TextBox control from the
EditItemTemplate and drag a DropDownList control into it instead. Alternatively, you can
add the template column in HTML view. After you have created the template column with
the drop-down list in it, there are two tasks. The first is to populate the list. The second is
to preselect the appropriate item in the list ? for example, if a book's genre is set to ?
fiction,? when the drop-down list displays, you often want ?fiction? to be preselected.

How do you check whether the row data has been changed?
Ans : The definitive way to determine whether a row has been dirtied is to handle the
changed event for the controls in a row. For example, if your grid row contains a TextBox
control, you can respond to the control's TextChanged event. Similarly, for check boxes,
you can respond to a CheckedChanged event. In the handler for these events, you
maintain a list of the rows to be updated. Generally, the best strategy is to track the
primary keys of the affected rows. For example, you can maintain an ArrayList object that
contains the primary keys of the rows to update

Question: what is Viewstate?


Answer:View state is used by the ASP.NET page framework to automatically save the
values of the page and of each control just prior to rendering to the page. When the page
is posted, one of the first tasks performed by page processing is to restore view state.
State management is the process by which you maintain state and page information over
multiple requests for the same or different pages.
Client-side options are:* The ViewState property * Query strings
* Hidden fields * Cookies

Server-side options are:* Application state * Session state * DataBase


Use the View State property to save data in a hidden field on a page. Because ViewState
stores data on the page, it is limited to items that can be serialized. If you want to store
more complex items in View State, you must convert the items to and from a string.
ASP.NET provides the following ways to retain variables between requests:
Context.Handler object Use this object to retrieve public members of one Web formÃ
¢â‚¬â„¢s class from a subsequently displayed Web form.
Query strings Use these strings to pass information between requests and responses as
part of the Web address. Query strings are visible to the user, so they should not contain
secure information such as passwords.
Cookies Use cookies to store small amounts of information on a client. Clients might refuse
cookies, so your code has to anticipate that possibility.
View state ASP.NET stores items added to a page’s ViewState property as hidden
fields on the page.
Session state Use Session state variables to store items that you want keep local to the
current session (single user).
Application state Use Application state variables to store items that you want be available
to all users of the application.
Question: DOTNET PAGE LIFECYCLE ?
Answer: While excuting the page, it will go under the fallowing steps(or fires the events)
which collectivly known as Page Life cycle.
Page_Init -- Page Initialization
LoadViewState -- View State Loading
LoadPostData -- Postback data processing
Page_Load -- Page Loading
RaisePostDataChangedEvent -- PostBack Change Notification
RaisePostBackEvent -- PostBack Event Handling
Page_PreRender -- Page Pre Rendering Phase
SaveViewState -- View State Saving
Page_Render -- Page Rendering
Page_UnLoad -- Page Unloading

Question: What is Satellite Assemblies ?


Answer: Satellite assemblies are often used to deploy language-specific resources for an
application. These language-specific assemblies work in side-by-side execution because
the application has a separate product ID for each language and installs satellite
assemblies in a language-specific subdirectory for each language. When uninstalling, the
application removes only the satellite assemblies associated with a given language and
.NET Framework version. No core .NET Framework files are removed unless the last
language for that .NET Framework version is being removed. For example, English and
Japanese editions of the .NET Framework version 1.1 share the same core files. The
Japanese .NET Framework version 1.1 adds satellite assemblies with localized resources in
a \ja subdirectory. An application that supports the .NET Framework version 1.1,
regardless of its language, always uses the same core runtime files.

Question: What is CAS ?


Answer:CAS: CAS is the part of the .NET security model that determines whether or not a
piece of code is allowed to run, and what resources it can use when it is running. For
example, it is CAS that will prevent a .NET web applet from formatting your hard disk. How
does CAS work? The CAS security policy revolves around two key concepts - code groups
and permissions. Each .NET assembly is a member of a particular code group, and each
code group is granted the permissions specified in a named permission set. For example,
using the default security policy, a control downloaded from a web site belongs to the
'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet'
named permission set. (Naturally the 'Internet' named permission set represents a very
restrictive range of permissions.)

Question: Automatic Memory Management ?


Answer: Automatic Memory Management: From a programmer's perspective, this is
probably the single biggest benefit of the .NET Framework. No, I'm not kidding. Every
project I've worked on in my long career of DOS and Windows development has suffered
at some point from memory management issues. Proper memory management is hard.
Even very good programmers have difficulty with it. It's entirely too easy for a small
mistake to cause a program to chew up memory and crash, sometimes bringing the
operating system to a screeching halt in the process.

Programmers understand that they're responsible for releasing any memory that they
allocate, but they're not very good at actually doing it. In addition, functions that allocate
memory as a side effect abound in the Windows API and in the C runtime library. It's
nearly impossible for a programmer to know all of the rules. Even when the programmer
follows the rules, a small memory leak in a support library can cause big problems if called
enough.

The .NET Framework solves the memory management problems by implementing a


garbage collector that can keep track of allocated memory references and release the
memory when it is no longer referenced. A large part of what makes this possible is the
blazing speed of today's processors. When you're running a 2 GHz machine, it's easy to
spare a few cycles for memory management. Not that the garbage collector takes a huge
number of cycles--it's incredibly efficient.
The garbage collector isn't perfect and it doesn't solve the problem of mis-managing other
scarce resources (file handles, for example), but it relieves programmers from having to
worry about a huge source of bugs that trips almost everybody up in other programming
environments.
On balance, automatic memory management is a huge win in almost every situation.

What is a FileSystemObject object?


It provides access to the physical file system of the web server. It gets and manipulates
information about all drives in a server, folders and sub-folders on a drive and files inside a
folder.

What is a Scripting Language?


It permits to create more interactive Web Pages. Validation, formatting of web pages can
be done. VBScript, JavaScript are some examples.

What is a Dictionary object?


It lets you store and retrieve information in a flexible data structure. Each value or
information stored in a Dictionary is associated with a key through which the information
can be retrieved.

What is Global.asa file?


It is text file that contains details about an ASP application, such as when it should begin
and end.

What is an .ASP file?


It is a Text File that contains the combination of the following:
Text
HTML tags
Script Commands

What is Response Object?


It controls the information sent to the user. The various methods are:
Response.Write - Sends information directly to a browser
Response.Redirect - Directs a user to a URL other than the requested URL
Response.ContentType - Controls the type of content sent
Response.Cookies - Sets cookie values
Response.Buffer - To Buffer information

Naming constraints for a variable ?


It can be up to 255 characters Must start with an alphabet Must not contain an embedded
period or full-stop

What is a TextStream object?


It allows you to access(read/write) the contents of text files stored on the web server.
What is IIS?
IIS is a Web Server that provides Web services, not only for web pages but also for ftp
sites and video and audio services. It integrates with the database facilities of SQL Server.

What is Request Object?


Gets information from the user. It has five collections by which values can be accessed.
They are: Query string, Form, Cookies, Server Variables & Client Certificate

What are the special sub-types in VBScript?


EMPTY: has no value
NULL: Value does not exist (conjunction with database)

OBJECT:

What is Cookies collection?


Cookies are text files that store information about the user by which the web server
identifies and marks each different visitor to a web site and determines where a user has
been before. A cookie can store information only when the user sends it. Individual cookies
are limited to 4KB of data. The maximum number of cookies allowed is 300.
Cookies are stored on client’s machine.

What is the difference between Cookies collection and Form/Query string collection?
Cookie collection does not have the Count property. Cookies can have multiple values for
the same cookie name but each value can be referred using a key whereas in a
Form/Query string cookie each value has to be referred using an index value.

What is Server Object?


Controls the ASP execution environment. It can set the amount of time script can run
before an error occurs. Converts a virtual path to a physical path on the server. Takes a
user supplied string and encode it into proper format for a URL string.

What is Collection?
Collection is a set of name/value pairs where the information supplied by the client is
stored

Question:-How many types of cookies are there in .NET ?


Answer: Two type of cookeies.
a) single valued eg request.cookies(†ン UserName†ン).value=â€Â
ン dotnetquestion†ン
b)Multivalued cookies. These are used in the way collections are used example
request.cookies(†ン CookiName†ン)(†ン UserName†ン)=â€Â
ン dotnetquestionMahesh†ン
request.cookies(†ン CookiName†ン)(†ン UserID†ン)=â€Â
ン interview?

Question: What is Finalizer in .NET define Dispose and Finalize ?


Answer: We can say that Finalizer are the methods that's helps in cleanp the code that is
executed before object is garbage collected .The process is called finalization . There are
two methods of finalizer Dispose and Finalize .There is little diffrenet between two of this
method .
When we call Dispose method is realse all the resources hold by an object as well as all the
resorces hold by the parent object.When we call Dispose method it clean managed as well
as unmanaged resources.
Finalize methd also cleans resources but finalize call dispose clears only the unmanged
resources because in finalization the garbase collecter clears all the object hold by
managed code so finalization fails to prevent thos one of methd is used that is:
GC.SuppressFinalize.

Question: Define SMTPclient class in DotNet framework class libarary ?


Answer: Each classes in dotnet framework inclue some properties,method and
events.These properties ,methods and events are member of a class.SMTPclient class
mainly concern with sending mail.This class contain the folling member.
Properties:-
Host:-The name or IP address of email server.
Port:-Port that is use when sending mail.
Methods:-
Send:-Enables us to send email synchronously.
SendAsynchronous:-Enables us to send an email asynchronously.
Event:-
SendCompleted:-This event raised when an asynchronous send opertion completes.

Question: When we get Error 'HTTP 502 Proxy Error' ?


Answer: We get this error when we execute ASP.NET Web pages in Visual Web Developer
Web server, because the URL randomly select port number and proxy servers did not
recognize the URL and return this error. To resolve this problem we have to change
settings in Internet Explorer to bypass the proxy server for local addresses, so that the
request is not sent to the proxy.

Question: What is late binding ?


Answer: When code interacts with an object dynamically at runtime .because our code
literally doesnot care what type of object it is interacting and with the methods thats are
supported by object and with the methods thats are supported by object .The type of
object is not known by the IDE or compiler ,no Intellisense nor compile-time syntax
checking is possible but we get unprecedented flexibilty in exchange.if we enable strict
type checking by using option strict on at the top of our code modules ,then IDE and
compiler will enforce early binding behaviour .By default Late binding is done.

Question:-What is Com Marshler and its importance in .NET ?


Answer: Com Marshler is one of useful component of CLR. Its Task is to marshal data
between Managed and Unmanaged environment .It helps in representation of data accross
diffrenet execution enviroment.It performs the conversion of data format between manage
and unmanaged code.By the helps of Com Marshlar CLR allows manage code to
interoperate with unmanaged code.
Question: What is CSU and its description ?
Answer: CSU stands for comma separate values also called comma delimited.It is plain
text file which stores spreadsheets or basic datatype in very simple format.One record in
each line and each field separted with comma's it is often used to transfer large ammount
spreadsheet data or database information between program.

Question: The IHttpHandler and IHttpHandlerFactory interfaces ?


Answer: The IHttpHandler interface is implemented by all the handlers. The interface
consists of one property called IsReusable. The IsReusable property gets a value indicating
whether another request can use the IHttpHandler instance. The method ProcessRequest()
allows you to process the current request. This is the core place where all your code goes.
This method receives a parameter of type HttpContext using which you can access the
intrinsic objects such as Request and Response. The IHttpHandlerFactory interface consists
of two methods - GetHandler and ReleaseHandler. The GetHandler() method instantiates
the required HTTP handler based on some condition and returns it back to ASP.NET. The
ReleaseHandler() method allows the factory to reuse an existing handler.

1. What are the main differences between asp and asp.net?

ASP 3.0

• Supports VBScript and JavaScript


o scripting languages are limited in scope
o interpreted from top to bottom each time the page is loaded
• Files end with *.asp extension
• 5 objects: Request, Response, Server, Application, Session
• Queried databases return recordsets
• Uses conventional HTML forms for data collection

ASP .NET
• Supports a number of languages including Visual Basic, C#, and JScript
o code is compiled into .NET classes and stored to speed up multiple hits on a page
o object oriented and event driven makes coding web pages more like traditional
applications
• Files end with *.aspx extension
• .NET contains over 3400 classes
• XML-friendly data sets are used instead of recordsets
• Uses web forms that look like HTML forms to the client, but add much
functionality due to server-side coding
• Has built-in validation objects
• Improved debugging feature (great news for programmers)
• ASP .NET controls can be binded to a data source, including XML recordsets
Source: mikekissman.com

2. What is a user control?

• An ASP.NET user control is a group of one or more server controls or static HTML
elements that encapsulate a piece of functionality. A user control could simply be an
extension of the functionality of an existing server control(s) (such as an image control
that can be rotated or a calendar control that stores the date in a text box). Or, it could
consist of several elements that work and interact together to get a job done (such as
several controls grouped together that gather information about a user's previous work
experience).
Source: 15seconds.com

3. What are different types of controls available in ASP.net?


• HTML server controls HTML elements exposed to the server so you can program
them. HTML server controls expose an object model that maps very closely to the HTML
elements that they render.
• Web server controls Controls with more built-in features than HTML server
controls. Web server controls include not only form-type controls such as buttons and text
boxes, but also special-purpose controls such as a calendar. Web server controls are more
abstract than HTML server controls in that their object model does not necessarily reflect
HTML syntax.
• Validation controls Controls that incorporate logic to allow you to test a user's
input. You attach a validation control to an input control to test what the user enters for
that input control. Validation controls are provided to allow you to check for a required
field, to test against a specific value or pattern of characters, to verify that a value lies
within a range, and so on.
• User controls Controls that you create as Web Forms pages. You can embed Web
Forms user controls in other Web Forms pages, which is an easy way to create menus,
toolbars, and other reusable elements.
• Note You can also create output for mobile devices. To do so, you use the same
ASP.NET page framework, but you create Mobile Web Forms instead of Web Forms pages
and use controls specifically designed for mobile devices.
Source: MSDN

4. What are the validation controls available in ASP.net?

Type of validation Control to use


Description

Required entry RequiredFieldValidator Ensures that the user does not skip an entry.
Comparison to a value CompareValidator Compares a user's entry against a constant
value, or against a property value of another control, using a comparison operator (less
than, equal, greater than, and so on).
Range checking RangeValidator Checks that a user's entry is between specified lower and
upper boundaries. You can check ranges within pairs of numbers, alphabetic characters,
and dates.
Pattern matching RegularExpressionValidator Checks that the entry matches a pattern
defined by a regular expression. This type of validation allows you to check for predictable
sequences of characters, such as those in social security numbers, e-mail addresses,
telephone numbers, postal codes, and so on.
User-defined CustomValidator Checks the user's entry using validation logic that you write
yourself. This type of validation allows you to check for values derived at run time.
Source: MSDN

5. How will you upload a file to IIS in Asp and how will you do the same in ASP.net?

First of all, we need a HTML server control to allow the user to select the file. This is

nothing but the same old . This will give you the textbox and a browse
button. Once you have this, the user can select any file from their computer (or even from
a network). Then, in the Server side, we need the following line to save the file to the Web
Server.

myFile.PostedFile.SaveAs ("DestinationPath")

Note: The Form should have the following ENC Type

Source: ASP Alliance


6. What is Attribute Programming? What are attributes? Where are they used?

Attributes are a mechanism for adding metadata, such as compiler instructions and other
data about your data, methods, and classes, to the program itself. Attributes are inserted
into the metadata and are visible through ILDasm and other metadata-reading tools.
Attributes can be used to identify or use the data at runtime execution using .NET
Reflection.
Source: OnDotNet.com

7. What is the difference between Data Reader & Dataset?

Data Reader is connected, read only forward only record set.


Dataset is in memory database that can store multiple tables, relations and constraints;
moreover dataset is disconnected and is not aware of the data source.

8. What is the difference between server side and client side code?

Server code is executed on the web server where as the client code is executed on the
browser machine.

9. Why would you use “EnableViewState†ン property? What are the


disadvantages?

EnableViewState allows me to retain the values of the controls properties across the
requests in the same session. It hampers the performance of the application.

10. What is the difference between Server. Transfer and Response. Redirect?

The Transfer method allows you to transfer from inside one ASP page to another ASP
page. All of the state information that has been created for the first (calling) ASP page will
be transferred to the second (called) ASP page. This transferred information includes all
objects and variables that have been given a value in an Application or Session scope, and
all items in the Request collections. For example, the second ASP page will have the same
SessionID as the first ASP page.

When the second (called) ASP page completes its tasks, you do not return to the first
(calling) ASP page. All these happen on the server side browser is not aware of this.
The redirect message issue HTTP 304 to the browser and causes browser to got the
specified page. Hence there is round trip between client and server. Unlike transfer,
redirect doesn’t pass context information to the called page
ASP.NET Interview Questions with Answers - Set 1

How many languages .NET is supporting now?


When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl,
etc. The site DotNet Languages. Net says 44 languages are supported.

How is .NET able to support multiple languages?


A language should comply with the Common Language Runtime standard to become a
.NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for
short). This is called as Managed Code. This Managed code is run in .NET environment. So
after compilation to this IL the language is not a barrier. A code can call or use a function
written in another language.

How ASP .NET different from ASP?


Scripting is separated from the HTML, Code is compiled as a DLL, and these DLLs can be
executed on the server.

What is smart navigation?


The cursor position is maintained when the page gets refreshed due to the server side
validation and the page gets refreshed.

What is view state?


The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page
itself automatically. How? The values are encrypted and saved in hidden controls. this is
done automatically by the ASP.NET. This can be switched off / on for a single control.

How do you validate the controls in an ASP .NET page?


Using special validation controls that are meant for this. We have Range Validator, Email
Validator.

Can the validation be done in the server side? Or this can be done only in the Client side?
Client side is done by default. Server side validation is also possible. We can switch off the
client side and server side can be done..

What is delay signing?


Ans : Delay signing allows you to place a shared assembly in the GAC by signing the
assembly with just the public key. This allows the assembly to be signed with the
private key at a later stage, when the development process is complete and the
component or assembly is ready to be deployed. This process enables developers to
work with shared assemblies as if they were strongly named, and it secures the private
key of the signature from being accessed at different stages of development..

What are the authentication modes in ASP.NET?


Ans : None, Windows, Forms and Passport..

Are the actual permissions for the application defined at run-time or compile-time?
Ans : The CLR computes actual permissions at runtime based on code group
membership and the calling chain of the code..

What's a code group?


Ans : A code group is a set of assemblies that share a security context..

What's the difference between authentication and authorization?


Ans : Authentication happens first. You verify user's identity based on credentials.
Authorization is making sure the user only gets access to the resources he has
credentials for..
What are the authentication modes in ASP.NET?
Ans : None, Windows, Forms and Passport.

Explain the differences between Server-side and Client-side code?


Ans : Server side scripting means that all the script will be executed by the server and
interpreted as needed. ASP doesn't have some of the functionality like sockets,
uploading, etc. For these you have to make a custom component usually in VB or
VC++. Client side scripting means that the script will be executed immediately in the
browser such as form field validation, clock, email validation, etc. Client side
scripting is usually done in VBScript or JavaScript. Download time, browser
compatibility, and visible code - since JavaScript and VBScript code is included in the
HTML page, then anyone can see the code by viewing the page source. Also a
possible security hazards for the client computer

1. Explain the differences between Server-side and Client-side code?

2. What type of code (server or client) is found in a Code-Behind


class?

3. Should validation (did the user enter a real date) occur


server-side or client-side? Why?

4. What does the "EnableViewState" property do? Why would I want it on or off?

5. What is the difference between Server.Transfer and


Response.Redirect? Why
would I choose one over the other?

6. Can you give an example of when it would be appropriate to use a


web service as opposed to a non-serviced .NET component

7. Let's say I have an existing application written using Visual


Studio 6 (VB 6, InterDev 6) and this application utilizes Windows 2000
COM+ transaction services. How would you approach migrating this
application to .NET

8. Can you explain the difference between an ADO.NET Dataset and an


ADO Recordset?

9. Can you give an example of what might be best suited to place in


the Application_Start and Session_Start subroutines?

10. If I'm developing an application that must accomodate multiple


security levels though secure login and my ASP.NET web appplication is
spanned across three web-servers (using round-robbin load balancing)
what would be the best approach to maintain login-in state for the
users?

11. What are ASP.NET Web Forms? How is this technology different than
what is available though ASP (1.0-3.0)?

12. How does VB.NET/C# achieve polymorphism?


11. Can you explain what inheritance is and an example of when you
might use it?

13. How would you implement inheritance using VB.NET/C#?

14. Whats an assembly

15. Describe the difference between inline and code behind - which is
best in a

16. loosely coupled solution

17. Explain what a diffgram is, and a good use for one

18. Where would you use an iHTTPModule, and what are the limitations
of any

19. approach you might take in implementing one

20. What are the disadvantages of viewstate/what are the benefits

21 Describe session handling in a webfarm, how does it work and what


are the > limits

22. How would you get ASP.NET running in Apache web servers - why
would you even do this?

23. Whats MSIL, and why should my developers need an appreciation of


it if at all?

24. In what order do the events of an ASPX page execute. As a


developer is it important to undertsand these events?

25. Which method do you invoke on the DataAdapter control to load your
generated dataset with data?

26. Can you edit data in the Repeater control?

27. Which template must you provide, in order to display data in a


Repeater control?

28. How can you provide an alternating color scheme in a Repeater


control?

29. What property must you set, and what method must you call in your
code, in order to bind the data from some data source to the Repeater
control?

30. What base class do all Web Forms inherit from?

31. What method do you use to explicitly kill a user s session?

32 How do you turn off cookies for one page in your site?

33. Which two properties are on every validation control?

34. What tags do you need to add within the asp:datagrid tags to bind
columns manually?

35. How do you create a permanent cookie?

36. What tag do you use to add a hyperlink column to the DataGrid?

37. What is the standard you use to wrap up a call to a Web service

38. Which method do you use to redirect the user to another page
without performing a round trip to the client?

39. What is the transport protocol you use to call a Web service SOAP

40. True or False: A Web service can only be written in .NET


41. What does WSDL stand for?

42. What property do you have to set to tell the grid which page to go
to when using the Pager object?

43. Where on the Internet would you look for Web services?

44. What tags do you need to add within the asp:datagrid tags to bind
columns manually.

45. Which property on a Combo Box do you set with a column name, prior to setting
the DataSource, to display data in the combo box?

46. How is a property designated as read-only?

47. Which control would you use if you needed to make sure the values
in two different controls matched?

48. True or False: To test a Web service you must create a windows
application or Web application to consume this service?

49. How many classes can a single .NET DLL contain?

What is XHTML? Are ASP.NET Pages compliant with XHTML?


In simple words, XHTML is a stricter and cleaner version of HTML. XHTML stands
for EXtensible Hypertext Markup Language and is a W3C Recommendation.
Yes, ASP.NET 2.0 Pages are XHTML compliant. However the freedom has been
given to the user to include the appropriate document type declaration.
More info can be found at http://msdn2.microsoft.com/en-
us/library/exc57y7e.aspx
Can I deploy the application without deploying the source code on the
server?
Yes. You can obfuscate your code by using a new precompilation process called
‘precompilation for deployment’. You can use the aspnet_compiler.exe to
precompile a site. This process builds each page in your web application into a
single application DLL and some placeholder files. These files can then be
deployed to the server.
You can also accomplish the same task using Visual Studio 2005 by using the
Build->Publish menu.
Does ViewState affect performance? What is the ideal size of a
ViewState? How can you compress a viewstate?
Viewstate stores the state of controls in HTML hidden fields. At times, this
information can grow in size. This does affect the overall responsiveness of the
page, thereby affecting performance. The ideal size of a viewstate should be not
more than 25-30% of the page size.
Viewstate can be compressed to almost 50% of its size. .NET also provides the
GZipStream or DeflateStream to compress viewstate. Another option is
explained by Scott Hanselmann over here.
How can you detect if a viewstate has been tampered?
By setting the EnableViewStateMac to true in the @Page directive. This attribute
checks the encoded and encrypted viewstate for tampering.
Can I use different programming languages in the same application?
Yes. Each page can be written with a different programming language in the
same application. You can create a few pages in C# and a few in VB.NET.
Can the App_Code folder contain source code files in different
programming languages?
No. All source code files kept in the root App_Code folder must be in the same
programming language.
Update: However, you can create two subfolders inside the App_Code and then
add both C# and VB.NET in the respective subfolders. You also have to add
configuration settings in the web.config for this to work.
How do you secure your connection string information?
By using the Protected Configuration feature.
How do you secure your configuration files to be accessed remotely by
unauthorized users?
ASP.NET configures IIS to deny access to any user that requests access to the
Machine.config or Web.config files.
How can I configure ASP.NET applications that are running on a remote
machine?
You can use the Web Site Administration Tool to configure remote websites.
How many web.config files can I have in an application?
You can keep multiple web.config files in an application. You can place a
Web.config file inside a folder or wherever you need (apart from some
exceptions) to override the configuration settings that are inherited from a
configuration file located at a higher level in the hierarchy.
I have created a configuration setting in my web.config and have kept it
at the root level. How do I prevent it from being overridden by another
web.config that appears lower in the hierarchy?
By setting the element's Override attribute to false.
What is the difference between Response.Write and
Response.Output.Write?
As quoted by Scott Hanselman, the short answer is that the latter gives you
String.Format-style output and the former doesn't.
To get a detailed explanation, follow this link
What is Cross Page Posting? How is it done?
By default, ASP.NET submits a form to the same page. In cross-page posting, the
form is submitted to a different page. This is done by setting the ‘PostBackUrl’
property of the button(that causes postback) to the desired page. In the code-
behind of the page to which the form has been posted, use the ‘FindControl’
method of the ‘PreviousPage’ property to reference the data of the control in the
first page.
Can you change a Master Page dynamically at runtime? How?
Yes. To change a master page, set the MasterPageFile property to point to the
.master page during the PreInit page event.
How do you apply Themes to an entire application?
By specifying the theme in the web.config file.
Eg: <configuration>
<system.web>
<pages theme=”BlueMoon” />
</system.web>
</configuration>

How do you exclude an ASP.NET page from using Themes?


To remove themes from your page, use the EnableTheming attribute of the Page
directive.
Your client complains that he has a large form that collects user input. He
wants to break the form into sections, keeping the information in the
forms related. Which control will you use?
The ASP.NET Wizard Control.
To learn more about this control, visit this link.
Do webservices support data reader?
No. However it does support a dataset.
What is use of the AutoEventWireup attribute in the Page directive ?
The AutoEventWireUp is a boolean attribute that allows automatic wireup of page
events when this attribute is set to true on the page. It is set to True by default
for a C# web form whereas it is set as False for VB.NET forms. Pages developed
with Visual Studio .NET have this attribute set to false, and page events are
individually tied to handlers.
What happens when you change the web.config file at
run time?
ASP.NET invalidates the existing cache and assembles a new cache. Then
ASP.NET automatically restarts the application to apply the changes.
Can you programmatically access IIS configuration
settings?
Yes. You can use ADSI, WMI, or COM interfaces to configure IIS
programmatically.
How does Application Pools work in IIS 6.0?
As explained under the IIS documentation, when you run IIS 6.0 in worker
process isolation mode, you can separate different Web applications and Web
sites into groups known as application pools. An application pool is a group of one
or more URLs that are served by a worker process or set of worker processes.
Any Web directory or virtual directory can be assigned to an application pool.

Every application within an application pool shares the same worker process.
Because each worker process operates as a separate instance of the worker
process executable, W3wp.exe, the worker process that services one application
pool is separated from the worker process that services another. Each separate
worker process provides a process boundary so that when an application is
assigned to one application pool, problems in other application pools do not affect
the application. This ensures that if a worker process fails, it does not affect the
applications running in other application pools.

Use multiple application pools when you want to help ensure that applications and
Web sites are confidential and secure. For example, an enterprise organization
might place its human resources Web site and its finance Web site on the same
server, but in different application pools. Likewise, an ISP that hosts Web sites
and applications for competing companies might run each companys Web
services on the same server, but in different application pools. Using different
application pools to isolate applications helps prevent one customer from
accessing, changing, or using confidential information from another customers
site.
In HTTP.sys, an application pool is represented by a request queue, from which
the user-mode worker processes that service an application pool collect the
requests. Each pool can manage requests for one or more unique Web
applications, which you assign to the application pool based on their URLs.
Application pools, then, are essentially worker process configurations that service
groups of namespaces.
Multiple application pools can operate at the same time. An application, as
defined by its URL, can only be served by one application pool at any time. While
one application pool is servicing a request, you cannot route the request to
another application pool. However, you can assign applications to another
application pool while the server is running.

You might also like