Category Archives: .Net

What are Portable Class library in c# ?

The whole point of creating a class library project is reusability. Now we want this reusability not only within a .NET application, not across .NET applications but across different types of .NET applications. Now different types of .NET application means WPF, Windows, Silver light, Windows phone etc. That’s where portable class libraries are useful. By creating a portable class we can reference it in any kind of .NET project types.

Windows Azure Blob storage

What is Blob Storage

Windows Azure Blob storage is a service for storing large amounts of unstructured data that can be accessed from anywhere in the world via HTTP or HTTPS. A single blob can be hundreds of gigabytes in size, and a single storage account can contain up to 200TB of blobs if it was created on June 8th, 2012, or later; storage accounts created prior to that date can contain up to 100TB of blobs.

Common uses of Blob storage include:

  • Serving images or documents directly to a browser
  • Storing files for distributed access
  • Streaming video and audio
  • Performing secure backup and disaster recovery
  • Storing data for analysis by an on-premises or Windows Azure-hosted service

You can use Blob storage to expose data publicly to the world or privately for internal application storage.


The Blob service contains the following components:


  • Storage Account: All access to Windows Azure Storage is done through a storage account.
  • Container: A container provides a grouping of a set of blobs. All blobs must be in a container. An account can contain an unlimited number of containers. A container can store an unlimited number of blobs.
  • Blob: A file of any type and size. There are two types of blobs that can be stored in Windows Azure Storage: block and page blobs. Most files are block blobs. A single block blob can be up to 200GB in size.
  • URL format: Blobs are addressable using the following URL format:
  • http://<storage account><container>/<blob>
  • The following example URL could be used to address one of the blobs in the diagram above:

.Net Architecture OVERVIEW

.Net Architecture consists of the guiding principles behind a given application. It is not strongly tied to a particular framework or library.

Design: When you talk about what to do when a user logs in ?

Ex. Usability, portability, accessibility etc.

Architecture: When you talk about what to do when 5000 users logs in simultaneously ?

Ex. Scalability, reliability, availability, performance etc.

Architecture is about style, abstract idea, flow, methodology, concept. Framework is something which implements the style, idea, concept etc..or makes it easier to implement it. example,

Architecture: Every component should have standard pluggable interfaces and it should be possible to connect any component to any other.

Framework: Then lego building blocks can be the framework.

Library: some readymade combinations of blocks that would work as the pillars.

Application: A building structure using the pillars and other building blocks(application).

Framework is a part of architecture implementation. Say, our app will be organized according to .Net architecture and will use .Net framework for that. Different frameworks are organized according to different architectural patterns. Someone can say, that term “framework” is itself describes architectural pattern. Its “opposite” is “library”, because libraries are directly controlled by your application while frameworks use inversion of control and they control execution of your code. Though, there are controversies in using term “framework”.

I think framework is something that is created by someone and available to you to accomplish a objective. Like .Net  is a framework to write GUI and console application. Frameworks takes full control from you but gives you the advantage of not trying to do everything from ground up. In most cases it is better to use a well designed and tested framework, rather than write your own.

In this context architecture is how the framework has been designed and possibly the way to use the framework from you application maintaining the vision of the framework designers.

But broadly architecture is the design principle and can encompass not only software but complete systems as well. Think security, integration, reporting, infrastructure aspects etc.



The .NET Framework represents a unified, object-oriented set of services and libraries that embrace the changing role of new network-centric and network-aware software. In fact, the .NET Framework is the first platform designed from the ground up with the Internet in mind.

Benefits of the .NET Framework

The .NET Framework offers a number of benefits to developers:

§ A consistent programming model

§ Direct support for security

§ Simplified development efforts

§ Easy application deployment and maintenance

ASP.NET and the .NET Framework

ASP.NET is part of Microsoft’s overall .NET framework, which contains a vast set of programming classes designed to satisfy any conceivable programming need. In the following two sections, user can learn how ASP.NET fits within the .NET framework, and user learn about the languages user can use in userr ASP.NET pages.

1.      The .NET Framework Class Library

2.      .NET Framework-Compatible Languages

The .NET Framework Class Library

Maintaining all the functionality for multiple languages in a single wallet requires a lot of work. Why keep reinventing the wheel all the time? Means it’s very hard to remember the syntax, variable type, data type, declaration & function. Wouldn’t it be easier to create all this functionality once and use it for every language?

A Library is a reusable set of types/functions you can use from a wide variety of applications. The application code initiates communication with the library and invokes it.

The .NET Framework Class Library does exactly that. It consists of a vast set of classes designed to satisfy any conceivable programming need. For example, the .NET framework contains classes for handling database access, working with the file system, manipulating text, and generating graphics. In addition, it contains more specialized classes for performing tasks such as working with regular expressions and handling network protocols.

The .NET framework, furthermore, contains classes that represent all the basic variable data types such as strings, integers, bytes, characters, and arrays.

Most importantly, the .NET Framework Class Library contains classes for building ASP.NET pages. User need to understand, however, that user can access any of the .NET framework classes when user are building userr ASP.NET pages.

Understanding Namespaces

The .NET framework is very huge. It contains thousands of classes (over 3,400). Fortunately, the classes are not simply jumbled together. The classes of the .NET framework are organized into a hierarchy of namespaces.

A namespace is a logical grouping of classes.

For example, all the classes that relate to working with the file system are gathered together into the System.IO namespace.

The namespaces are organized into a hierarchy (a logical tree). At the root of the tree is the System namespace. This namespace contains all the classes for the base data types, such as strings and arrays. It also contains classes for working with random numbers and dates and times.

User can uniquely identify any class in the .NET framework by using the full namespace of the class. For example, to uniquely refer to the class that represents a file system file (the File class), user would use the following:


System.IO refers to the namespace, and File refers to the particular class.

Standard ASP.NET Namespaces

The classes contained in a select number of namespaces are available in the ASP.NET pages by default. (User must explicitly import other namespaces.) These default namespaces contain classes that user use most often in the ASP.NET applications:

·         System— Contains all the base data types and other useful classes such as those related to generating random numbers and working with dates and times.

·         System.Collections— Contains classes for working with standard collection types such as hash tables, and array lists.

·         System.Collections.Specialized— Contains classes that represent specialized collections such as linked lists and string collections.

·         System.Configuration— Contains classes for working with configuration files (Web.config files).

·         System.Text— Contains classes for encoding, decoding, and manipulating the contents of strings.

·         System.Text.RegularExpressions— Contains classes for performing regular expression match and replace operations.

·         System.Web— Contains the basic classes for working with the World Wide Web, including classes for representing browser requests and server responses.

·         System.Web.Caching— Contains classes used for caching the content of pages and classes for performing custom caching operations.

·         System.Web.Security— Contains classes for implementing authentication and authorization such as Forms and Passport authentication.

·         System.Web.SessionState— Contains classes for implementing session state.

·         System.Web.UI— Contains the basic classes used in building the user interface of ASP.NET pages.

·         System.Web.UI.HTMLControls— Contains the classes for the HTML controls.

·         System.Web.UI.WebControls— Contains the classes for the Web controls.

.NET Framework-Compatible Languages

Visual Basic is the default language for ASP.NET pages. This includes C# (pronounced See Sharp), JScript.NET (the .NET version of JavaScript), and the Managed Extensions to C++.

Dozens of other languages created by companies other than Microsoft have been developed to work with the .NET framework. Some examples of these other languages include Python, SmallTalk, Eiffel, and COBOL.

The first time user request an ASP.NET page, the page is compiled into a .NET class, and the resulting class file is saved beneath a special directory on the server named Temporary ASP.NET Files. For each and every ASP.NET page, a corresponding class file appears in the Temporary ASP.NET Files directory. Whenever user request the same ASP.NET page in the future, the corresponding class file is executed.

When an ASP.NET page is compiled, it is not compiled directly into machine code. Instead, it is compiled into an intermediate-level language called Microsoft Intermediate Language (MSIL). All .NET-compatible languages are compiled into this intermediate language.

An ASP.NET page isn’t compiled into native machine code until it is actually requested by a browser. At that point, the class file contained in the Temporary ASP.NET Files directory is compiled with the .NET framework Just in Time (JIT) compiler and executed.

The magical aspect of this whole process is that it happens automatically in the background. The user has to do is create a text file with the source code for ASP.NET page, and the .NET framework handles all the hard work of converting it into compiled code for user.


Windows 8: Hide Virtual Keyboard Programmatically

The visibility of the virtual keyboard in Windows 8 Metro Style Apps depends on whether a text input enabled control is focused or not:

In the left image the user tapped into a TextBox control. This tap sets the focus on that TextBox and the virtual keyboard appeared. After having entered some Text the user taps the “OK” button and the virtual keyboard hides again due to the loss of focus (right image).

with-keyboard_thumb1    without-keyboard-copy_thumb1

But sometimes there is no Button control to hit after having entered some text and thus the virtual keyboard does not hide and still might cover important parts of the UI. In order to hide the virtual keyboard no matter where the user taps outside the TextBox one could set the focus to a hidden button programmatically.

See the following example:-

XAML Markup:-

      <Button x:Name="hiddenButton" Opacity="0" />
      <TextBox Width="300" Margin="50" LostFocus="TextBox_LostFocus" />


C# Code Behind:- 

private void TextBox_LostFocus(object sender, RoutedEventArgs e)

Happy Programming :-)

ASP.NET – .NET Interview Questions and Answers Part-1

1. What is ASP.NET?

ASP.NET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services. It is a part of .NET Framework. You can create ASP.NET applications in most of the .NET compatible languages, such as Visual Basic, C#, and J#. The ASP.NET compiles the Web pages and provides much better performance than scripting languages, such as VBScript. The Web Forms support to create powerful forms-based Web pages. You can use ASP.NET Web server controls to create interactive Web applications. With the help of Web server controls, you can easily create a Web application.

2. In which event are the controls fully loaded?

Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event.

3. How can we identify that the Page is Post Back?

Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.

4. What is the lifetime for items saved in ViewState?

The items saved in ViewState live until the lifetime of the current page expires including the postbacks to the same page.

5. How information about the user’s locale can be accessed?

The information regarding a user’s locale can be accessed by using the System.Web.UI.Page.Culture property.

Skip to toolbar