20 ASP.NET Questions: Answered. Part Four

Category: ASP.NET

20 ASP.Net Questions [Questions 16-20]

View Part Three here


This article was created to be used as reference material for beginners through Intermediate developers. I have assembled 20 questions that I feel every developer should know when developing web applications and even Window’s application within the Visual Studio C# environment.
In this final installment of these articles we will answer questions sixteen through twenty and complete our list of 20 questions.

I just signed up at Server Intellect and couldn't be more pleased with my Windows Server! Check it out and see for yourself.

What we will learn in this article:

  • What are Generics?
  • What is JavaScript?
  • What is WCF?
  • What is Encryption?
  • What is an Assembly?

Getting started with our list - What are Generics?

In C# development Generics provide a facility for generating data structures that are designed to handle specific types when declaring variables. Programmers define these parameterized types so that each variable of a particular generic type has the same internal algorithm.
However, the types of data and method signatures can vary based on a programmer’s preference. To minimize the learning of Generics for developers, the creators of C# chose a syntax that matched the similar templates concept of C++. In C#, therefore, the syntax for generic classes and structures will utilize the same notations to identify the data types on which the generic declaration specializes.

In the previous versions of .Net generalization was accomplished by the casting of types to and from the global base type of “System.Object”. Generics offered a solution to this limitation in the common language runtime and the C# language.
This limitation in the C# language can be demonstrated with the help of an ArrayList collection class from the .NET Framework base class library. The ArrayList is a highly convenient collection class that can be used without any modifications to store any reference or value type.

ArrayList aList = new ArrayList();

ArrayList bList = new ArrayList();
bList.Add("Another String");

However, this ability came at somewhat of a cost. That cost was that any reference or value type that is added to the ArrayList will be implicitly typecast to “System.Object”. Meaning, if the items that you are storing are value types, they will have to be boxed when added to the list, and then they will have to be unboxed when they are retrieved from the ArrayList.

Server Intellect offers Windows Hosting Dedicated Servers at affordable prices. I'm very pleased!

The casting and the boxing and unboxing operations will degrade your performance and the effect of boxing and unboxing could possibly be quite significant in situations where you will have to iterate through larger collections.
What this called for and what we would need would be flexibility of the ArrayList, however, it should also be more efficient and should provide you some way of type validation by the compiler, that is, without sacrificing on the reusability of that class with different data types.
What we are actually saying is that we want an ArrayList with a type parameter and that is precisely what generics provided. Generics would eliminate the need for all items to be type cast to “System.Object” and would also enable the compiler to do some type validation.
In the generic List collection, in the System.Collections.Generic namespace, the same operation of adding items to the collection looks like this:

List aList = new List();

In the above example you will notice that there is no need for any boxing or casting.
For the client code, the only added syntax with List compared to ArrayList is the type argument in the declaration and in the instantiation of the List. In return for this slightly greater coding complexity, you can create a list that is not only safer than an ArrayList, but also significantly faster, especially when the list items are value types.

What is JavaScript?

JavaScript can be described as a scripting language that is built into most if not all browsers, it is used within these browsers for client side operations like form validation and numeric manipulation to name just a couple of uses.
Java itself is a programming language that is capable of developing fully functional programs. Java's most endearing characteristic is that it is compiled into intermediate code which can be interpretively run on multiple platforms, something .Net envies. Java can also create applets, and code which can run with some restrictions on web browsers.

Try Server Intellect for Windows Server Hosting. Quality and Quantity!

The biggest drawback of Java is that java applets can be slow to start in a web browser. Java is a programming language just like VB and C, and JavaScript is for web pages.
You can use JavaScript to enhance a lot of the aspects of the way your web pages will work. For instance, you can call a procedure when a user of your web page clicks on a button, or a link. You can then call a JavaScript procedure that will specify what will happen next.
Here is a small example of some JavaScript:

What is WCF?

WCF stands for “Windows Communication Foundation”. Below is a description of WCF from the Microsoft Web Site along with a URL for you to find out even more about WCF.
Windows Communication Foundation (WCF) is Microsoft’s unified programming model for building service-oriented applications. It enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing investments.”

WCF uses a service description WSDL to expose its service interface and the associated data
contract. It is reasonable to assume that only those public parts (properties and method signatures that are exposed) can be accessed by the client-side.
The default implementation (such as the validation logic within a method) is implementation
specific which is not compliant to service oriented or contract based development.
Keep in mind that WCF is designed to be coded once and configured appropriately within production. Tasks like adding your endpoints should not be addressed at the code level, they
should be handled by a support professional that is 'in production' which has no access to the code base.

System Requirements

-WCF is installed by default on Windows Vista.

-WCF can also be installed on Windows XP SP2, Windows Server 2003 R2, or Windows Server 2003 SP1.

Server Intellect assists companies of all sizes with their hosting needs by offering fully configured server solutions coupled with proactive server management services. Server Intellect specializes in providing complete internet-ready server solutions backed by their expert 24/365 proactive support team.



Note The Message Queuing (MSMQ) functionality of WCF is supported only on Windows Vista, Windows Server 2003 R2, Windows Server 2003 SP1, and Windows XP Professional.

What is Encryption?

The process of encryption uses various methods to hide data or the contents of any type of message in such a way that the original information contained within that data or message can only be recovered through a corresponding decryption process that corresponds to the original decryption process, essentially reversing the process.
Encryption and decryption are common techniques in cryptography. The terminology “Cryptography” is the scientific discipline behind secure communications. Many different encryption and decryption processes or algorithms exist. Because of the free access to technologies in cryptography it is very difficult to keep the core logic of an algorithm truly secret. Especially since the introduction of the Internet, it is generally much easier to use these well-known public algorithms then rely on the alternative forms of protection.

What is a Key?
In computer cryptography, a key is a long sequence of bits used by encryption / decryption algorithms. For example, the following represents a 16-bit key:

private byte[] _strPrivateKey = { 15, 31, 43, 57, 21, 77, 51, 4, 1, 77, 6, 34, 64, 61, 72, 68 };

For most block encryption algorithms, a block is 16 bits or 32 bits. In our example we are using a 16 bit key.
In any given encryption algorithm it takes the original message, and a generated key, and then alters the original message mathematically based on that key's bits to create a new encrypted message. In the same sense, the decryption algorithm takes that encrypted message and will restore it to its original form.
Some if not most cryptographic algorithms will use a single key for both the encryption and the decryption processes. This key must be kept secret and not made public; if not, anyone who locates that key you used to send that important message could use that key in their decryption algorithm and read that message., basically making the encryption non-existent .
The following is an example of an encrypted value that has been encoded in a Base64 string. Base64 is a well known and broadly used method to send binary data as pure text.

If you're looking for a really good web host, try Server Intellect - we found the setup procedure and control panel, very easy to adapt to and their IT team is awesome!


What is an Assembly?

An assembly is a reusable, versionable, and self-describing building block of a common language runtime application. An assembly can span multiple modules and multiple files; the file is just a container for a module or a number of modules.
An assembly's name is stored in metadata and has a significant impact on the assembly's scope and use by an application. A strong-named assembly has a fully qualified name that includes the assembly's name, culture, public key, and version number. This is frequently referred to as the display name, and for loaded assemblies can be obtained by using the FullName property.
The runtime uses this information to locate the assembly and differentiate it from other assemblies with the same name. For example, a strong-named assembly called myTypes could have the following fully qualified name:

myTypes, Version=1.0.1234.0, Culture=en-US, PublicKeyToken=b77a5c561934e089c, ProcessorArchitecture=msil

This example and more on Assemblies and Assembly names can be found at:

What we have Learned

We used over 10 web hosting companies before we found Server Intellect. Their dedicated servers and add-ons were setup swiftly, in less than 24 hours. We were able to confirm our order over the phone. They respond to our inquiries within an hour. Server Intellect's customer support and assistance are the best we've ever experienced.

We have completed our list of twenty questions. We have delved into the various topics within our list and hopefully have given you a little insight to some of the answers you were looking for?
Here is a summary of the topics we covered:

  • What is a Postback?
  • What is a Master Page?
  • What is Session?
  • What is a Web Service?
  • What is the difference between server-side and client-side code?
  • What is AJAX?
  • What is View State?
  • What is XML?
  • What is XSLT?
  • What is Captcha?
  • What is FTP?
  • What is Serialization?
  • What is Refactoring?
  • What is Unit Testing?
  • What is Generics?
  • What are Generics?
  • What is JavaScript?
  • What is WCF?
  • What is Encryption?
  • What is an Assembly?


There is no attachment associated with this article.