Sunday, May 25, 2014

Debugging & Tracing Interview Questions on ASP.Net(3)



Debugging & Tracing Interview Questions on ASP.Net(3)

 
1.What is the difference between Trace and Debug?

A.Use Debug class to debug builds.
Use Trace class for both debug and release builds.

2.What is Tracing?

A.Tracing displays the details about how the code was executed. It refers to collecting information about the application while it is running. Tracing information can help you to troubleshoot an application. It enables you to record information in various log files about the errors that might occur at run time.

3. How many types of exception handlers are there in .NET?

A.        1. Unstructured Exception Handling
2. Strutured Exception Handling

Global.asax Interview Questions on ASP.Net(4)



Global.asax Interview Questions on ASP.Net(4)

 
1. What is the use of the Global.asax file?

A.The Global.asax file executes application-level events and sets application-level variables.

2.How many Global.asax files can be there in single Website?

A.One

3.What are the different types of Global.asax?

A.Application_Start
    Application_End
    Session_Start
    Session_End
    Application_BeginRequest
    Application_AuthenticateRequest
    Application_Error

4.What are the Application_Start and Session_Start subroutines used for?

A.This is where you can set the specific variables for the Application and Session objects.

Security Interview Questions on ASP.Net(21)



Security Interview Questions on ASP.Net(21)

 
1. What is CAS?

A.CAS is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running. For example, it is CAS that will prevent a .NET web applet from formatting your hard disk. How does CAS work? The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set. For example, using the default security policy, a control downloaded from a web site belongs to the 'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet' named permission set. (Naturally the 'Internet' named permission set represents a very restrictive range of permissions.)

2. What is Code group?

A.Code groups represent collections of code and each code group has an associated set of permissions.

3. What is Role-Based security?

A.A role is a named set of principals that have the same privileges with respect to security (such as a teller or a manager). A principal can be a member of one or more roles. Therefore, applications can use role membership to determine whether a principal is authorized to perform a requested action.

4.What type of Security MS.Net supports?

A.MS.Net Supports Role-Based Security.

5.How can you provide security with ASP.Net?

A.In ASP.Net security can be provided by using Authentication.

6.Define Authentication?

A.Authentication is the process of validating a user with the credentials i.e username and password.

7.How many types of Authentication?

A.There are 4 types of Authentication.

8.List the different types of authentication?

A.Authentication are listed in the following way:
1.Windows Authentication
2.Forms Authentication
3.Passport Authentication
4.None

9.How can we implemented authentication?

A.Authentication can be implemented using Web.Config file.

10.Implement the process of authentication in ASP.Net?

A.Authentication can be implemented using web.config file with the following way
<authentication mode=”windows”>
 <authentication mode=”passport”>
 <authentication mode=”forms”>
<authentication mode=”none”>
 Custom authentication where you might install an ISAPI filter in IIS that
compares incoming requests to list of source IP addresses, and considers
requests to be authenticated if they come from an acceptable address. In that
case, you would set the authentication mode to none to prevent any of the
.net authentication providers from being triggered.

11.How Windows Authentication implemeneted?

A.If you select windows authentication for your ASP.NET application, you also have to
configure authentication within IIS. This is because IIS provides Windows authentication.
IIS gives you a choice for four different authentication methods:
Anonymous, basic digest and windows integrated

If you select anonymous authentication, IIS doesn’t perform any authentication, Any one
is allowed to access the ASP.NET application.

If you select basic authentication, users must provide a windows username and password
to connect. How ever this information is sent over the network in clear text, which makes
basic authentication very much insecure over the internet.

If you select digest authentication, users must still provide a windows user name and
password to connect. However the password is hashed before it is sent across the network.

Digest authentication requires that all users be running Internet Explorer 5 or later and
that windows accounts to stored in active directory.

12.What is Forms Authentication?

A.Forms authentication provides you with a way to handle authentication using your own
custom logic with in an ASP.NET application.

13.What is Passport Authentication?

A.Passport authentication lets you to use Microsoft’s passport service to authenticate users
of your application. If your users have signed up with passport, and you configure the
authentication mode of the application to the passport authentication, all authentication
duties are off-loaded to the passport servers.

14.What is Impersonation in ASP.Net?

A.By default, ASP.NET executes in the security context of a restricted user account on the
local machine. Sometimes you need to access network resources such as a file on a shared
drive, which requires additional permissions. One way to overcome this restriction is to
use impersonation. With impersonation, ASP.NET can execute the request using the
identity of the client who is making the request, or ASP.NET can impersonate a specific
account you specify in web.config.

15.How can we enable impersonation?

A.Enable impersonation in the web.confing file, you need to include the <identity> element in the web.config file and set the impersonate attribute to true as shown in the following code snippet:
<identity impersonate = "true" />

16. How do I sign out in forms authentication ?

A.FormsAuthentication.Signout()

17.Define Authorization?

A.Authorization is the process of checking whether the user has certain permission to access the resource.
                                                Or
Authorization is the process of allowing an authenticated user access to resources.

18.How does authorization work in ASP.NET?

A.ASP.NET impersonation is controlled by entries in the applications web.config file. The
default setting is “no impersonation”. You can explicitly specify that ASP.NET shouldn’t
use impersonation by including the following code in the file
<identity impersonate=”false”/>

19.What do you mean by authentication and authorization?

A.Authentication is the process of validating a user on the credentials (username and password) and authorization performs after authentication.After Authentication a user will be verified for performing the various tasks, It access is limited it is known as authorization.

20.What setting must be added in the configuration file to deny a particular user from accessing the secured resources?

A.To deny a particular user form accessing the secured resources, the web.config file must contain the following code:
<authorization >
<deny users="username" />
</authorization>

21.What is the appSettings Section in the web.config file?

A.The web.config file sets the configuration for a Web project. The appSettings block in configuration file sets the user-defined values for the whole application.
For example, in the following code snippet, the specified ConnectionString section is used throughout the project for database connection:
<configuration>
<appSettings>
<add key="ConnectionString" value="server=indiabixserver; pwd=dbpassword; database=indiabix" />
</appSettings>

Statemanagement Interview Questions on ASP.Net(55)



 Statemanagement Interview Questions on ASP.Net(55)


1.Define Statemanagement?

A. A new instance of the Web page class is created each time the page is posted to the server. In traditional Web programming, this would typically mean that all information associated with the page and the controls on the page would be lost with each round trip. For example, if a user enters information into a text box, that information would be lost in the round trip from the browser or client device to the server.
To overcome this inherent limitation of traditional Web programming, ASP.NET includes several options that help you preserve data on both a per-page basis and an application-wide basis.
                                    Or
Preserving the data on any server side controls on both a per-page basis and an application-wide basis it indicates that maintains the state of the control this is known as State Managemnent.

2.List the types of State Management techniques?

A.There are two types of State Management techniques.They are:
Client Side State Management
Server Side State Management

3.List the different types of Client Side State Management techniques?

A.There are 5 different types of Client Side State Management techniques.They are:
1.View State
2.Control State
3.Hidden Fields
4.Cookies and
5.Query Strings

4. List the different types of Server Side State Management techniques?

A.There are 3 different types of Server Side State Management techniques.They are:
1.Application State
2.Session State
3.Profile Properties

5. How can you manage client-side state?

A.With the help of View State,Control State,Hidden Fields,Cookies and Query String we can manage client-side state.

6. How can you manage client-side state?

A.With the help of application state,session state and profile properties we can manage server-side state.

7.List some of the state less technologies?

A.ASP,ASP.NET and all the versions of ASP.NET

8.What is View State?

A.ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used to retain the state of server-side objects between postabacks.

9.What is the lifespan for items stored in ViewState?

A.Items stored in ViewState live until the life time of current page expires including the postbacks to the current page.

10.Where can we store ViewState Information?

A.Hidden Fields of HTML

11.Can you Infer drawback of View State?

A.View state can be turned off at a page level by developers, effectively breaking your control. To solve this, the ASP.NET page framework exposes a feature in ASP.NET called control state.

12.Define Control State?

A.The ControlState property allows you to persist property information that is specific to a control and cannot be turned off like the ViewState property.

13.Where we can use Control State?

A.To capture the custom control even with round trips.

14. Define Rendering?

A.Rendering  is the process of Converting Server side control to client side control.This process is required for every web page because every browser understands html form of out put that is Client Side control.

15.Define Hidden Fields?

A.ASP.NET allows you to store information in a HiddenField control, which renders as a standard HTML hidden field. A hidden field does not render visibly in the browser, but you can set its properties just as you can with a standard control. When a page is submitted to the server, the content of a hidden field is sent in the HTTP form collection along with the values of other controls. A hidden field acts as a repository for any page-specific information that you want to store directly in the page.

16.Can we transfer Hidden Fileds Information from one page to another page?

A.No.We can’t this is a page specific.

17.How to store values between postbacks in ASP.Net?

A.With the help of ViewState we can store values between postbacks in ASP.Net.

18.Define Cookies?

A.A cookie is a small amount of data that is stored either in a text file on the client file system or in-memory in the client browser session.

19.How many types of cookies are there?

A.There are two types of Cookies are there.They are
1.Inmemory Cookie
2.Persistent Cookie

20.Explain what is Inmemory Cookie?

A.Inmemory Cookie is used to stores the users information upto the user log off the session or application.These are temporary store values.

21.Define Persistent Cookie?

A.Persistent Cookie can be store permanently for a specified time period.Defaultly we “50 Years”.If we want we can set manually.
E.G:HttpCookie obj=new HttpCookie();
Obj.Expires=DateTime.Now.AddYears(1);

22.Can we kill Persistent Cookie?

A.Yes.
Obj.Expires=DateTime.Now.AddYears(-1);

23.Can we Disable Cookies at Browser Side?

A.Yes.

24.If cookies are disabled at browser side.Is there any draw back for that?

A.Yes.Authentication doesnot work it is one of the threat at the security perspective.

25.What are the benefits of using Cookies?

A.Following are the benefits of using Cookies.They are:
1.No server resources are required as they are stored in client.
2.They are light weight and simple to use

26.List the Limitations of using Cookies?

A.Following are limitation of using cookies :-
1.Most browsers place a 4096-byte limit on the size of a cookie, although support for 8192-byte cookies is becoming more common in the new browser and client-device versions available today.
2.Some users disable their browser or client device’s ability to receive cookies,thereby limiting the use of cookies.
3.Cookies can be tampered and thus creating a security hole.
4.Cookies can expire thus leading to inconsistency.

27.How many Kilo Bytes of Cookies can be stored?

A.4 Kilo Bytes of data can be stored by cookies.

28.How Cookies can be created?

A.Cookies can be created with the help of “HttpCookies” class
E.G:HttpCookie obj=new HttpCookie();


29.How many requests can be stored by cookie for every application?

A.20 requests are stored by cookie for every application.

30.Define Query String?

A.A query string is information that is appended to the end of a page URL. Query strings provide a simple but limited way to maintain state information.It is used to transport information from one page to another page.

31.How Query String Stores Information?

A.It can be stored in the form of Key and Value pair relation.Typically QueryString can be shown as below.

In the URL path above, the query string starts with a question mark (?) and includes two attribute/value pairs, one called "Cat" and the other called "List."

32.List the benefits of Query String?

A.Following are the benefits of using query string for state management:-
1.No server resources are required. The query string containing in the HTTP
requests for a specific URL.
2.All browsers support query strings.

33. List the limitations of Query String?

A.Following are limitations of query string :
1.Query string data is directly visible to user thus leading to security problems.
2.Most browsers and client devices impose a 255-character limit on URL length.

34.How can we access Query String information in receiver page?

A.Response.

35.Define Application State?

A.ASP.NET allows you to save values using application state — which is an instance of the HttpApplicationState class — for each active Web application. Application state is a global storage mechanism that is accessible from all pages in the Web application. Thus, application state is useful for storing information that needs to be maintained between server round trips and between requests for pages.

36.Define Session State?

A.ASP.NET allows you to save values by using session state — which is an instance of the HttpSessionState class — for each active Web-application session.
            Session state is similar to application state, except that it is scoped to the current browser session. If different users are using your application, each user session will have a different session state. In addition, if a user leaves your application and then returns later, the second user session will have a different session state from the first.

37.List the tasks of  Session State?

A.We can use session state to accomplish the following tasks:
1.Uniquely identify browser or client-device requests and map them to an individual session instance on the server.
2.Store session-specific data on the server for use across multiple browser or client-device requests within the same session.
3.Raise appropriate session management events. In addition, you can write application code leveraging these events.

38.What are some ways to manage state in an ASP.Net application?

A.Session objects, Application objects, ViewState, cookies, hidden form fields.

39.How to Store Global Variables?

A.We can store Global variables using Application State,Session State,Cookie,Caching .

40.Do Session use cookies?

A.No,session is stored in server memory.

41. What does the "EnableViewState" property do? Why would I want it

on or off?

A. It allows page objects to save their state in a Base64 encoded string in the page HTML. One should only have it enabled when needed because it adds to the page size and can get fairly large for complex
pages with many controls. (It takes longer to download the page).

42.Can dataset be stored in a ViewState?

A.Yes, dataset be stored in a ViewState.subjected to size of dataset.


43.How to set a View State for a Server Control?

A.By Setting a EnableViewState property


44.What is the default time out for a cookie?

A.30 minutes.

45.What is the default time out of a session?

A.20 minutes.

46. Explain the cookie less session and its working.

A.ASP.NET manages the session state in the same process that processes the request and does not create a cookie. It is known as a cookie less session. If cookies are not available, a session is tracked by adding a session identifier to the URL.
The cookie less session is enabled using the following code snippet:
<sessionState cookieless="true" />


47. How can we kill a user session ?

A.Session.abandon()


48.How to redirect from one page to another page?

A.By using
Response.Redirect() and Server.Transfer()
Server.Transfer(“~/Home.aspx”);


49.What is the difference between Server.Transfer() and Response.Redirect()?

A.
Server.Transfer()
Response.Redirect()
It transfer user request with in the available pages in the root directory
It transfers the user request to any of the other pages
It is faster in processing than Response.Redirect()
It is slower in processing than Server.Transfer()
It has a round trip
It has no round trips
In this we will pass query string information
In this we are unable to pass quey string information
Syntax is Server.Transfer("~/Home.aspx")
Syntax is Response.Redirect("http://www.pv999.blogspot.com")
we don't need to show the real URL where we redirected the request in the users Web Browser
we want our users to be able to see the new redirected URL where he is redirected in his browser (and be able to bookmark it if its necessary)

50.Which method has been introduced in ASP.NET 4.0 to redirect a page permanently?

A.The RedirectPermanent() method added in ASP.NET 4.0 to redirect a page permanently.
Example of the RedirectPermanent() method:
RedirectPermanent("Aboutus.aspx");

51. What is the difference between the Response.Write() and Response.Output.Write() methods?

A.The Response.Write() method allows you to write the normal output; whereas, the Response.Output.Write() method allows you to write the formatted output.

52. Explain the differences between Server-side and Client-side code?

A.Server-side code executes on the server.Client-side code executes in the context of the clients' browser.

53. Explain the differences between Server-side and Clientside code?

A.Server side code is executed at the server side on IIS in ASP.NET framework, while client side code is executed on the browser.

54.What is Round Trip?

A.It is the process of submitting a request from client to server and then back to the client is known as Round Trip.

55.How to improve performance of web page in asp.net?

A.Limited usage of unused variables,ViewState,Session,normal sql queries apart from stored procedures.