Showing posts with label Asp .Net. Show all posts
Showing posts with label Asp .Net. Show all posts

October 19, 2013

What is Session

What is Session ?

Web is stateless, which means a new instance of a web page class is re-created each time the page is posted to the server. As we all know, HTTP is a stateless protocol, it can't hold client information on a page. If the user inserts some information and move to the next page, that data will be lost and the user would not be able to retrieve that information. What do we need here? We need to store information. Session provides a facility to store information on server memory. It can support any type of object to store along with our own custom objects. For every client, session data is stored separately, which means session data is stored on a per client basis. Have a look at the following diagram:



Fig: For every client, session data is stored separately
State management using session is one of the best ASP.NET features, because it is secure, transparent from users, and we can store any kind of object in it. Along with these advantages, some times session can cause performance issues in high traffic sites because it is stored in server memory and clients read data from the server

April 30, 2013

ASP.NET Interview Questions and Answers

What is difference between a Label control and a Literal control?
Ans- The Label control's final html code has an HTML tag; whereas, the Literal control's final html code contains only text, which is not surrounded by any HTML tag.



What is the difference between ASP session and ASP.NET session?
Ans- ASP does not support cookie-less sessions;
whereas, ASP.NET does. In addition, the ASP.NET session can span across multiple servers.


What is the use of the <sessionState> tag in the web.config file?
Ans- The <sessionState> tag is used to configure the session state features. To change the default timeout, which is 20 minutes, you have to add the following code snippet to the web.config file of an application: <sessionState timeout="40"/>


Which class is inherited when an ASP.NET server control is added to a Web form?
Ans- The System.Web.UI.WebControls class is inherited when an ASP.NET server control is added to a Web form.


How many types of Cookies are available in ASP.NET?
Ans- There are two types of Cookies available in ASP.NET:

  • Session Cookie - Resides on the client machine for a single session until the user does not log out.
  • Persistent Cookie - Resides on a user's machine for a period specified for its expiry, such as 10 days, one month, and never.
The user can set this period manually.

What are Web server controls in ASP.NET?
Ans- The ASP.NET Web server controls are objects on the ASP.NET pages that run when the Web page is requested. Many Web server controls, such as button and text box, are similar to the HTML controls. In addition to the HTML controls, there are many controls, which include complex behavior, such as the controls used to connect to data sources and display data.
What type of the CatalogPart control enables users to restore the Web Parts that have been removed earlier by the user?
Ans- The PageCatalogPart control.

ASP.NET Interview Questions and Answers

What does the "EnableViewState" property do? Why do we want it On or Off?
Ans- The EnableViewState property enables the ViewState property on the page. It is set to On to allow the page to save the users input between postback requests of a Web page; that is, between the Request and corresponding Response objects. When this property is set to Off, the page does not store the users input during postback.


What is the function of the CustomValidator
control?
Ans- It provides the customize validation code to perform both client-side and server-side validation.


Which data type does the RangeValidator control support?
Ans- The data types supported by the RangeValidator control are Integer, Double, String, Currency, and Date.


Why a SiteMapPath control is referred to as breadcrumb or eyebrow navigation control?
Ans- The SiteMapPath control displays a hierarchical path to the root Web page of the Web site. Therefore, it is known as the breadcrumb or eyebrow navigation control.


Which namespaces are necessary to create a localized application?
Ans- The System.Globalization and System.Resources namespaces are essential to develop a localized application.


What is the difference between HTML and Web server controls?
Ans- HTML controls are client-side controls; therefore, all the validations for HTML controls are performed at the client side. On the other hand, Web server controls are server-side controls; therefore, all the validations for Web server controls are performed at the server side.


What is the difference between absolute expiration and sliding-time expiration?
Ans- The absolute expiration expires a cached item after the provided expiration time. The sliding time does not expire the cached items because it increments the specified time.

ASP.NET Interview Questions and Answers

In which database is the information, such as membership, role management, profile, and Web parts personalization, stored?
Ans- The aspnetdb database stores all information.


What do you understand by aggregate dependency?
Ans- Aggregate dependency allows multiple dependencies to be aggregated for content that depends on more than one resource. In such type of dependency, you need to depend on the sum of all the defined dependencies to remove a data item
from the cache.


To which class a Web form belongs to in the .NET Framework class hierarchy?
Ans- A Web form belongs to the System.Web.UI.Page class.

What is the difference between adding items into cache through the Add() method and through the Insert() method?
Ans- Both methods work in a similar way except that the Cache.Add() function returns an object that represents the item you added in the cache. The Cache.Insert() function can replace an existing item in the cache, which is not possible using the Cache.Add() method.


What is a round trip?
Ans- The trip of a Web page from the client to the server and then back to the client is known as a round trip.


Where should the data validations be performed-at the client side or at the server side and why?
Ans- Data validations should be done primarily at the client side and the server-side validation should be avoided because it makes server task overloaded. If the client-side validation is not available, you can use server-side validation. When a user sends a request to the server, the validation controls are invoked to check the user input one by one.


What type of code, client-side or server-side, is found in a code-behind file of a Web page?
Ans- A code-behind file contains the server-side code, which means that the code contained in a code-behind file is executed at the server.

ASP.NET Interview Questions and Answers

What setting must be added in the configuration file to deny a particular user from accessing the secured resources?
Ans- To deny a particular user form accessing the secured resources, the web.config file must contain the following code:

<authorization >
<deny users="username" />
</authorization>


 What is the difference between page-level caching
and fragment caching?
Ans- In the page-level caching, an entire Web page is cached; whereas, in the fragment caching, a part of the Web page, such as a user control added to the Web page, is cached.


 How can you assign page specific attributes in an ASP.NET application?
Ans- The @Page directive is responsible for this.

 What is a Cookie? Where is it used in ASP.NET?
Ans- Cookie is a lightweight executable program, which the server posts to client machines. Cookies store the identity of a user at the first visit of the Web site and validate them later on the next visits for their authenticity. The values of a cookie can be transferred between the user's request and the server's response.

What does the .WebPart file do?
Ans- The .WebPart file explains the settings of a Web Parts control that can be included to a specified zone on a Web page.
 
What are the event handlers that can be included in the Global.asax file?
Ans- The Global.asax file contains some of the following important event handlers:

  • Application_Error
  • Application_Start
  • Application_End
  • Session_Start
  • Session_End 

How can you enable impersonation in the web.config file?
Ans- To 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" />

ASP.NET Interview Questions and Answers

How can you send an email message from an ASP.NET Web page?
Ans- You can use the System.Net.Mail.MailMessage and the System.Net.Mail.SmtpMail classes to send an email in your Web pages. In order to send an email through your mail server, you need to create an object of the SmtpClient class and set the server name, port, and credentials.


What is the difference between the Response.Write() and Response.Output.Write() methods?
Ans- The Response.Write() method allows you to write the normal output; whereas, the Response.Output.Write() method allows you to write the formatted output.


Differentiate between client-side and server-side validations in Web pages.
Ans- Client-side validations take place at thehttp://www.blogger.com/blogger.g?blogID=1100445556152057720#editor/target=post;postID=7962939421597285574 client end with the help of JavaScript and VBScript before the Web page is sent to the server. On the other hand, server-side validations take place at the server end.


What is the default timeout for a Cookie?
Ans- The default time duration for a Cookie is 30 minutes.

What are the events that happen when a client requests an ASP.NET page from IIS server?
Ans- The following events happen when a client requests an ASP.NET page from the IIS server:

  1. User requests for an application resource.
  2. The integrated request-processing pipeline receives the first user request.
  3. Response objects are created for each user request.
  4. An object of the HttpApplication class is created and allocated to the Request object.
  5. The HttpApplication class processes the user request. 

Explain file-based dependency and key-based dependency.
Ans- In file-based dependency, you have to depend on a file that is saved in a disk. In key-based dependency, you have to depend on another cached item.


How can you implement the postback property of an ASP.NET control?
Ans- You need to set the AutoPostBack property to True to implement the PostBack property of controls.

ASP.NET Interview Questions and Answers

Why do you use the App_Code folder in ASP.NET?
Ans- The App_Code folder is automatically present in the project. It stores the files, such as classes, typed data set, text files, and reports. If this folder is not available in the application, you can add this folder. One of the important features of the App_Code folder is that only one dll is created for the complete folder, irrespective of how many files it contains.


What is an ASP.NET Web Form?
Ans- ASP.NET Web forms are designed to use controls and features that are almost as powerful as the ones used with Windows forms, and so they are called as Web forms. The Web form uses a server-side object model that allows you to create functional controls, which are executed on the server and are rendered as HTML on the client. The attribute, runat="server", associated with a server control indicates that the Web form must be processed on the server.


Define a multilingual Web site.
Ans- A multilingual Web site serves content in a number of languages. It contains multiple copies for its content and other resources, such as date and time, in different languages.


What is the difference between a default skin and a named skin?
Ans- The default skin is applied to all the Web server controls in a Web form, which are of similar type, and it does not provide a Skin ID attribute. The named skin provides a Skin ID attribute and users have to set the Skin ID property to apply it.


What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?
Ans- When a browser requests an .aspx file then the server returns a response, which is rendered into a HTML string


How can you register a custom server control to a Web page?
Ans- You can register a custom server control to a Web page using the @Register directive.


What is ViewState?
Ans- The ViewState is a feature used by ASP.NET Web page to store the value of a page and its controls just before posting the page. Once the page is posted, the first task by the page processing is to restore the ViewState to get the values of the controls.

ASP .NET Interview Questions and Answers

What is the basic difference between ASP and ASP.NET?
Ans- The basic difference between ASP and ASP.NET is that ASP is interpreted; whereas, ASP.NET is compiled. This implies that since ASP uses VBScript; therefore, when an ASP page is executed, it is interpreted. On the other hand, ASP.NET uses .NET languages, such as C# and VB.NET, which are compiled to Microsoft Intermediate Language (MSIL).

How can we identify that the Page is Post Back?
Ans- Page object has an "IsPostBack" property, which can be checked to know that is the page posted back.


What is the lifespan for items stored in ViewState?
Ans- The items stored in ViewState live until the lifetime of the current page expires including the postbacks to the same page.


How information about the user's locale can be accessed?
Ans- The information regarding a user's locale can be accessed by using the System.Web.UI.Page.Culture property.


What is the difference between SQL notification and SQL invalidation?
Ans- The SQL cache notification generates notifications when the data of a database changes, on which your cache item depends. The SQL cache invalidation makes a cached item invalid when the data stored in a SQL server database changes.


What are the advantages of the code-behind feature?
Ans- The code-behind feature of ASP.NET offers a number of advantages:

  • Makes code easy to understand and debug by separating application logic from HTML tags
  • Provides the isolation of effort between graphic designers and software engineers
  • Removes the problems of browser incompatibility by providing code files to exist on the Web server and supporting Web pages to be compiled on demand.

ASP.NET interview questions and answers

What are the differences between custom Web control and user control?
Ans- Custom Web control is a control that inherits from web server control available in ASP.Net.
A Custom Web Control could be compiled into separate .dll file. This custom Web control can be shared across all application by installing this dll in to Global Assembly Catch.
User Control is a file (.ascx file) that contains a set of ASP.Net controls and code grouped together to provide common functionality across the application. User control can be used on different web pages of
the application.


Explain ASP.Net Catching? What are different catching mechanisms available in ASP.Net?
Ans- ASP.Net catching one of the important performance factor for large web applications.
ASP.Net Catching stores frequently accessed data in to catch object.
There are two different types catching in ASP.Net
1.Application Catching
2.Page Output Catching


What is ASP.Net? What are the advantages ASP.Net Technologies?
Ans- ASP.Net is a server side Technology to develop a web based applications.ASP.Net will make use of .Net framework features.
Advantages of ASP.Net
  • ASP.NET makes development simpler and easier to maintain with an event-driven, server-side programming model
  • ASP.NET offers built-in security features through windows authentication or other authentication methods.
  • Content and program logic are separated which reduces the inconveniences of program maintenance.
  • Built-in caching features.

What are the different validation controls available in ASP.Net?
Ans- RequiredFieldValidator: Verifies whether a control contains data
CompareValidator: Verifies whether an entered item matches an entry in another control
RangeValidator: Verifies whether an entered item is between two values
RegularExpressionValidator: Verifies whether an entered item matches a specified format
CustomValidator: Verifies the validity of an entered item using a client-side script or a server-side code, or both
ValidationSummary: Displays validation errors in a central location or display a general validation error description


Where do the ASP.NET validation controls validate data, on the Client or on the Web Server?
Ans- ASP.NET validation controls validate data on the client as well as web server. If we need to validate data on client side itself, we have to set a property to controls to execute at the client side.

  • Blogger news

    This Blog Contains All Topics Related To Internet, Website Help, Interview Questions, News, Results From Various Resources, Visit Daily For More Interesting And Famous Topics.
  • Random Post

  • About

    We Provide All Information Which you Needed. We Maintain This Blog Very Carefully, If You Find Any Mistake or Any Suggestions Then Please Let Us Know, You Can Contact Us By Comments, On FB Page Or On Google+ Page. ~ Thank You