Tuesday, July 9, 2013

What are different types of directives in .NET?

Tags
  • @Page
  • @Control
  • @Import
  • @Implements
  • @Register
  • @Assembly
  • @OutputCache
  • @Reference

What are the types of Authentication?

Tags
Introduction:
When you develop program for customers using ASP.Net, you must think about security. Security should be the one of the most priority components of any web application. Security is much important when you are developing a web application which is public and exposed to billion of users. Asp.net provides classes, structures and methods which ensure that the web application is more secure from any hacking or any outside attacks. Here we will go through the different types of authentications provided by ASP.Net. There is a web.config file in which you can set authentication mode 'forms' or windows'. We will see here the differences and how to you use them.
In dotnet four types of Authentication exists.

1)Windows,
2)Forms and
3)Passport Authentication.
4)Anonymous access

1)Windows authentication utilizes the security related features available into the Windows XP and Windows NT operating systems for authenticating and authorizing Web based applications users.

2)Forms authentication is the second type of authentication that allows you for creating your own database of users and also it validates the identity of those users whenever they open or visit your site.

3)Passport authentication is third authentication that uses the Microsoft centralized authentication provider for identifying visiters or users. This passport authentication provides an easy way for users to use a single identity over many Web based applications.

In order to use Passport authentication in your Web based application, you shoul install the Passport SDK.

4)Anonymous access You can explicitly disable authentication for your application if you know that it will be used only by anonymous users.




What is Authentication and Authorization?

Tags
Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication.
Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

What is the difference between Custom Control and User Control?

Tags
Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application.
User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files.

What are the difference between Structure and Class?

Tags
  • Structures are value type and Classes are reference type
  • Structures can not have constructor or destructors.
  • Classes can have both constructor and destructors.
  • Structures do not support Inheritance, while Classes support Inheritance.

What is the difference between static or dynamic assemblies?

Tags
Assemblies can be static or dynamic.

Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files.

Dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.

What is the difference between Server.Transfer and response.Redirect?

Tags
The Server.Transfer () method stops the current page from executing, and runs the content on the specified page, when the execution is complete the control is passed back to the calling page.
While the Response.Redirect () method transfers the control on the specified page and the control is never passed back to calling page after execution.

What is the difference between early binding and late binding?

Tags
Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

What is the difference between ASP Session State and ASP.Net Session State?

Tags
ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm.

Sunday, June 30, 2013

What is an assembly?

Tags
An assembly is sometimes described as a logical .EXE or .DLL, and can be an application(with a main entry point) or a library.

An assembly consists of one or more files (dlls, exes, html files etc), and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies.

These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing. An important aspect of assemblies is that they are part of the identity of a type. The identity of a type is the assembly that houses it combined with the type name.

This means, for example, that if assembly A exports a type called T, and assembly B exports a type called T, the .NET runtime sees these as two completely different types. Furthermore, don't get confused between assemblies and namespaces- namespaces are merely a hierarchical way of organising type names. To the runtime, type names are type names,regardless of whether namespaces are used to organise the names.

What is reflection?

Tags
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection.

The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly. Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes- e.g. determining data type sizes for marshaling data across context/process/machine boundaries. Reflection can also be used to dynamically invoke methods (see System.Type.InvokeMember), or even create types dynamically at run-time(see System.Reflection.Emit.TypeBuilder).

What does 'managed' mean in the .NET context?

Tags
The term 'managed' is the cause of much confusion. It is used in various places within .NET, meaning slightly different things.

Managed code: The .NET framework provides several core run-time services to the programs that run within it-for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime. Such code is called managed code.

Managed data: This is data that is allocated and freed by the .NET runtime's garbage collector.

 Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword.

As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages -for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class.

What is C#?

Tags
C# is a new language designed by Microsoft to work with the .NET framework. In their "Introduction to C#" whitepaper, Microsoft describe C# as follows:

"C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. C# (pronounced “C sharp”) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++." Substitute 'Java' for 'C#' in the quote above, and you'll see that the statement still works pretty well :-).

What is IL?

Tags
IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language).

All .NET source code (of any language) is compiled to IL during development. The IL is then converted to machine code at the point where the software is installed, or (more commonly) at run-time by a Just-In-Time (JIT) compiler.

What is the CTS, and how does it relate to the CLS?

Tags
CTS = Common Type System. This is the full range of types that the .NET runtime understands. Not all .NET languages support all the types in the CTS.

CLS = Common Language Specification. This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language. This interop is very fine-grained-for example a VB.NET class can inherit from a C# class.

What is the CLI? Is it the same as the CLR?

Tags
There are a number of tools, described here in ascending order of cost: •

The .NET Framework SDK is free and includes command-line compilers for C++, C#, and VB.NET and various other utilities to aid development.

 •ASP.NET Web Matrix is a free ASP.NET development environment from Microsoft. As well as a GUI development environment, the download includes a simple web server that can be used instead of IIS to host ASP.NET apps. This opens up ASP.NET development to users of Windows XP Home Edition, which cannot run IIS.

•Microsoft Visual C# .NET Standard 2003 is a cheap (around $100) version of Visual Studio limited to one language and also with limited wizard support. For example, there's no wizard support for class libraries or custom UI controls. Useful for beginners to learn with, or for savvy developers who can work around the deficiencies in the supplied wizards. As well as C#, there are VB.NET and C++ versions.

•Microsoft Visual Studio.NET Professional 2003. If you have a license for Visual Studio 6.0, you can get the upgrade. You can also upgrade from VS.NET 2002 for a token $30. Visual Studio.NET includes support for all the MS languages (C#, C++, VB.NET) and has extensive wizard support.

What operating systems does the .NET Framework run on?

Tags
The runtime supports Windows Server 2003, Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported.

Some parts of the framework do not work on all platforms - for example, ASP.NET is only supported on XP and Windows 2000/2003.

Windows 98/ME cannot be used for development. IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET.

However, the ASP.NET Web Matrix web server does run on XP Home.

The .NET Compact Framework is a version of the .NET Framework for mobile devices, running Windows CE or Windows Mobile. The Mono project has a version of the .NET Framework that runs on Linux.

Friday, June 28, 2013

What is MIME?

Tags
The definition of MIME or Multipurpose Internet Mail Extensions as stated in MSDN is “MIME is a standard that can be used to include content of various types in a single message. MIME extends the Simple Mail Transfer Protocol (SMTP) format of mail messages to include multiple content, both textual and non-textual. Parts of the message may be images, audio, or text in different character sets. The MIME standard derives from RFCs such as 2821 and 2822”. 

What is localization?

Tags
Localization is the process of customizing applications that support a given culture and regions.

What is globalization?

Tags
Globalization is the process of customizing applications that support multiple cultures and regions.

What is garbage collection?

Tags
Garbage collection is the process of managing the allocation and release of memory in your applications.

What is Boxing/Unboxing?

Tags
Boxing is used to convert value types to object.
E.g. int x = 1;
object obj = x ;
Unboxing is used to convert the object back to the value type.
E.g. int y = (int)obj;
Boxing/unboxing is quiet an expensive operation.

What is a single-document interface (SDI) ?

Tags
A user interface that is created to manage graphical user interfaces and controls into single windows. E.g. Microsoft Word

What is a multiple-document interface(MDI)?

Tags
A user interface container that enables a user to work with more than one document at a time. E.g. Microsoft Excel.