ASP.Net Interview Questions

  • What is ASP.NET?
    ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.
    ASP.NET provides increased performance by running compiled code
  • What is Difference between Namespace and Assembly?
    Namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.
  • What is the difference between early binding and late binding?
    Calling a non-virtual method, decided at a compile time is known as early binding.Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.
  • What is the difference between ASP Session State and ASP.Net Session State?
    ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm.
  • What is the difference between Classic ASP and ASP.Net?
    ASP is Interpreted language based on scripting languages like Jscript or VBScript.
    ASP has Mixed HTML and coding logic.
    Limited development and debugging tools available.
    Limited OOPS support.
    Limited session and application state management.
    ASP.Net is supported by compiler and has compiled language support.
    Separate code and design logic possible.
    Variety of compilers and tools available including the Visual studio.Net.
    Completely Object Oriented.
    Complete session and application state management.
    Full XML Support for easy data exchange.
  • What is the difference between ASP Session and ASP.NET Session? session supports cookie less session & it can span across multiple servers.
  • What is reflection?
    All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection.The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.
  • What is the difference between Server.Transfer and response.Redirect?
    The Server.Transfer () method stops the current page from executing, and runs the content on the specified page, when the execution is complete the control is passed back to the calling page.
    While the Response.Redirect () method transfers the control on the specified page and the control is never passed back to calling page after execution.
  • What is a PostBack?
    The process in which a Web page sends data back to the same page on the server.
    What namespace does the Web page belong in the .NET Framework class hierarchy?
  • What’s a bubbled event?
    When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents.
  • What is the differences between Server-side and Client-side code?
    Server-side code executes on the server.
    Client-side code executes in the client’s browser.
  • What is the difference between static or dynamic assemblies?
    Assemblies can be static or dynamic.
    Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files.
    Dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.
  • What are the difference between Structure and Class?
    Structures are value type and Classes are reference type
    Structures can not have constructor or destructors.
    Classes can have both constructor and destructors.
    Structures do not support Inheritance, while Classes support Inheritance.
  • What is the differences between dataset.clone and dataset.copy?
    Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.); however it doesn’t copy the data.
    Dataset.copy, copies both the dataset structure and the data.
  • What is the difference between Custom Control and User Control?
    Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application.
    User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files.
  • What is the difference between ASP Session State and ASP.Net Session State?
    ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm.
  • What is ViewState?
    ViewState is a .Net mechanism to store the posted data among post backs. ViewState allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required.
  • What is Authentication and Authorization?
    Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication.
    Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.
  • What are the types of Authentication?
    There are 3 types of Authentication. Windows, Forms and Passport Authentication.
    Windows authentication uses the security features integrated into the Windows NT and Windows XP operating systems to authenticate and authorize Web application users.
    Forms authentication allows you to create your own list/database of users and validate the identity of those users when they visit your Web site.
    Passport authentication uses the Microsoft centralized authentication provider to identify users. Passport provides a way to for users to use a single identity across multiple Web applications. To use Passport authentication in your Web application, you must install the Passport SDK.
  • What are the different types of Validation Controls?
    There are six types of validation controls available :
  • What is the Web User Control?
    Combines existing Server and/or HTML controls by using VS.Net to create functional units that encapsulate some aspects of UI. Resides in Content Files, which must be included in project in which the controls are used.
  • What namespaces are necessary to create a localized application?
    How to Manage State in ASP.Net?
    There are several ways to manage a state.
  • What are the different types of Caching?
    There are three types of Caching :
    Output Caching: stores the responses from an page.
    Fragment Caching: Only caches/stores the portion of page (User Control)
    Data Caching: is Programmatic way to Cache objects for performance.
  • What is Side-by-Side Execution?
    The CLR allows any versions of the same-shared DLL (shared assembly) to execute at the same time, on the same system, and even in the same process. This concept is known as side-by-side execution.
  • How to view an assembly?
    We can use the tool "ildasm.exe" known as "Assembly Disassembler" to view the assembly.
    Which are the namespaces that are imported automatically by Visual Studio in ASP.Net?
    There are 7 namespaces which are imported automatically.
  • What are the layouts of ASP.NET Pages?
    GridLayout positions the form object on absolute x and y co-ordinates of the screen.
    FlowLayout positions the form objects relative to each other.
  • What is Delegates?
    Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it. Delegates are generally used as basis of events, which allow any delegate to easily be registered for as event.
  • What is a Namespace? What is the use of a namespace?
    Namespaces are logical grouping of classes and other types in hierarchical structure.
    Namespaces are useful to avoid collision or ambiguity among the classes and type names.
    Another use of the namespace is to arrange a group of classes for a specific purpose.
  • What’s the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?
    Visual Studio uses the Codebehind attribute to distinguish the page source or programming logic from the design. Also the src attribute will make the page compile on every request. That is the page will not be compiled in advance and stored in the bin as a dll instead it will be compiled at run time.
  • What is datagrid?
    The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
  • How do you hide the columns?
    One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s “Visible” property.
    What are different types of directives in .NET?
  • What data type does the RangeValidator control support?
  • What is cookies?
    Cookies are small pieces of text, stored on the client’s computer to be used only by the website setting the cookies. This allows webapplications to save information for the user, and then re-use it on each page if needed
  • How many classes can a single .NET DLL contain?
    It can contain many classes.
    What methods are fired during the page load?
    Init() - when the page is instantiated.
    Load() - when the page is loaded into server memory.
    PreRender() - the brief moment before the page is displayed to the user as HTML.
    Unload() - when page finishes loading.
    What is the difference between Value Types and Reference Types?
    Value Types uses Stack to store the data.
    where as Reference type uses the Heap to store the data.
  • What is the difference between Server-side scripting and Client-side scripting?
    Server side scripting means that all the script will be executed by the server and interpreted as needed. ASP doesn't have some of the functionality like sockets, uploading, etc.
    Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript.
  • How do you create a permanent cookie?
    Permanent cookies are available until a specified expiration date, and are stored on the hard disk.So Set the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime. If u want the cookie which never expires set its Expires property equal to DateTime.maxValue.
  • Which method do you use to redirect the user to another page without performing a round trip to the client?
  • Which method do you use to redirect the user to another page without performing a round trip to the client?
  • What tag do you use to add a hyperlink column to the DataGrid?
  • What is web.config file?
    Web.config file is the configuration file for the web application. There is one web.config file for one application which configures the particular application. Web.config file is written in XML with specific tags having specific meanings.It includes databa which includes connections,Session States,Error Handling,Security etc.
  • What is the difference between in-proc and out-of-proc?
    An Inproc is one which runs in the same process area as that of the client giving tha advantage of speed but the disadvantage of stability becoz if it crashes it takes the client application also with it.
    Outproc is one which works outside the clients memory thus giving stability to the client, but we have to compromise a bit on speed.
  • What is a PostBack?
    The process in which a Web page sends data back to the same page on the server.
  • How many languages .NET is supporting now?
    When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
  • What is smart navigation?
    The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
  • How do you validate the controls in an ASP .NET page?
    Using special validation controls that are meant for this. We have Range Validator, Email Validator
  • How do you turn off cookies for one page in your site?
    Use Cookie.Discard property, Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user's hard disk when a session ends.
  • Which two properties are on every validation control?
    We have two common properties for every validation controls:
    Control to Validate
    Error Message
  • Which control would you use if you needed to make sure the values in two different controls matched?
    CompareValidator is used to ensure that two fields are identical.
  • What is the difference between HTTP-Post and HTTP-Get?
    The GET method creates a query string and appends it to the script's URL on the server that handles the request.
    The POST method creates a name/value pairs that are passed in the body of the HTTP request message.
  • What is strong-typing versus weak-typing?
    Strong typing implies that the types of variables involved in operations are associated to the variable, checked at compile-time, and require explicit conversion
    Weak typing implies that they are associated to the value, checked at run-time, and are implicitly converted as required.