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

Discuss the advantages of Passport Authentication..

The main advantages of this passport authentication are mentioned as below:
For various websites, the user need not have to remember the username and passwords.
In a single location,the user can maintain his profile information.
Passport authentication also provides access to other Microsoft services, such as Passport Express Purchase.
Explain about Passport SDK..

Passport SDK means Passport software development kit.
This passport SDK should be installed for using passport authentication.
This kit is free for preproduction development and testing.
Explain the working of Passport Authentication..

The work flow of passport authentication is as follows:
When a user tries to access a passport authentication based application,ASP.NET will check for a current passport authentication cookie in the user's machine.If none is found, then the ASP.NET will directs to a passport-sign-on page.
Once the user gets signed-in, then the Passport service will authenticates the user.
Then it will store an authentication cookie on the user’s computer.
After that it will direct the user back to the originally requested Web page.
Explain the steps to be followed to use Passport Authentication..

Below are the steps to follow for using Passport Authentication:

1. In the first step, the Passport SDK should be installed. Although the .NET Framework does include classes for working with the Passport SDK once it is installed,Passport is not included with Visual Studio.
2. You have to set the application’s authentication mode to Passport in Web.config. And also set the authorization to deny unauthenticated users.
3. Inorder to access the user’s Passport profile to identify and authorize the user, you have to use the PassportAuthentication_OnAuthenticate event
4. Inorder to remove Passport cookies from the user’s machine, implement a sign-out procedure.
What is meant by Scalability ?

Scalability is the ability to add capacity to maintain the web applications which serves large number of users or large amounts of data. This is nothing but to add the capacity to an application to maintain large data.
How can you specify that ASP.NET runs on all or some of the CPUs,if your web server has multiple processors ?

You can specify that ASP.NET runs on all or some of the CPUs, if your web server has multiple processors. This is done in the server’s Machine.config file,by setting the webGarden attribute of the processModel element.
What are the conclusions on Application and Session state variables in a web farm or a web garden?

In the user's session, a single client can interact with different servers or CPU's.
This has the following implications for Application and Session state variables:

1) Application state variables are unique to each separate instance of the Web application.
If the Web application is running on a Web garden or a Web farm, Clients can share information through Application state.

2) Session state variables are stored in-process by default.
You have to specify a Session state provider inorder to enable Session state in a Web garden or Web farm.
How can you share data across multiple sessions in a web farm or a web garden ?

Firt of all you must save and restore the information using a resource that is available to all the processes inorder to share data across multiple sessions in a web farm or a web garden.
This process can be achieved through an XML file, a database, or some other resource using the standard file or database access methods.
How can you share Session state information across a Web garden or Web farm ?

You can share Session state information across a Web garden or Web farm in two ways which are provided by ASP.NET.They are:

1) A state server, as specified by a network location:
This is a simple technique to implement.This technique doesn’t require you to install Microsoft SQL Server.

2) A SQL database, as specified by a SQL connection:
Inorder to store and retrieve the state information, this technique will provide the best performance.
Give the steps to follow to share Session state information using a state server..

Below are the steps to follow to share Session state information using a state server:

1) You have to set the sessionState element’s mode and stateConnectionString attributes in the Web application’s Web.config file.
2) In the second step, you have to run the aspnet_state.exe utility on the Session state server.
This aspnet_state.exe utility is installed in the \WINDOWS\Microsoft.NET \Framework\version folder when you install Visual Studio .NET Professional or Visual Studio .NET Enterprise Architect editions.
Give the steps to follow to share Session state information using a SQL database..

Below are the steps to follow to share Session state information using a SQL database.

1) You have to set the sessionState element’s mode and sqlConnectionString attributes in the Web application’s Web.config file.
2) Secondly, you have to run the InstallSqlState.sql utility on the Session state server. This InstallSqlState.sql utility will install the SQL database which shares Session state information across processes.
The InstallSqlState.sql utility is installed in the \WINDOWS\Microsoft.NET \Framework\version folder when you install Visual Studio .NET Professional, Visual Studio .NET Enterprise Developer, or Visual Studio .NET Enterprise Architect editions.
What is the use of monitoring a deployed web application ?

Inorder to know how well the application is working, you have to monitor the web application once it is deployed.
This monitoring is because,many issues may occur as mentionsd below:
1) Mainly the issues may occur based on the number of users accessing the application.
2) The issue may also occur due to the unpredictable nature of the user's interaction.
3) It may also due to the possibility of the malicious attack.
What steps are to be followed while maintaining a deployed web application ?

There are 3 steps that are involved in maintaining a deployed web application.They are:
1) The application should be monitored for error,performance and security errors.
2) After the issues have been discovered,the application must be repaired.
3) The application must be tuned such that it should handle the user traffic.
Can you repair a deployed web application without restarting the server or IIS ?

Yes, you can repair a deployed web application without restarting the server or IIS.
This can be done by copying the new assembly (.dll) and/or content files (.aspx, .ascx, and so on) to the application folder on the server.
When you replace the assembly, ASP.NET automatically restarts the application.There is no need of installing or registereing the assembly on the server.
What is the use of processModel element ?

The main use of this processModel element is to provide process recycling.
This will also provides the attributes to control the performance cases such as,
1) It will let the maximum nunber of requests to be queued.
2) How long to wait before checking whether a client is connected.
3) How many threads to allow per processor.
Explain about Register directive's attributes ?

There are 3 Register directive's attributes.They are:
1) TagPreFix
2) Namespace
3) Assembly

TagPreFix:
This TagPreFix name will identify the group to which the user control is belonged to.
Example:
The tag prefix for ASP.NET server controls is “asp”.
You can use this prefix for creating a naming convention to organize your custom controls.

Namespace:
This contains the controls that are to be registered within the custom control assembly.This is a project name within the custom control assembly.

Assembly:
It consists of the custom controls.This is the name of the assembly(.dll). The Web Application must refer the control assembly.Referencing the assembly maintains a copy of it in the Web application’s /bin directory.
Explain the advantages of using Query Strings ?

Below mentioned are some of the advantages of using query strings:

1) The implementation of querystrings is easy.
2) For passing values in a querystring, the browser support is nearly universal.
3) These querystrings donot require server resources.The HTTP request for a specific URL contains these Querystrings.
Discuss the disadvantages of using querystrings in sending data from one page to another ?

There are disadvantages along with advantages while using these querystrings.They are:
1) By using the querystrings, the information is directly visible to the user in the browser address line.So using these querystrings is insecure.
2) The URL's consists of a 255 URL character limit which will limit their flexibility.
Where will the control flow if an exception occurs inside a try block ?

If an exception occurs inside a try block, then the control flow passes immediately to the next catch statement. When control flow passes to a catch block, the statements contained in the catch block are processed to handle the exception.

Example:

int SafeDivision(int x, int y)
{
try
{
return (x / y);
}
catch (System.DivideByZeroException dbz)
{
System.Console.WriteLine("Division by zero attempted!");
return 0;
}
}

Will the finally block gets executed, if an exception occurs ?

Yes, the finally block gets executed, if an exception occurs.
A finally block will be executed irrespective of the exception has occured or not.
Example:

public class EHClass
{
void ReadFile(int index)
{
// To run this code, substitute a valid path from your local machine
string path = @"c:\users\public\test.txt";
System.IO.StreamReader file = new System.IO.StreamReader(path);
char[] buffer = new char[10];
try
{
file.ReadBlock(buffer, index, buffer.Length);
}
catch (System.IO.IOException e)
{
Console.WriteLine("Error reading from {0}. Message = {1}", path, e.Message);
}
finally
{
if (file != null)
{
file.Close();
}
}
// Do something with buffer...
}
}


Finally is used to ensure that some cleanup is performed.
In the above example, you might try to open a file and read it. If opening succeeds, but read fails, you will have an open file dangling. What you would like in that case is to have it closed, which you would do in finally block - this block always gets executed, guaranteeing the closing of the file.
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