ASP.NET Interview Questions and Answers (1544) - Page 31

Explain what is Profile object?

The Profile objects are persistent and it uses the providers model to store information. It is Strongly typed. This can be used frequently by the Anonymous users.
What is the difference between GetType and TypeOf?

The GetType function, which is used to get the type of an object based on that object that is the instance of that class. It means that, this function needs parameter as an argument of object rather than class name.

But in case of typeOf , we have to pass that class name as a parameter. This function is used to get the type based on a class. That is suppose you will use typeOf function with an object as a argument, then it will give you error.

Example-
string str = “Hello”;

Type val1 = str.GetType();
Type val2 = typeof(string);


Here in the above example in both cases you will get output as true.
Define casting of a data type? What are the two types of data type conversions?

Casting a data type is nothing but converting a variable from one data type to another data type. This can also be called as data type conversion.

There are two types of data type conversions as given below.

Implicit conversions: Here the conversion is type safe i.e. no special syntax is required for this. With this you can convert from derived classes to base classes. In this conversion, there is no chance of data loss.

Explicit conversions: Here the conversion requires a cast operator. Here both source and destination variables are compatible, but might be risk in data loss because of the type or size of destination variable is smaller than the source variable.

Example:
class clsBase=new class();

method m=clsBase; //Implicit conversion
class clsDerive=(class) m; //Explicit conversion

What is the type of struct? Can a struct inherit from another struct or class?

The structs are always value types. A struct cannot be inherited from another struct or class, and also it cannot be the base of a class. But yes, in struct you can instantiate it without using a new operator.
What are the different protocols used by a .Net Web Service?

The protocols are normally used in .Net Web Service for communication purposes. A web service can bind with three different protocols such as Http-Get, Http-Post, and SOAP. These protocols are included in the WSDL file that is automatically generated in .NET application.

It is preferable to use Http-Get and Http-Post only when name/value pairs of data is avilable. But if the data is complex in nature that is XML notes, dataset etc, then we can use SOAP which helps to serialize data in simpler form.
Explain the requirement of ASP.NET web services?

The ASP.NET web services are used for B2B applications like authorizing employees, supplier, signing of invoice etc. These web services are the way to expose the middle tier components through internet. With the help of these components, you can communicate across the firewalls as they use SOAP as a transport protocol which helps to transmit structured data using HTTP channel. The default port is 80 through which we can easily transfer message. The web services are platform independent.
What are the main advantages of binary serialization?

The main purpose of using serialization and deserialization is to transfer the data in a linear form over a network.

The advantage of using serialization is the ability of an object to be serialized into a persistent or a non-persistent storage media and then reconstructing the same object later by de-serializing the object. The Binary Serialization is faster, which supports complex objects with read only properties and even circular references.
Which one of the following file store the method signature information for an XML WebService ?

NOTE: This is objective type question, Please click question title for correct answer.
What is the Difference between Convert.ToString() and .ToString()

Generally Convert.ToString() handles NULLs where as .ToString will return a Null Reference Exception.

So it would be good if we use Convert.ToString() all the time for casting purposes.
What is the difference between Panel and GroupBox classes in .NET?

The both classes that is Panel and GroupBox can be used as a container for other controls such as check box control, radio button control etc. But the difference between these two classes is
• In case of Panel class captions cannot be displayed i.e. we can’t set caption but in GroupBox class captions can be displayed.
• The Panel class can have scroll bars but GroupBox class cannot have scroll bar.
What is connection pooling and how do you make your application use it?

When you want to connect to the database, you have to open database connection which decreases the performance and also it is a time consuming operation. So with the help of connection pooling, you can increase the performance of the applications that is you can reuse the active database connections instead of creating new connection for each and every request made to the database. Its behavior is controlled by the connection string parameters. Below are 4 parameters which help to control connection pooling behavior.

• Connect Timeout
• Max Pool Size
• Min Pool Size
• Pooling

Please refer following link for more
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q169470
When it will be advisable to use html server controls and when it will be advisable to use web server controls?

In general, the server controls are the part of ASP.net application. When we are using server control, then it creates an extra overhead on the server to create the control and set the values at run time. The ASP.net applications well supported to HTML controls which are static in nature and easy to use.

Apart from that if a corresponding HTML control available instead of server control, then it is advisable to go for HTML control as it enhances the server performance and gives faster response. The web server controls can be used when the requirement is not achieved by the HTML server control or the available HTML controls are not sufficient to achieve the task.
How to make an ASP page to refresh after certain time ?

Inorder to make a particular page to be refreshed after a particular time at page level of the asp page we need to specify like this :

<meta http-equiv="refresh" content="15" />


The above statement will make a particular page to be refreshed for every 15 seconds.

In real time if we see cricinfo webpage for every default period of time the page gets refreshed.
How does SMTP support web applications ?

Simple Mail Transfer Protocol (SMTP ) is the standard for sending electronic mails(e-mail) across IP networks.

Using some pre-defined class in the System.Net.Mail and System.Net.Mime assemblies we can send mails to one or more recipients.

These mails can also be sent with alternative views and it can even handle the file attachments.
How does the Transaction topic work in asp ?

In Asp there is an Assembly called System.Transactions which contains classes that allows the applications to work under the transactions which were organised by
Microsoft Distributed Transaction Coordinator (MSDTC ) and
Local Transaction Manager(LTM ).

This System.Transactions assembly allows both implicit and expict way of operation

The Explicit programming model is based on the Transaction class and
The Implicit programming model using the Transaction Scope class.
What are the simple Escape sequences write with their unicode Character encoding.

There are 11 Different simple Escape Sequences they are :

Escape Sequence = \' ,CharacterName= SingleQuote and UnicodeEncoding=0x0027

Escape Sequence = \'' ,CharacterName= DoubleQuote and UnicodeEncoding=0x0022

Escape Sequence = \\ ,CharacterName= BackSlash and UnicodeEncoding=0x005c

Escape Sequence = \0 ,CharacterName= Null and UnicodeEncoding=0x0000

Escape Sequence = \a ,CharacterName= Alert and UnicodeEncoding=0x0007

Escape Sequence = \b ,CharacterName= BackSpace and UnicodeEncoding=0x0008

Escape Sequence = \f ,CharacterName= FormFeed and UnicodeEncoding=0x000c

Escape Sequence = \n ,CharacterName= NewLine and UnicodeEncoding=0x000A

Escape Sequence = \r ,CharacterName= CarriageReturn and UnicodeEncoding=0x000D

Escape Sequence = \t ,CharacterName= HorizantalTab and UnicodeEncoding=0x0009

Escape Sequence = \v ,CharacterName= VerticalTab and UnicodeEncoding=0x000B
Why this Error comes during compilation of our ASP page ? Parser Error Message: It is an error to use a section registered as allowDefinition='MachineOnly' beyond machine.config.

This happens because ,

In our web.config file we might have declared a section that is not configurable on our shared web hosting platform. So when we get this error we have to remove that part which is not supported in the web.config file.
What is the use of culture attribute of the globalization element in web.config?

The main aim of this attribute is to specify the Web application which deals with various culture-dependent issues, such as date time, formatting of document etc. Here the role of globalization element is to create culture-specific Web applications. It overrides the globalization settings in the application’s root Web.config file as it contains the globalization settings for each culture. To implement this, just add the Web.config files to the subordinate folders present in your application.
Explain advantages and disadvantages of using detect and redirect approach to globalize the web application?

The advantages are:
• The content file that is web forms or HTML pages can be written in the appropriate language without any complexity including the resource strings.

• Here the content is maintained separately, which allows different applications according to the requirement of different information.

• With the help of this, the user can meet their needs as it is automatically directed to sites that are likely to be geographically close.

The disadvantages are:
• It requires the performed sections of the web application to each culture-specific website be compiled and deployed separately.

• It requires more exertion to maintain the stability and to debug problems across the web applications.
How you can determine validity of an XML document?

The Document Type Definition (DTD) or the XML Schema determines the validity of an XML document. Because the XML documents are compared with DID and schema rules as specified in that.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories