Asp.Net

Q.#)   What is ASP?
ASP stands for Active Server Pages. It is also known as classic ASP. It is a server-side technology provided by Microsoft which is used to create dynamic and user-friendly web pages. It uses different scripting languages to create dynamic web pages which can be run on any browsers.

Q.#)   What is ASP.NET?
ASP.Net is a specification by Microsoft which is used to create web applications and web services. It is a part of ".Net framework". You can create ASP.Net applications in most of the .Net compatible languages like Visual Basic, C#, etc. ASP.Net provides much better performance than scripting languages.

Q.#)   What is the difference between the ASP and ASP.NET?
The main difference between ASP and ASP.Net is that ASP is interpreted, while ASP.Net is compiled. ASP uses VB-Script, therefore when the ASP page is executed, it is interpreted. On the other hand, ASP.Net uses .Net languages like C# and VB.NET, which is compiled to Microsoft intermediate language.

Q.#)   What is a multilingual website?
If a website provides content in many languages, it is known as a multilingual website. It contains multiple copies of its content and other resources, such as date and time, in different languages.

Q.#)   What is caching? Explain.
Caching is the technique which facilitates you to store frequently used items in memory so that they can be accessed more quickly.

Q.#)   what are the main requirements for caching?
        1.    By caching the response, your request is served by the response already stored in memory.
        2.    You must be very careful while choosing the items to cache because Caching incurs overhead.
        3.    A frequently used web form which data doesn't frequently change is good for caching.
        4.    A cached web form freezes form?s server-side content, and changes to that content do not appear until the cache is refreshed.

Q.#)   What are the advantages of ASP.NET?
ASP.Net is the next generation of ASP technology platform. It is superior to ASP in the following ways:  
        1.    Highly Scalable. 
        2.    Compiled Code. 
        3.    User Authentication.
        4.    Language Support. 
        5.    Third party control. 
        6.    Configuration and Deployment are easy.       . 
        7.    Object and Page caching.
        8.    Strict coding requirements


Q.#)   What is the concept of Postback in ASP.NET?
Postback is a request which is sent from a client to the server from the same page user is working with. There is an HTTP POST request mechanism in ASP.NET. It posts a complete page back to the server to refresh the whole page.

Q.#)    What is the used of "isPostBack" property?
The "IsPostBack" property of page object is used to check that the page is posted back or not.

Q.#)    How do you identify that the page is PostBack?
There is a property named "IsPostBack" property in Post object, which can be checked to know that the page is posted back.

Q.#)   What is the parent class of all web server control?
System.Web.UI.Control class

Q.#)    What is the difference between ASP.NET Webforms and ASP.NET MVC?
ASP.NET Web-forms uses the page controller approach for rendering layout. In this approach, every page has its controller.
On the other hand, ASP.NET MVC uses the Front Controller approach. In this approach, there is a common controller for all pages.

Q.#)   What is the difference between the GET method () and POST method ()?
         1.    Data is affixed to the URL. 
        2.    Data is not affixed to the URL.Data is not secured.
        3.    Data is secured.Data transmission is faster in this method. 
        4.    Data transmission is comparatively slow.It is a single call system. 
        5.    It is a two call system.Only a limited amount of data can be sent. A large amount of data can be sent.
        6.    It is a default method for many browsers. 
        7.    It is not set as default. It should be explicitly specified.

Q.#)   What is the difference between session object and application object?
The session object is used to maintain the session of each user. A session id is generated if a user enters in the application and when the user leaves the application, the session id is automatically deleted.
On the other hand, the application object is used to store the information and access variables from any page in the application.

Q.#)   What is the difference between trace and debug?
Debug class is used to debug builds. Trace class is used for both debug and release builds.

Q.#)   What is the difference between client-side and server-side validations in WebPages?
The client-side validation happens at the client's side with the help of JavaScript and VBScript. This validation has occurred before the Web page is sent to the server.
The server-side validation happens at the server side.

Q.#)   What is the difference between file-based dependency and key-based dependency?
File-based dependency: File-based dependency facilitates you to save the dependency on a file in a disk.
Key-based dependency: In key-based dependency, you depend on another cached item.

Q.#)   What is the difference between globalization and localization?
Globalization: Globalization is a technique to identify the part of a Web application that is different for different languages and separate it out from the web application.
Localization: In localization, you try to configure a Web application so that it can be supported for a specific language or locale.

Q.#)   What is the difference between a page theme and a global theme?
Page Theme: The page theme is applied to particular web pages of the project. It is stored inside a sub-folder of the App_Themes folder.
Global Theme: The Global theme is applied to all the web applications on the web server. It is stored inside the Themes folder on a Web server.

Q.#)   What is the difference between early binding and late binding?
Early Binding: In early binding, a non-virtual method is called which is decided at a compile time.
Late Binding: In late binding, a virtual method is called which is decided at run-time.

Q.#)   What is the difference between server-side scripting and client-side scripting?
Server-side scripting: In server-side scripting, all the script are executed by the server and interpreted as needed.
Client-side scripting: In client-side scripting, the script will be executed immediately in the browser such as form field validation, email validation, etc.
The client-side scripting is usually carried out in VBScript or JavaScript.

Q.#)   How to sign out from forms authentication?
FormsAuthentication.Signout() method is used to sign out from forms authentication.

Q.#)   How to display validation messages in one control?
By the help of ValidationSummary control, we can display all validation messages in one control.

Q.#)   What is the difference between authentication and authorization?
Authentication is a process of identifying user whereas authorization is used to check the access rights of an identified user.

Q.#)   Which object encapsulates state or data of a user?
Session object.

Q.#)   What is ViewState?
ViewState is a feature of ASP.NET to store the values of a page before it is submitted to the server. After posting the page, data from is ViewState is restored.

Q.#)   What is ViewState information stored?
It is stored in HTML hidden field.

Q.#)   What are the differences between the Response.Write() and Response.Output.Write()?
Response.Write() is used for normal output whereas Response.Output.Write() is used for formatted output.

Q.#)   Define the types of configuration files.
        There are two types of configuration files: -
        1.     Application Level config = Web.config
        2.     Machine Level config = Machine.config.


Q.#)   What is the difference between Web config and Machine config files?
        1.     Web config file is specific to web application whereas Machine config file is specific to machine or server.
        2.     There can be multiple web config files in an application but only one machine config file.


Q.#)   What are the built-in objects in ASP.NET?

      The major built-in objects are given below:
        1.    Application
        2.     Session
        3.   Context
        4.   Request
        5.   Response
        6.   Server
        7.   Trace

  Q.#)   What do you mean by Role-based security?
   Role-based security is used in almost all organization, and the Role-based security assigns certain privileges to each role
          1.     Each user is assigned a particular role from the list.
          2.    Privileges as per role restrict the user's actions on the system and ensure that a user can do only what he is permitted to do on the system.


Q.#)   What is cookie?
        A Cookie is a small piece of information which is stored at the client side. There are two types of cookie:
          1.   Session/Temporary Cookie: valid for a single session
          2.   Persistent Cookie: valid for multiple session

Q.#)   What is the default timeout for a cookie?
        30 minutes.

Q.#)   How would you turn off cookies on a page of a website?
          You have to follow the procedures given below:
        1.     Use the "Cookie.Discard" property.
        2.     It gets or sets the discard flag set by the server.
        3.     When set to true, this property instructs the client application not to save the Cookie on the hard disk of the user at the end of the session.


Q.#)   Which protocol is used to call web service?
       HTTP protocol.

Q.#)   What is the file extension of web service?
The File extension of web service is .asmx.

Q.#)   What are the HTML server controls in ASP.NET?
        1.     HTML server controls are just like HTML elements that we use on the HTML pages.
        2.     HTML server controls are used to expose properties and events for use.
        3.     To make these controls pro-grammatically accessible,
we specify that the HTML controls act  as a server control by adding the runat="server" attribute.

Q.#)   What is the use of Global.asax file?
The Global.asax file is used to execute the application-level events and sets application-level variables.


Q.#)   What is event bubbling?
When child control sends events to parent, it is termed as event bubbling. Server controls like Data Grid, Data List, and Repeater can have other child controls inside them.

Q.#)  What is Caching?
Caching is a technique where we can store frequently used data, and web pages are stored temporarily on the local hard disk for later retrieval. Each request will use the same cache for different users. One of the more common items stored in a cache in a Web application environment is commonly displayed database values ; by caching such information, rather than relying on repeated database calls, the demand on the Web server and database server's system resources are decreased and the Web application's scalability increased.

Q.#)  What is session?
Session is a period of time that is shared between the web application and the user. It refers to a limited time of communication between two systems. Some sessions involve a client and server, while other sessions involve two personal computers. Each user that is using the web application has their own session . Session variables will use different session variables for each different user. Since session variables are stored on the Web server's memory, storing large objects in a user's session on a site with many simultaneous users can lead to reduced memory on the Web server

Q.#)  Difference Between Session and Caching

  • Session data is stored at the user level but caching data is stored at the application level and shared by all the users.
  • Sessions may not improve performance whereas Cache will improve site performance.
  • Items in cache can expire after given time to cache while items in session will stay till session expires.
  • Sessions may change from user to user whereas a single Cache will be maintained for the entire application.
  • Cache wont maintain any state, whereas Sessions will maintain separate state for every user.

Q#)   Authentication

Authentication is the process of verifying the identity of a user by obtaining some sort of credentials and using those credentials to verify the user's identity. If the credentials are valid, the authorization process starts. Authentication process always proceeds to Authorization process.

Q#)   ASP.Net Authentication

The ASP.NET authentication scheme that is used to identify users who view an ASP.NET application. An ASP.net application has two separate authentication levels because all requests coming through IIS before it handled by ASP.NET. After IIS authentication schemes ASP.NET implements additional authentication schemes. They are :
  • Windows Authentication
  • Forms Authentication
  • Passport Authentication
The mode attribute specifies the authentication scheme.

<authentication mode="[Windows|Forms|Passport|None]" >

None Authentication
You can specify "None" as the authentication provider when requests are not authenticated at all or if you plan to develop custom authentication code.
When you need "None" authentication, use the following Web.config configuration:

<system.web>   <authentication mode="None" /> </system.web>

Q#)   Authorization

Authorization is the process of allowing an authenticated users to access the resources by checking whether the user has access rights to the system. Authorization helps you to control access rights by granting or denying specific permissions to an authenticated user.

Q#)   Asp.Net Authorization

ASP.NET allows two ways to authorize access to a given resources, they are URL authorization and File authorization

URL authorization
URL authorization maps users and roles to URLs in ASP.NET applications

File authorization
File authorization validate the ACL (access control list) of the .aspx or .asmx handler file to determine whether a user should have access to the file.

How to implement Authorization ?
The following example shows a sample implementation of Authorization logic in web.config file.

<authorization> <allow roles="Administrators" /> <deny users="*" /> </authorization>

Q.#)  In-proc session state

An inproc server runs in the same process as the calling application. It's close to a normal function call on a dll. In-Process stores the session in memory on the web server. This requires the "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server.
InProc session mode indicates that session state is stored locally , means that with InProc session state mode is store objects in the App Domain of the Web application. Because of this the session state is lost when IIS (Internet Information System) restarts. For small, very stable sites, InProc is perfectly acceptable and possibly even ideal. InProc also has the benefit of being able to hold any memory object in session. This can also be problematic if you attempt to hold enormous objects.

Q.#)  Outproc session state

State Server mode/OutProc, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. Calling an outproc server , data needs to be marshaled across the process boundary which is an expensive operation.
The basic necessity of using the Outproc session is when you have deployed your application in web farm or web garden. Outproc session should be used when you expect issues like if you are modifying you web.config file or bin folder at run time or IIS restart on server. As State server mode gives a advantage that it will not lose the data even if your application crash.

Q.#)  HTTP Methods GET vs POST

HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. GET and POST are two different types of HTTP requests . If the method is not specified in the html form GET will be used by default.

HTTP GET

GET method places name value pairs as plain text in URL. GET requests are often cached by default by some browsers if you are not careful. It can send but the parameter data is limited to what we can stuff into the request line (URL). Safest to use less than 2 K of parameters, some servers handle up to 64 K. Also, GET is less secure compared to POST because data sent is part of the URL. So it's saved in browser history and server logs in plain text . Finally, GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send.

HTTP POST

POST requests supply additional data from the client (browser) to the server in the message body. It submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both. In the case of security, POST is a little safer than GET because the parameters are not stored in browser history or in web server logs. POST method variables are not displayed in the URL and cannot be cached. With POST you can also do multi-part mime encoding which means you can attach files as well. Also if you are using post variables across navigation of pages, the user will get a warning asking if they want to resubmit the post parameter



1 comment:

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...