Dot Net Interview FAQ
All Dot Net Interview Questions and Answers, Interview questions, interview question, question, questions, answer, answers, interview,
interviews, job interview, job interview questions, interview tip, medical question, job interviews, ASP NET, Dotnet Interview Questions, VB
NET Question, c sharp interview questions question and answer,.NET interview FAQ, VB.NET, C#.NET Interview questions with answers,
DotNET interview questions , .NET interview Question answers. .NET interview.
ASP.NET Troubleshoot FAQ
Do I need IIS to run Web applications?
If you are using Visual Studio, you can use the ASP.NET Development
Server built into Visual Studio to test your pages. The server functions as a
local Web server, running ASP.NET Web pages in a manner virtually
identical to how they run in IIS. To deploy a Web application, you need to
copy it to a computer running IIS version 5 or 6.
How do I create pages for mobile devices?
ASP.NET will automatically detect the type of browser making the request.
This information is used by the page and by individual controls to render
appropriate markup for that browser. You therefore do not need to use a
special set of pages or controls for mobile devices. (Whether you can
design a single page to work with all types of browsers will depend on the
page, on the browsers you want to target, and on your own goals.)
Are ASP.NET pages XHTML compatible?
Yes. Individual controls render markup that is compatible with the XHTML
1.1 standard. It is up to you, however, to include the appropriate document
type declaration and other XHTML document elements. ASP.NET does not
insert elements for you to ensure XHTML compatibility. For details, see
ASP.NET and XHTML Compliance.
Can I hide the source code for my page?
Serverside code is processed on the server and is not sent to the browser,
so users cannot see it. However, client script is not protected; any client
script that you add to your page, or that is injected into the page by server
processing, is visible to users. If you are concerned about protecting your
source code on the server, you can precompile your site and deploy the
compiled version. For details, see Publishing Web Sites.
When I run a page, I get the error "The page cannot be displayed" and
an HTTP 502 Proxy Error. Why?
This error can occur if you are running ASP.NET Web pages using the
Visual Web Developer Web server, because the URL includes a randomly
selected port number. Proxy servers do not recognize the URL and return
this error. To get around the problem, change your settings in Internet
Explorer to bypass the proxy server for local addresses, so that the request
is not sent to the proxy. In Internet Explorer, you can make this change in
Tools > Internet Options. In the Connections tab, click LAN Settings and
then select Bypass proxy server for local addresses.
Which page code model is preferable, singlefile or codebehind?
Both models function the same and have the same performance. The
choice of using singlefile pages versus codebehind pages is one of
personal preference and convenience. For details, see ASP.NET Web
Page Code Model.
The QuickStart examples and examples in the API reference seem to use
singlefile pages frequently. Does this mean that singlefile is the preferred
model for pages?
No. Singlefile pages are frequently used in examples because they are
easier to illustrate — the writer does not have to create a separate file to
show the code.
Subscribe To
Posts
Comments
Followers
Join this site
with Google Friend Connect
There are no members yet.
Be the first!
Already a member? Sign in
Dot Net Interview Question Answers
.NET Basic (2)
.NET Events (1)
.NET Framework FAQ (1)
Access Control List in .NET Framework
(1)
ADO (1)
ADO.NET Introduction (1)
ADO.NET Object Model (1)
ASP.NET Assemblies (1)
ASP.NET FAQ (1)
ASP.NET interview FAQ (1)
ASP.NET Security (2)
ASP.NET Session State FAQ (1)
ASP.NET Troubleshoot FAQ (1)
Is it better to write code in C# or Visual Basic?
You can write code for your Web application in any language supported by
the .NET Framework. That includes Visual Basic, C#, J#, JScript, and
others. Although the languages have different syntax, they all compile to
the same object code. The languages have small differences in how they
support different features. For example, C# provides access to unmanaged
code, while Visual Basic supports implicit event binding via the Handles
clause. However, the differences are minor, and unless your requirements
involve one of these small differences, the choice of programming language
is one of personal preference. Once programs are compiled, they all
perform identically; that is, Visual Basic programs run just as fast as C#
programs, since they both produce the same object code.
Do I have to use one programming language for all my Web pages?
No. Each page can be written in a different programming language if you
want, even in the same application. If you are creating source code files
and putting them in the \App_Code folder to be compiled at run time, all the
code in must be in the same language. However, you can create subfolders
in the \App_Code folder and use the subfolders to store components written
in different programming languages.
Is the code in singlefile and codebehind pages identical?
Almost. A codebehind file contains an explicit class declaration, which is
not required for singlefile pages.
Is the old codebehind model still supported?
Old projects will continue to run without change. In Visual Studio 2005, if
you open a project created in Visual Studio .NET 2002 or 2003, by default,
the project is converted to the new project layout used in Visual Studio
2005. As part of the conversion, pages that use the old codebehind model
are converted to use the new codebehind model. Visual Studio 2005 Web
Application Projects provide an alternative web project model that uses the
same project, build and compilation semantics as the Visual Studio .NET
2003 codebehind model. For details, see Visual Studio 2005 Web
Application Projects.
Questions on ASP.NET 2.0 Controls
Why is there no DataGrid control on the Toolbox?
The DataGrid control has been superseded by the GridView control, which
can do everything the DataGrid control does and more. The GridView
control features automatic data binding; autogeneration of buttons for
selecting, editing, and deleting; automatic sorting; and automatic paging.
There is full backward compatibility for the DataGrid control, and pages that
use the DataGrid will continue to work as they did in version 1.0 of
ASP.NET.
Can I still use the DataList and Repeater controls?
Absolutely. You can use them the way you always have. But note that the
controls have been enhanced to be able to interact with data source
controls and to use automatic data binding. For example, you can bind a
DataList or Repeater control to a SqlDataSource control instead of writing
ADO.NET code to access the database.
What's the difference between login controls and Forms authentication?
Login controls are an easy way to implement Forms authentication without
having to write any code. For example, the Login control performs the same
functions you would normally perform when using the FormsAuthentication
class—prompt for user credentials, validate them, and issue the
authentication ticket—but with all the functionality wrapped in a control that
you can just drag from the Toolbox in Visual Studio. Under the covers, the
login control uses the FormsAuthentication class (for example, to issue the
authentication ticket) and ASP.NET membership (to validate the user
credentials). Naturally, you can still use Forms authentication yourself, and
applications you have that currently use it will continue to run.
Configuring ASP.NET 2.0
How is ASP.NET configuration data formatted?
ASP.NET configuration data is encoded in XML and stored as plaintext
files. You can access these files programmatically by using administration
C# Interview Questions (1)
COM and DCOM Faq (1)
Configuration in ASP.NET (1)
Deployment and Development FAQ (1)
Dot Net Terminology (1)
Important .NET FAQ (1)
NET (1)
SQL Server Interview Questions (1)
Comments
tools or by using a text editor. For more information, see ASP.NET
Configuration Overview.
Where are the ASP.NET configuration files stored?
Systemwide configuration settings and some ASP.NET schema settings
are stored in a file named Machine.config, which is located in the
%SystemRoot%\Microsoft .NET\Framework\versionNumber\CONFIG
directory. This directory also contains other default settings for ASP.NET
Web applications in a file that is referred to as the root Web.config file.
ASP.NET configuration files for individual Web sites and applications,
which are also named Web.config files, can be stored in any Web site root
directory, application root directory, application subdirectory, or all of these.
For more information, see ASP.NET Configuration File Hierarchy.
How are the ASP.NET configuration files related to the Internet
Information Services (IIS) configuration file (the IIS metabase)?
In IIS versions 6.0 and earlier, the ASP.NET configuration system redirects
any IISspecific settings that it controls. The ASP.NET configuration
system then configures IIS for you by automatically editing the IIS
metabase. For information about the IIS metabase, see Working with the
IIS Metabase.
I used the ASP.NET configuration system to restrict access to my
ASP.NET application, but anonymous users can still view some of my
files. Why is that?
The features of the ASP.NET configuration system only apply to ASP.NET
resources. For example, Forms Authentication only restricts access to
ASP.NET files, not to static files or ASP (classic) files unless those
resources are mapped to ASP.NET file name extensions. Use the
configuration features of IIS to configure nonASP.NET resources.
Since there can be multiple ASP.NET configuration files on one
computer, how does ASP.NET configuration handle inheritance?
ASP.NET integrates the settings in configuration files (the Machine.config
and Web.config files) into a single inheritance hierarchy. With a few
exceptions, you can place a Web.config file wherever you need to override
the configuration settings that are inherited from a configuration file located
at a higher level in the hierarchy. For more information, see ASP.NET
Configuration File Hierarchy.
How does ASP.NET consolidate the settings in all of the configuration
files?
At run time, ASP.NET reads the settings in the Machine.config file and all
of the Web.config files and then assembles a cache of the settings for
each valid URL in each application on the server.
What happens when a configuration setting changes during 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 I configure specific folders directly?
Yes. By using the location element in a configuration file that is located
higher in the configuration hierarchy, you can configure the attributes of
individual resources, such as the application directories under a Web site or
application subdirectories. This is useful in hosting environments for
specifying configuration settings in a machinelevel configuration file that
apply to individual Web sites. For more information, see How to: Configure
Specific Folders Using Location Settings.
Can I lock a configuration setting so that a Web.config file that
appears lower in the hierarchy cannot override it?
Yes. By setting the location element's Override attribute to false, you can
lock a specific setting so that it does not inherit settings from below. For
more information, see How to: Lock ASP.NET Configuration Settings.
How can I get programmatic access to ASP.NET configuration settings?
You can read, create, or modify configuration settings from within an
ASP.NET application by using the ASP.NET management API. You can
develop your own applications including Web applications, console
applications, and scripts that use the management API.
How can I get programmatic access to IIS configuration settings?
You can use ADSI, WMI, or COM interfaces to configure IIS
programmatically. For more information, see Using IIS Programmatic
Administration.
How are ASP.NET configuration files secured against unauthorized
access?
ASP.NET configures IIS to deny access to any user that requests access
to the Machine.config or Web.config files.
What are the limitations when configuring ASP.NET by using the ASP.NET
MMC snapin?
The ASP.NET MMC snapin allows you to set ASP.NET configuration at all
levels, but on the local computer only. For more information, see ASP.NET
MMC SnapIn.
Can I configure ASP.NET Web sites and applications remotely?
Yes. You can use the Web Site Administration Tool to configure remote
Web sites and applications by using a Web browser. For more information,
see Web Site Administration Tool.
Can I configure ASP.NET by directly editing the Machine.config and
Web.config files?
Yes. You can use any text editor or XML editor to edit the ASP.NET
configuration files directly. However, consider using one of the tools
mentioned in the previous questions to edit ASP.NET configuration
because those tools often ensure XML validation.
Can I configure ASP.NET by directly editing the IIS metabase file?
The IIS 6.0 metabase is stored in an XMLformatted file called
Metabase.xml. You can configure IIS to allow the metabase to be edited
directly, but not all of the ASP.NET configuration settings are available in
the IIS metabase. It is best to configure ASP.NET features by using the
ASP.NET configuration system. For more information, see Editing
ASP.NET Configuration Files.
What tools can I use to edit the IIS metabase?
You can use the IIS Manager snapin for the MMC. For information about
common administrative tasks for ASP.NET developers, see ASP.NET and
IIS Configuration.
Questions on Visual Web Developer
Can I run Web pages on a remote computer using ASP.NET
Development Server?
Yes, you can create a file system Web application and specify a UNC
pointing to another computer as the location for the files. When you run a
page in Visual Web Developer, it starts up the ASP.NET Development
Server locally, which in turn can read files from a remote computer.
Microsoft KnowledgeBase article 810886
When I try to run pages on a remote computer using the ASP.NET
Development Server, I get an error that says the BIOS limit has been
exceeded. What is the problem?
You might see this error if the remote computer is running Windows 2000 or
Windows XP. If the remote computer is running Windows 2000, you can
follow the instructions in Microsoft KnowledgeBase article 810886 to set
the maximum number of concurrent connections to a higher number. If you
are running Windows XP, you might be able to avoid this error by closing
existing shared resources, including terminal server sessions, on the
remote computer. (Windows XP is configured with a fixed number of
maximum concurrent network requests.)
General ASP.NET Questions
What is ASP.NET?
ASP.NET is a serverside technology for creating dynamic, standards
based Web sites and services that are accessible across multiple
platforms including mobile devices. It is part of the .NETbased
environment; you can author applications in any .NET compatible language,
including Visual Basic .NET, C#, and J#. Additionally, the entire .NET
Framework class library is available to any ASP.NET application.
Developers can easily access the benefits of these technologies, which
include the managed common language runtime environment, type safety,
inheritance, and so on.
Whats the difference between ASP and ASP.NET?
ASP (Active Server Pages) and ASP.NET are both server side
technologies for building web sites and Web applications, but ASP.NET is
not simply a new version of ASP. ASP.NET has been entirely re
architected to provide a highly productive programming experience based
on the .NET Framework, and a robust infrastructure for building reliable and
scalable web applications. For an overview of ASP.NET enhancements
click here.
How do I get ASP.NET?
You can get ASP.NET by installing the Microsoft .NET Framework. The
.NET Framework is available in either a redistributable or SDK format. See
this overview to learn more and install the .NET Framework.
How much does ASP.NET cost?
ASP.NET is part of the Microsoft .NET Framework. The .NET Framework
is a feature of Windows, and is available for download at no charge from
this site. You can develop ASP.NET sites using a text editor, but if youre
looking for a development tool please see Which development tools support
ASP.NET?
What operating systems does ASP.NET run on?
ASP.NET runs on Windows Server 2000, Windows Server 2003, and
Windows XP Professional. Windows XP Home is also supported for
development only using Visual Web Developer Express Edition tool (which
is available for download) or Visual Studio 2005.
Can I develop my ASP.NET pages in Notepad, or do I need to buy
Visual Studio?
Yes, you can use any text editor to create ASP.NET pages. However, you
may find yourself more productive if you use a dedicated tool, such as
Visual Web Developer Express Edition or Visual Studio.
I've installed the .NET Framework, but ASP.NET doesn't seem to work.
What can I do to fix it?
You must have IIS (Internet Information Services) installed before you
install the .NET Framework. If you install IIS after you install the .NET
Framework, you must also register the ASP.NET extensions with IIS. You
can do this by running the aspnet_regiis executable from: %windows root
directory%\Microsoft.NET\Framework\%version of the .NET
Framework%\aspnet_regiis r where %windows root directory% is the
directory Windows is installed to (typically c:\windows or c:\winnt) and
%version of the .NET Framework% is the version of the .NET Framework
you have installed. The directory for .NET 1.0 is v1.0.3705, for 1.1 is
v1.1.4322, and for 2.0 is v2.0.50727.
Where should I put the connection string to my database for my ASP.NET
app?
Keep in mind that securing your connection string will prevent hackers from
accessing information in your databases. For v1.x, the section titled
Storing Database Connection Strings Securely from Building Secure
ASP.NET Applications: Authentication, Authorization, and Secure
Communication outlines many good techniques for protecting this valuable
resource. For v2.0, the walkthrough Encrypting Configuration Information
Using Protected Configuration introduces Protected Configuration and the
new connectionStrings configuration section as the preferred solution for
storing connection string information in configuration files.
Which development tools support ASP.NET?
You can develop ASP.NET sites in any text editor, but Microsoft Visual
Studio and Visual Web Developer Express Edition (available for download)
provide rich support for the complete ASP.NET platform making
development more productive and efficient. As well, Macromedia
Dreamweaver MX and Borland C# Builder also offer ASP.NET development
support.
Are there any prebuilt applications or code samples available for
ASP.NET?
The ASP.NET Visual Web Developer Starter Kits are sample applications
available complete with source code to show you how to build realworld
sites using ASP.NET using Visual Studio or Visual Web Developer
Express Edition. You might also be interested in DotNetNuke, a free
content management system built on ASP.NET. Lastly, there is
CommunityServer, a platform for rapidly enabling online communities,
which includes discussion forums, email lists, newsgroups, blogs, file
galleries, and more.
Where can I find web hosters that support ASP.NET?
Have a look at www.asp.net/hosters
General IIS Questions
This tip comes from the 11/23/2004 edition of the IISAnswers Newsletter.
You can subscribe to the newsletter or find more information at
http://www.iisanswers.com.
Viewing Custom Headers
Q: I have an IIS 6 Server Cluster. I'm trying to make a generic test page
that will show me the cluster member I'm on. I figured a good way to do this
is to assign a Custom Header Variable to IIS such as "Node:" with a value
of "1" or "2" or "3," etc.
I've been on Google all morning and I can't figure out how to display the
value. The value is added to the response object sent to the client and it
seems to happen after the ASP script is completed so I can't do it server
side. I haven't been able to find anything with client side JavaScript about
viewing header information.
A: The custom http headers are meant for the client [browser], not for the
ASP engine. In fact, from what I can tell, asp.dll or aspnet_isapi.dll doesn't
have access to the custom header set up in IIS (except using ADSI/WMI,
but that's different). It's not in the ServerVariables collection since the
ServerVariables collection just contains what was received from the client.
Check out the bottom tip here:
http://www.computerbooksonline.com/tips/asp6.asp
"As you may know, you can use the AddHeader method of the Response
object to add custom http headers to your Web pages, but there's a
"feature" you should be aware of when you do so. The ServerVariables
collection returned by the Request object only contains headers sent from
the browser to the server. Since your custom header was created on the
server and then sent to the browser (the opposite direction), your header
will never be added to the ServerVariables collection. You should be aware
of this if you ever plan to interrogate the ServerVariables collection,
expecting to find a custom header you created in this way. It will never be
there, so such an approach simply won't work! "
Here is another good reference:
http://msdn.microsoft.com/library/default.asp?url=/library/enus/iissdk/iis/
ref_vbom_resomah.asp
The kicker is this:
"You can retrieve the header if a special client returns it to the server on
the next request"
I caught Steve Schofield by IM and he gave me this information from the
IIS help:
"You can use this property to send a custom HTTP header from the Web
server to the client browser. Custom headers can be used to send
instructions from the Web server to the client browser that are not yet
supported in the current HTTP specification, such as newer HTTP headers
that IIS may not inherently support at the time of the product's release. For
example, you can use a custom HTTP header to allow the client browser to
cache the page but prevent proxy servers from caching the page."
Both Steve and I set up some tests and confirmed this. A network capture
confirms that the header is sent back to the client.
It's a matter of order of operation. The ISAPI Filters (which asp and asp.net
run as) appear to be higher on list than when IIS appends the header.
Basically IIS adds the header on the way "out," not "in."
Further on this, if the client [browser] sends a custom header, it needs to
be prefixed with HTTP_ to retrieve it within ASP(.NET).
It appears from the Microsoft link above that it's possible to receive the
header from the client and send back to the server on the 2nd page view. I
tested using a POST and GET but neither appeared to work for me. I
assume that it doesn't happen automatically with IE and would require a
custom client tool to handle this.
JavaScript should be able to get this because JavaScript runs after IIS
added the header.
So, in summary, HTTP custom headers can't be used within ASP for any
type of logic. It's something used for the Client and not the Server.