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

Is it better to use static class to initialize global variables ?

Yes, it is better to use static class to initialize global variables.

(1) Performance is increased as static members are efficinet handled in dotnet framework.

(2) Using class eliminates the boxing and unboxing steps.
(3) Less memory usage



Thanks and Regards
Akiii
What are Application Object ?

Application object as application level global variable in which any type of data can be stored. This data is automatically stored in the application domain and can be used until the application is online.



Thanks and Regards
Akiii
A data stored in application object can be accessed in all user session ?

NOTE: This is objective type question, Please click question title for correct answer.
How will you store a data in Application Object ?

Application["Akiii"] = "This is the value that is stored";


In the above, "Akiii" is the name of the application object variable by which we will get the value.
In the right hand side is the value of the application object.



Thanks and Regards
Akiii
How to lock an Application object variable so that multiple page requests cannot change/access its value ?

Application.Lock();

Application["Akiii"] = "This is the value that is stored";
Application.UnLock();



If you are doing multi-threaded programming then it is better to lock the global variable otherwise it may cause useless data read/write.



Thanks and Regards
Akiii
How will you access the Application object value in a different page ?

Suppose :-

Application["Akiii"] = "This is the value";


To access the above application object global variable in a different object, we have to do the following :-

string strGlobal = Application["Akiii"].ToString();


In the above, it is essential to use ToString method to convert the value otherwise it will give an compilation error stating "An object cannot be casted to string".



Thanks and Regards
Akiii
What is Reactive Extensions(Rx) in .net framework ?

It is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.

In Rx, you can represent multiple asynchronous data streams (that come from diverse sources, e.g., stock quote, tweets, computer events, web service requests, etc.) and subscribe to the event stream using the IObserver<T> interface. The IObservable<T> interface notifies the subscribed IObserver<T> interface whenever an event occurs.

Rx library is available for desktop application development in .NET. It is also released for Silverlight, Windows Phone 7 and JavaScript.
What is the difference between Forms authentication and login controls ?

Login controls in asp.net provides form authentication. If we implement authentication without login controls then we have to do it from scratch.

Login control allows easy implementation of form authentication without writing much of code. Underneath the controls, the class used for login control is also FormAuthentication class. So instead of creating your own set of user credential validations and issuing of authentication ticket, it is simpler to use asp.net login control. ASP.NET membership mechanism is used in Login controls.
What is Fragment Caching ?

Fragment caching is a mechanism in which specific portions of a page is cached rather than the whole page. This is done by the use of user controls.

<%@ OutputCache Duration="90" VaryByParam="None"  %>




Thanks and Regards
Akiii
What is reason for the use of Partial Classes in .net?

Partial Classes are used when there is some class which is big enough to have multiple number of developers implement the methods in it. This class can be separated and written in different files with the same class name and with a keyword "partial" appended in front of them.

Physically partial classes may be separate but logically they are treated as a single file by the compiler.



Thanks and Regards
Akiii
Explain briefly, how Passport authentication works ?

The steps regarding Passport Authentication are as below :-

(1) Install the Passport SDK
(2) Set the application’s authentication mode to Passport in Web.config(by default it is windows)
(3) Set authorization to deny unauthenticated users
(4) Use the PassportAuthentication_OnAuthenticate event to access the user’s Passport profile to identify and authorize the user. It checks the user’s machine for a current passport authentication cookie
(5) Implement a sign-out procedure to remove Passport cookies from the user’s machine


Thanks and Regards
Akiii
Mention 2 advantages of Passport Authentication ?

(1) With Passport authentication one can also avail access to various Microsoft services

(2) User doesn’t have to remember separate user names and passwords for various Web sites. User can maintain his or her profile information in a single location.




Thanks and Regards
Akiii
A Web form that is frequently used and does not contain data that frequently changes is good for caching ? True or False

NOTE: This is objective type question, Please click question title for correct answer.
What is the significance of duration attribute of @OutputCache page directive ?

<%@OutputCache Duration="120" %>


In the above, the duration for the output cache of the page is 120 seconds. That means the page is cached for 120 seconds; the server loads the response in memory and retains that response for 120 seconds. Any requests during that time receive the cached response. When the cache duration expires, the next request generates a new response and cached for another 120 seconds.

Caching can be an overhead or a blessing in disguise. It is better to use them wisely !



Thanks and Regards
Akiii
If any fields/property/method is declared as static, will the data be global? True or False

NOTE: This is objective type question, Please click question title for correct answer.
In ASP.NET Session Management, State Server uses which process to store the data ?

NOTE: This is objective type question, Please click question title for correct answer.
What is STRIDE ?

Threats faced by the application can be categorized based on the goals and purpose of the attacks.

STRIDE is the acronym used at Microsoft to categorize different threat types. STRIDE stands for

1) Spoofing
2) Tampering
3) Repudation
4) Information Disclosure
5) Dos (Denial of service)
6) Elevation of privilege.
What is WebSocket Protocol ?

Current HTTP protocol isn’t designed to be a real-time medium means modern web applications use classic polling solutions(via Ajax) to give the impression of continuous feel.

Polling is a good solution, even though it might suffer from client-to-server and server-to-client latency.

So, we can overcome a structural limitation of the HTTP protocol using WebSocket protocol. It enables bidirectional communication between Web applications and Web servers over a single TCP socket.

It also make possible for a Web application hosted in a browser to stay connected with a Web endpoint all the time while incurring minimal costs such as pressure on the server, memory and resource consumption.
What is WIF ?

Window identity foundation (WIF) enables .NET developers to externalize identity logic from their application, improving developer productivity, enhancing application security, and enabling interoperability.

It is part of Microsoft's identity and access management Solution built on Active Directory that also includes:

1) Active Directory Federation Services 2.0 : a security token service for IT that issues and transforms claims and other tokens, manages user access and enables federation and access management for simplified SSO (Single Sign-on)


2) Windows Azure Access Control Services: provides an easy way to provide identity and access control to web applications and services.
What is Json.net ?

It is a open source,high-performance JSON framework for .NET. It provides following features

1) Convert JSON to and from XML.
2) Faster than .NET's built-in JSON serializers.
3) Supports .Net Framework 2.0/3.5/4.0, Silverlight, Windows Phone and Windows 8 Metro.
4)Fexible JSON serializer for converting between .NET objects and JSON.
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