Interview Questions
Interview Questions
View Answer
How do you turn off cookies for one page in your site? View Answer
True or False: A Web service can only be written in .NET? View Answer
Answers:
Choosing a programming language depends on your language experience and the scope of
the application you are building. While small applications are often created using only one
language, it is not uncommon to develop large applications using multiple languages.
For example, if you are extending an application with existing XML Web services, you might
use a scripting language with little or no programming effort. For client-server applications,
you would probably choose the single language you are most comfortable with for the
entire application. For new enterprise applications, where large teams of developers create
components and services for deployment across multiple remote sites, the best choice might
be to use several languages depending on developer skills and long-term
maintenance expectations.
The .NET Platform programming languages - including Visual Basic .NET, Visual C#,
and Visual C++ with managed extensions, and many other programming languages from
various vendors - use .NET Framework services and features through a common set of unified
classes. The .NET unified classes provide a consistent method of
accessing the platform's functionality. If you learn to use the class library, you will find that
all tasks follow the same uniform architecture. You no longer need to learn and master
different API architectures to write your applications.
In most situations, you can effectively use all of the Microsoft programming languages.
Nevertheless, each programming language has its relative strengths and you will want to
understand the features unique to each language. The following sections will help you choose
the right programming language for your application.
Visual Basic has many new and improved features such as inheritance, interfaces, and
overloading that make it a powerful object-oriented programming language. Other new
language features include free threading and structured exception handling. Visual Basic fully
integrates the .NET Framework and the common language runtime, which together provide
language interoperability, garbage collection, enhanced security, and improved versioning
support. A Visual Basic support single inheritance and creates
Microsoft intermediate language (MSIL) as input to native code compilers.
Visual Basic is comparatively easy to learn and use, and Visual Basic has become the
programming language of choice for hundreds of thousands of developers over the past
decade. An understanding of Visual Basic can be leveraged in a variety of ways, such as
writing macros in Visual Studio and providing programmability in
applications such as Microsoft Excel, Access, and Word.
Visual Basic provides prototypes of some common project types, including:
? Windows Application.
? Class Library
? Console Application.
? Windows Service.
? Windows Service.
Visual C# .NET
Visual C# (pronounced C sharp) is designed to be a fast and easy way to create .NET
applications, including Web services and ASP.NET Web applications. Applications written in
Visual C# are built on the services of the common language runtime and take full advantage
of the .NET Framework.
C# is fully integrated with the .NET Framework and the common language runtime, which
together provide language interoperability, garbage collection, enhanced security, and
improved versioning support. C# simplifies and modernizes some of the more complex
aspects of C and C++, notably namespaces, classes, enumerations,
overloading, and structured exception handling. C# also eliminates C and C++ features such
as macros, multiple inheritance, and virtual base classes. For current C++ developers, C#
provides a powerful, high-productivity language alternative.
Visual C# provides prototypes of some common project types, including:
? Windows Application.
? Class Library.
? Console Application.
? Windows Service.
What is CLR?
CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that converts a
MSIL code into the host machine language code, which is then executed appropriately. The
CLR is the execution engine for .NET Framework applications. It provides a number of
services, including:
? Interoperation between managed code, COM objects, and pre-existing DLL's (unmanaged
code and data)
The common type system defines how types are declared, used, and managed in the
runtime, and is also an important part of the runtime's support for cross-language
integration. The common type system performs the following functions:
Establishes a framework that helps enable cross-language integration, type safety, and high
performance code execution. Provides an object-oriented model that supports the complete
implementation of many programming languages. Defines rules that languages must
follow, which helps ensure that objects written in different languages can interact with each
other.
View state & session state are objects which are used for maintaining a state.
but view state maintains a state in a single page. if we go to another page the state will be
lossed. But session state we can maintain a state as long as browser opened or session time
expired.
What is the root class in ..NET?
ADO
1. This object model could be used even for non RDBMS products. We can read data from
xml excel csv files also.
2. ADO objects are dependent on OLEDB providers and OLEDB providers would connect to
the back end.
ADO.NET
1. It is not an enhanced version of ADO. Its a new object model which has some objects
similar to ADO.
In classic ASP all Web site related information was stored in the metadata of IIS. This had the
disadvantage that remote Web developers couldn't easily make Web-
site configuration changes. For example, if you want to add a custom 404 error page, a setting
needs to be made through the IIS admin tool, and you're Web host will likely
charge you a flat fee to do this for you. With ASP.NET, however, these settings are moved
into an XML-formatted text file (Web.config) that resides in the Web site's root directory.
Through Web.config you can specify settings like custom 404 error pages, authentication and
authorization settings for the Web site implication options for the ASP.NET Web pages, if
tracing should be enabled, etc.
The Web.config file is an XML-formatted file. At the root level is the <configuration> tag.
Inside this tag you can add a number of other tags, the most common and useful one being the
system.web tag, where you will specify most of the Web site configuration parameters.
However, to specify application-wide settings you use the
<appSettings> tag
.
For example, if we wanted to add a database connection string parameter we could have a
Web.config file like so:
<configuration>
<!-- application specific settings -->
<appSettings>
<add key="connString" value="connection string" />
</appSettings>
<system.web>
...
</system.web>
</configuration>
Now, in any of your ASP.NET Web pages in this Web site you can read the value of the
connString parameter like so:
ConfigurationSettings.AppSettings("connString")
To avoid this complication you can "group" your application's settingsinto a unique tag in the
Web.config file. That is, you can create a tag named: <MyAppSettings> in Web.config and
then use the as we did earlier to add application-wide settings. To add a custom tag to
Web.config you need to first explicitly specify the new tag name in Web.config via the
<configSections> tag, like so:
<configuration>
<configSections>
<section name="MyAppSettings"
type="System.Configuration.NameValueFileSectionHandler,
System, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
</configSections>
...
</configuration>
This <section ... /> tag indicates that we are going to be adding a custom tag named
MyAppSettings. Now we can add a <MyAppSettings> tag to our Web.config file and
add <add ... /> tags to add application-wide parameters, like so:
<configuration>
<configSections>
<section name="MyAppSettings"
type="System.Configuration.NameValueFileSectionHandler,
System, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
</configSections>
<MyAppSettings>
<add key="connString" value="connection string" />
</MyAppSettings>
...
</configuration>
To read this custom value from an ASP.NET Web page we use the following syntax:
ConfigurationSettings.GetConfig("MyAppSettings")("connString")
Example:
we develop a project for a company, that company shifted a new place so address is changed.
In this time what we do simply changes in web.config file.