FAQ DOT NET -1



Asp.Net 4.0 New Features

Permanently Redirecting a Page

Content in Web applications is often moved over the lifetime of the application. This can lead to links to be out of date, such as the links that are returned by search engines.
In ASP.NET, developers have traditionally handled requests to old URLs by using the Redirect method to forward a request to the new URL. However, the Redirect method issues an HTTP 302 (Found) response (which is used for a temporary redirect). This results in an extra HTTP round trip.
ASP.NET 4 adds a RedirectPermanent helper method that makes it easy to issue HTTP 301 (Moved Permanently) responses, as in the following example:
RedirectPermanent("/newpath/foroldcontent.aspx");
Search engines and other user agents that recognize permanent redirects will store the new URL that is associated with the content, which eliminates the unnecessary round trip made by the browser for temporary redirects.
Expanding the Range of Allowable URLs
ASP.NET 4 introduces new options for expanding the size of application URLs. Previous versions of ASP.NET constrained URL path lengths to 260 characters, based on the NTFS file-path limit. In ASP.NET 4, you have the option to increase (or decrease) this limit as appropriate for your applications, using two new attributes of the httpRuntime configuration element. The following example shows these new attributes.
<httpRuntime maxRequestPathLength="260" maxQueryStringLength="2048" />

SP.NET Ajax Library are loaded. For more information, see the AjaxFrameworkMode property.
Web Forms has been a core feature in ASP.NET since the release of ASP.NET 1.0. Many enhancements have been in this area for ASP.NET 4, such as the following:
·         The ability to set meta tags.
·         More control over view state.
·         Support for recently introduced browsers and devices.
·         Easier ways to work with browser capabilities.
·         Support for using ASP.NET routing with Web Forms.
·         More control over generated IDs.
·         The ability to persist selected rows in data controls.
·         More control over rendered HTML in the FormView and ListView controls.
·         Filtering support for data source controls.
·         Enhanced support for Web standards and accessibility.
·         Project template changes.

Setting Meta Tags with the Page.MetaKeywords and Page.MetaDescription Properties

Two properties have been added to the Page class: MetaKeywords and MetaDescription. These two properties represent corresponding meta tags in the HTML rendered for a page, as shown in the following example:
<head id="Head1" runat="server">
  <title>Untitled Page</title>
  <meta name="keywords" content="keyword1, keyword2' />
  <meta name="description" content="Description of my page" />
</head>

Setting Client IDs

The new ClientIDMode property makes it easier to write client script that references HTML elements rendered for server controls. Increasing use of Microsoft Ajax makes the need to do this more common. For example, you may have a data control that renders a long list of products with prices and you want to use client script to make a Web service call and update individual prices in the list as they change without refreshing the entire page.
Typically you get a reference to an HTML element in client script by using the document.GetElementById method. You pass to this method the value of the id attribute of the HTML element you want to reference. In the case of elements that are rendered for ASP.NET server controls earlier versions of ASP.NET could make this difficult or impossible. You were not always able to predict what id values ASP.NET would generate, or ASP.NET could generate very long id values. The problem was especially difficult for data controls that would generate multiple rows for a single instance of the control in your markup.

Persisting Row Selection in Data Controls

The GridView and ListView controls enable users to select a row. In previous versions of ASP.NET, row selection was based on the row index on the page. For example, if you select the third item on page 1 and then move to page 2, the third item on page 2 is selected. In most cases, is more desirable not to select any rows on page 2. ASP.NET 4 supports Persisted Selection, a new feature that was initially supported only in Dynamic Data projects in the .NET Framework 3.5 SP1. When this feature is enabled, the selected item is based on the row data key. This means that if you select the third row on page 1 and move to page 2, nothing is selected on page 2. When you move back to page 1, the third row is still selected. This is a much more natural behavior than the behavior in earlier versions of ASP.NET. Persisted selection is now supported for the GridView and ListView controls in all projects. You can enable this feature in the GridView control, for example, by setting the EnablePersistedSelection property, as shown in the following example:
<asp:GridView id="GridView2" runat="server" PersistedSelection="true">
</asp:GridView>

Filtering Data with the QueryExtender Control

A very common task for developers who create data-driven Web pages is to filter data. This traditionally has been performed by building Where clauses in data source controls. This approach can be complicated, and in some cases the Where syntax does not let you take advantage of the full functionality of the underlying database.
To make filtering easier, a new QueryExtender control has been added in ASP.NET 4. This control can be added to EntityDataSource or LinqDataSource controls in order to filter the data returned by these controls.
The QueryExtender control supports a variety of filter options. The following lists QueryExtender filter options.
Term
Definition
SearchExpression
Searches a field or fields for string values and compares them to a specified string value.
RangeExpression
Searches a field or fields for values in a range specified by a pair of values.
PropertyExpression
Compares a specified value to a property value in a field. If the expression evaluates to true, the data that is being examined is returned.
OrderByExpression
Sorts data by a specified column and sort direction.
CustomExpression
Calls a function that defines custom filter in the page.


CSS for Controls that Can be Disabled

In ASP.NET 3.5, when a control is disabled (see WebControl.Enabled), a disabled attribute is added to the rendered HTML element. For example, the following markup creates a Label control that is disabled:
<asp:Label id="Label1" runat="server"
  Text="Test" Enabled="false" />
In ASP.NET 3.5, the previous control settings generate the following HTML:
<span id="Label1" disabled="disabled">Test</span>
In HTML 4.01, the disabled attribute is not considered valid on span elements. It is valid only on input elements because it specifies that they cannot be accessed. On display-only elements such as span elements, browsers typically support rendering for a disabled appearance, but a Web page that relies on this non-standard behavior is not robust according to accessibility standards.
For display-only elements, you should use CSS to indicate a disabled visual appearance. Therefore, by default ASP.NET 4 generates the following HTML for the control settings shown previously:
<span id="Label1" class="aspNetDisabled">Test</span>
You can change the value of the class attribute that is rendered by default when a control is disabled by setting the DisabledCssClass property.

CSS for Validation Controls

In ASP.NET 3.5, validation controls render a default color of red as an inline style. For example, the following markup creates a RequiredFieldValidator control:
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
  ErrorMessage="Required Field" ControlToValidate="RadioButtonList1" />
ASP.NET 3.5 renders the following HTML for the validator control:
<span id="RequiredFieldValidator1"
  style="color:Red;visibility:hidden;">RequiredFieldValidator</span>
By default, ASP.NET 4 does not render an inline style to set the color to red. An inline style is used only to hide or show the validator, as shown in the following example:
<span id="RequiredFieldValidator1"
  style"visibility:hidden;">RequiredFieldValidator</span>
Therefore, ASP.NET 4 does not automatically show error messages in red. For information about how to use CSS to specify a visual style for a validation control, see Validating User Input in ASP.NET Web Pages.

CSS for the Hidden Fields Div Element

ASP.NET uses hidden fields to store state information such as view state and control state. These hidden fields are contained by a div element. In ASP.NET 3.5, this div element does not have a class attribute or an id attribute. Therefore, CSS rules that affect all div elements could unintentionally cause this div to be visible. To avoid this problem, ASP.NET 4 renders the div element for hidden fields with a CSS class that you can use to differentiate the hidden fields div from others. The new class value is shown in the following example:
<div class="aspNetHidden">

CSS for the Table, Image, and ImageButton Controls

By default, in ASP.NET 3.5, some controls set the border attribute of rendered HTML to zero (0). The following example shows HTML that is generated by the Table control in ASP.NET 3.5:
<table id="Table2" border="0">
The Image control and the ImageButton control also do this. Because this is not necessary and provides visual formatting information that should be provided by using CSS, the attribute is not generated in ASP.NET 4.

CSS for the UpdatePanel and UpdateProgress Controls

In ASP.NET 3.5, the UpdatePanel and UpdateProgress controls do not support expando attributes. This makes it impossible to set a CSS class on the HTML elements that they render. In ASP.NET 4 these controls have been changed to accept expando attributes, as shown in the following example:
<asp:UpdatePanel runat="server" class="myStyle">
</asp:UpdatePanel>
The following HTML is rendered for this markup:
<div id="ctl00_MainContent_UpdatePanel1" class="myStyle">
</div>
about multi-targeting in ASP.NET, see .NET Framework Multi-Targeting for ASP.NET Web Projects.)
In earlier versions of ASP.NET, when you use Visual Studio to create a new Web Site project or Web Application project, the resulting projects contain only a Default.aspx page, a default Web.config file, and the App_Data folder. Visual Studio also supports an Empty Web Site project type, which contains no files at all. The result is that for the beginner, there is very little guidance on how to build a production Web application. Therefore, ASP.NET 4 introduces three new templates, one for an empty Web application project, and one each for a Web Application and Web Site project:
·         Empty Web Application and Web Site Project Templates. These are similar to the Empty Web Site layout from earlier versions of ASP.NET, except they contain a Web.config file that specifies the targeted version of the .NET Framework.
·         Web Application and Web Site Project Templates. These include a number of files that were not created in earlier versions. The additional files provide basic membership functionality, a master page and content pages that use it, AJAX and CSS files. The intention of these changes to the project templates is to provide guidance on how to start building a new Web application.,
Dynamic Data was introduced in the .NET Framework 3.5 SP1 release in mid-2008. This feature provides many enhancements for creating data-driven applications, such as the following:
·         A RAD experience for quickly building a data-driven Web site.
·         Automatic validation that is based on constraints defined in the data model.
·         The ability to easily change the markup that is generated for fields in the GridView and DetailsView controls by using field templates that are part of your Dynamic Data project.
For ASP.NET 4, Dynamic Data has been enhanced to give developers even more power for quickly building data-driven Web sites. For more information, see ASP.NET Dynamic Data Content Map.

Enabling Dynamic Data for Individual Data-Bound Controls in Existing Web Applications

You can use Dynamic Data features in existing ASP.NET Web applications that do not use scaffolding by enabling Dynamic Data for individual data-bound controls. Dynamic Data provides the presentation and data layer support for rendering these controls. When you enable Dynamic Data for data-bound controls, you get the following benefits:
·         Setting default values for data fields. Dynamic Data enables you to provide default values at run time for fields in a data control.
·         Interacting with the database without creating and registering a data model.
·         Automatically validating the data that is entered by the user without writing any code.
For more information, see Walkthrough: Enabling Dynamic Data in ASP.NET Data-Bound Controls.

Declarative DynamicDataManager Control Syntax

The DynamicDataManager control has been enhanced so that you can configure it declaratively, as with most controls in ASP.NET, instead of only in code. The markup for the DynamicDataManager control resembles the following example:
<asp:DynamicDataManager ID="DynamicDataManager1" runat="server"  
    AutoLoadForeignKeys="true"> 
  <DataControls> 
    <asp:DataControlReference ControlID="GridView1" /> 
  </DataControls> 
</asp:DynamicDataManager> 
 
<asp:GridView id="GridView1" runat="server" 
</asp:GridView> 
This markup enables Dynamic Data behavior for the GridView1 control that is referenced in the DataControls section of the DynamicDataManager control.

Entity Templates

Entity templates offer a new way to customize the layout of data without requiring you to create a custom page. Page templates use the FormView control instead of the DetailsView control, as was used in page templates in earlier versions of Dynamic Data. Page templates also use the DynamicEntity control to render Entity templates. This gives you more control over the markup that is rendered by Dynamic Data.
For more information about entity templates, see ASP.NET 4 and Visual Studio 2010 Web Development Overview (.pdf format) on the ASP.NET Web site.

New Field Templates for URLs and E-mail Addresses

ASP.NET 4 introduces two new built-in field templates, EmailAddress.ascx and Url.ascx. These templates are used for fields that are marked as EmailAddress or Url using the DataTypeAttribute attribute. For EmailAddress objects, the field is displayed as a hyperlink that is created by using the mailto: protocol. When users click the link, it opens the user's e-mail client and creates a skeleton message. Objects typed as Url are displayed as ordinary hyperlinks.
The following example shows how to mark fields.
[DataType(DataType.EmailAddress)]
public object HomeEmail { get; set; }
 
[DataType(DataType.Url)]
public object Website { get; set; }

ASP.NET 4 adds new features to the multi-targeting feature to make it easier to work with projects that target earlier versions of the .NET Framework.
Multi-targeting was introduced in ASP.NET 3.5 to enable you to use the latest version of Visual Studio without having to upgrade existing Web sites or Web services to the latest version of the .NET Framework. 
In Visual Studio 2008, when you work with a project targeted for an earlier version of the .NET Framework, most features of the development environment adapt to the targeted version. However, IntelliSense displays language features that are available in the current version, and property windows display properties available in the current version. In Visual Studio 2010, only language features and properties available in the targeted version of the .NET Framework are shown.
JavaScript IntelliSense Enhancements
In Visual 2010, JScript IntelliSense has been redesigned to provide an even richer editing experience. IntelliSense now recognizes objects that have been dynamically generated by methods such as registerNamespace and by similar techniques used by other JavaScript frameworks. Performance has been improved to analyze large libraries of script and to display IntelliSense with little or no processing delay. Compatibility has been significantly increased to support almost all third-party libraries and to support diverse coding styles. Documentation comments are now parsed as you type and are immediately leveraged by IntelliSense.
QueryableFilterRepeater.
The ASP.NET chart server control enables you to create ASP.NET pages applications that have simple, intuitive charts for complex statistical or financial analysis. The chart control supports the following features:
·         Data series, chart areas, axes, legends, labels, titles, and more.
·         Data binding.
·         Data manipulation, such as copying, splitting, merging, alignment, grouping, sorting, searching, and filtering.
·         Statistical formulas and financial formulas.
·         Advanced chart appearance, such as 3-D, anti-aliasing, lighting, and perspective.
·         Events and customizations.
·         Interactivity and Microsoft Ajax.
·         Support for the Ajax Content Delivery Network (CDN), which provides an optimized way for you to add Microsoft Ajax Library and jQuery scripts to your Web applications.

 
What is the concept of Postback in ASP.NET?
A postback is a request sent from a client to server from the same page user is already working with.
ASP.NET was introduced with a mechanism to post an HTTP POST request back to the same page. It's basically posting a complete page back to server (i.e. sending all of its data) on same page. So, the whole page is refreshed.
Another concept related to this approach is "Callback" that is also asked sometimes during a technical interview question. Click here to understand Postback Vs Callback in ASP.NET.

Difference between ASP.NET WebForms and ASP.NET MVC?
ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it's own controller i.e. code-behind file that processes the request. On the other hand, ASP.NET MVC uses Front Controller approach. In this approach a common controller for all pages, processes the requests.
Please follow for detailed information on WebForms Vs MVC.

Please briefly explain ASP.NET Page life Cycle?
ASP.NET page passes through a series of steps during its life cycle. Following is the high-level explanation of life cycle stages/steps.

Initialization: Controls raise their Init event in this stage.Objects and variables are initializes for complete lifecyle of request.

LoadViewState: is a post back stage and loads the view state for the controls that enabled its view state property.

LoadPostBackData: is also a post back stage and loads the data posted for the controls and update them.

Load: In this stage page as well as all the controls raise their Load event. Till this stage all the controls are initialized and loaded. In most of the cases, we are coding this event handler.

RaisePostBackEvent: is again a postback stage. For example, it's raise against a button click event. We can easily put our code here to perform certain actions.

SaveViewState: Finally, controls state is saved in this stage before Rendering HTML.

Render: This is the stage where HTML is generated for the page.

Dispose: Lastly, all objects associated with the request are cleaned up.
For very detailed explanation of Page Life Cycle is explained here.

What is the difference between custom controls and user controls?
Custom controls are basically compiled code i.e. DLLs. These can be easily added to toolbox, so it can be easily used across multiple projects using drag and drop approach. These controls are comparatively hard to create.
But User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly couple with respect to User Interface and code. In order to use across multiple projects, we need to copy and paste to the other project as well.

What is the concept of view state in ASP.NET?
As in earlier question, we understood the concept of postback. So, in order to maintain the state between postbacks, ASP.NET provides a mechanism called view state. Hidden form fields are used to store the state of objects on client side and returned back to server in subsequent request (as postback occurs).

Difference between Response.Redirect and Server.Transfer?
In case of Response.Redirect, a new request is generated from client-side for redirected page. It's a kind of additional round trip. As new request is generated from client, so the new URL is visible to user in browser after redirection.
While in case of Server.Transfer, a request is transferred from one page to another without making a round trip from client. For the end user, URL remains the same in browser even after transferring to another page.

Please briefly explain the usage of Global.asax?
Global.asax is basically ASP.NET Application file. It’s a place to write code for Application-level events such as Application start, Application end, Session start and end, Application error etc. raised by ASP.NET or by HTTP Modules.

There is a good list of events that are fired but following are few of the important events in Global.asax:
  • Application_Init occurs in case of application initialization for the very first time.
  • Application_Start fires on application start.
  • Session_Start fires when a new user session starts
  • Application_Error occurs in case of an unhandled exception generated from application.
  • Session_End fires when user session ends.
  • Application_End fires when application ends or time out.

What are the different types of Validation controls in ASP.NET?

In order to validate user input, ASP.NET provides validation server controls. All validation controls inherits from BaseValidator class which contains the common validation properties and methods like ControlToValidate, Enabled, IsValid, EnableClientScript, ValidationGroup,Validate() etc.

ASP.Net provides a range of validation controls:
  • RequiredFieldValidator validates compulsory/required input.
  • RangeValidator validates the range. Validates that input falls between the given range values.
  • CompareValidator validates or compares the input of a control with another control value or with a fixed value.
  • RegularExpressionValidator validates input value against a defined regular expression pattern.
  • CustomValidator allows to customize the validation logic with respect to our application logic.
  • ValidationSummary displays all errors on page collectively.

What are the types of Authentication in ASP.NET?

There are three types of authentication available in ASP.NET:
  • Windows Authentication: This authentication method uses built-in windows security features to authenticate user.
  • Forms Authentication: authenticate against a customized list of users or users in a database.
  • Passport Authentication: validates against Microsoft Passport service which is basically a centralized authentication service.

What are Session state modes in ASP.NET?

ASP.NET supports different session state storage options:
  • In-Process is the default approach. It stores session state locally on same web server memory where the application is running.
  • StateServer mode stores session state in a process other than the one where application is running. Naturally, it has added advantages that session state is accessible from multiple web servers in a Web Farm and also session state will remain preserved even web application is restarted.
  • SQLServer mode stores session state in SQL Server database. It has the same advantages as that of StateServer.
  • Custom modes allows to define our custom storage provider.
  • Off mode disables session storage.
Why would you like to change the company?

1) I am looking for a more challenging career in a firm with a larger employee base such as yours.
2) Keeping in mind my career goals, the time has come for me to move onto the next rung of 
the ladder and make a mark for myself. This can be achieved in a company like this.
3) It is just a career move to enhance my knowledge in my own area of interest.
After completion of this question only interview will go for further questions

Difference between stored procedure and function
1) Procedure can return zero or n values whereas function can return one value which is mandatory.
2) Procedures can have input, output parameters for it whereas functions can have only input parameters.
3) Procedure allows select as well as DML statement in it whereas function allows only select statement in it.
4) Functions can be called from procedure whereas procedures cannot be called from function.
5) Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.
6) We can go for transaction management in procedure whereas we can't go in function.
7) Procedures cannot be utilized in a select statement whereas function can be embedded in a select statement.
Difference between Abstract and Interface
Abstract Class:

-Abstract class provides a set of rules to implement next class
-Rules will be provided through abstract methods
-Abstract method does not contain any definition
-While inheriting abstract class all abstract methods must be override
-If a class contains at least one abstract method then it must be declared as an “Abstract Class”
-Abstract classes cannot be instantiated (i.e. we cannot create objects), but a reference can be created
-Reference depends on child class object’s memory
-Abstract classes are also called as “Partial abstract classes”
-Partial abstract class may contain functions with body and functions without body
-If a class contains all functions without body then it is called as “Fully Abstract Class” (Interface)

Interface:

-If a class contains all abstract methods then that class is known as “Interface”
-Interfaces support like multiple inheritance
-In interface all methods r public abstract by default
-Interfaces r implementable
-Interfaces can be instantiated, but a reference cannot be created
Index types in SQL Server
Clustered Index

Only 1 allowed per table physically rearranges the data in the table to confirm to the index constraints for use on columns that are frequently searched for ranges of data for use on columns with low selectivity.
Non-Clustered Index

Up to 249 allowed per table creates a separate list of key values with pointers to the location of the data in the data pages For use on columns that are searched for single values 

A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages. A non-clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a non-clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
Included Column Index (New in SQL Server 2005) 

In SQL Server 2005, the functionality of non-clustered indexes is extended by adding non-key columns to the leaf level of the non-clustered index. Non-key columns can help to create cover indexes. By including non-key columns, you can create non-clustered indexes that cover more queries. The Database Engine does not consider non-key columns when calculating the number of index key columns or index key size. Non-key columns can be included in non-clustered index to avoid exceeding the current index size limitations of a maximum of 16 key columns and a maximum index key size of 900 bytes. Another advantage is that using non-key column in index we can have index data types not allowed as index key columns generally.

In following example column Filename is varchar(400), which will increase the size of the index key bigger than it is allowed. If we still want to include in our cover index to gain performance we can do it by using the Keyword INCLUDE.

USE AdventureWorks
GO
CREATE INDEX IX_Document_Title
ON Production.Document (Title, Revision)
INCLUDE (FileName)

Non-key columns can be included only in non-clustered indexes. Columns can’t be defined in both the key column and they INCLUDE list. Column names can’t be repeated in the INCLUDE list. Non-key columns can be dropped from a table only after the non-key index is dropped first. For Included Column Index to exist there must be at least one key column defined with a maximum of 16 key columns and 1023 included columns.

Avoid adding unnecessary columns. Adding too many index columns, key or non-key as they will affect negatively on performance. Fewer index rows will fit on a page. This could create I/O increases and reduced cache efficiency. More disk space will be required to store the index. Index maintenance may increase the time that it takes to perform modifications, inserts, updates, or deletes, to the underlying table or indexed view.
Another example to test:

Create following Index on Database AdventureWorks in SQL SERVER 2005

USE AdventureWorks
GO
CREATE NONCLUSTERED INDEX IX_Address_PostalCode
ON Person.Address (PostalCode)
INCLUDE (AddressLine1, AddressLine2, City, StateProvinceID)
GO

Test the performance of following query before and after creating Index. The performance improvement is significant.
SELECT AddressLine1, AddressLine2, City, StateProvinceID, PostalCode
FROM Person.Address
WHERE PostalCode BETWEEN '98000'
AND '99999';
GO
Interview questions 
What are differences between Array list and Hash table?

Ans: 1) Hash table store data as name, value pair. While in array only value is store.
2) To access value from hash table, you need to pass name. While in array, to access value, you need to pass index number.
3) you can store different type of data in hash table, say int, string etc. while in array you can store only similar type of data.
What are differences between system.stringbuilder and system.string?

The main difference is system.string is immutable and system.stringbuilder is a mutable. Append keyword is used in string builder but not in system.string.
Immutable means once we created we cannot modified. Suppose if we want give new value to old value simply it will discarded the old value and it will create new instance in memory to hold the new value.
What are the differences between Application object and session object?

Ans: The session object is used to maintain the session of each user. If one user enter in to the application then they get session id if he leaves from the application then the session id is deleted. If they again enter in to the application they get different session id.
But for application object the id is maintained for whole application. 
What are the different types of indexes?

Ans: Two types of indexes are there one is clustered index and non-clustered index
How many types of memories are there in .net? 

Ans: Two types of memories are there in .net stack memory and heap memory
Is it possible to set the session out time manually? 

Ans: Yes we can set the session out time manually in web.config.
What are differences between function and stored procedure?

Ans:
1) Function returns only one value but procedure returns one or more than one value.
2) Function can be utilized in select statements but that is not possible in procedure.
3) Procedure can have an input and output parameters but function has only input parameters only.
4) Exceptions can be handled by try catch block in procedures but that is not possible in function.
What are the differences between Abstract and interface?

Ans:  1) Abstract cannot be instantiated but we can inherit. Interface it cannot be inherit it can be instantiate
2) Interface contain only declarations no definitions. Abstract contain declarations and definitions.
3) The class which contains only abstract methods is interface class. A class which contains abstract method is called abstract class
4) Public is default access specifier for interface we don’t have a chance to declare other specifiers. In abstract we have chance to declare with any access specifier
Can you Explain Page lifecycle in .net?
Can you Explain .NET architecture in .net?
What is the difference between primary key and unique key with not null?

Ans: There is no difference between primary key and unique key with not null.
What is boxing and unboxing concepts in .net? 

Ans: Boxing is a process of converting value type into reference type
Unboxing is a process of converting reference type to value type.
What are the differences between value type and reference type?

Ans: Value type contain variable and reference type are not containing value directly in its memory.
Memory is allocated in managed heap in reference type and in value type memory allocated in stack. Reference type ex-class value type-struct, enumeration
Is it possible to host the website from desktop?

Ans: Yes 
Why we go for page rendering in Asp.Net Page life cycle?

Ans: Browser understands an only html control that’s why in page rendering we will convert the aspx controls into html controls.
Write a sample query for self join?

Ans: Select e1.ename, e2.empid from emp e1, emp e2 where e1.empid=e2.mgrid;
Can we change the index of primary key on table?

Ans: No
How to change the name of the table or stored procedure in sql?

Ans: sp_rename oldtablename newtablename
For changing the column name
Sp_rename  ‘tablename.[Oldcolumnname]’,’newcolumnname’,’Column’
Ex:sp_rename ‘tblemp.first’,’namechange’,’Column’
How to find out which index is defined on table?

Ans: sp_helpindex tablename
Can you write the program to find the length of string without using library function?

Ans: for (int i=0; str[i]!=”\n”; i++)
{
Count++;
}
What is the difference between scope_identity() and current_identity()?

Ans: Scope_identity and current _identity both are similar and it will return the last identity value generated in the table.
Scope_Identity will return the identity value in table that is currently in scope
What are difference between GET and POST Methods?

Ans:
GET Method (): 

1) Data is appended to the URL.
2) Data is not secret.
3) It is a single call system
4) Maximum data that can be sent is 256.
5) Data transmission is faster
6) this is the default method for many browsers

POST Method (): 


1) Data is not appended to the URL.
2) Data is Secret
3) it is a two call system.
4) There is no Limit on the amount of data. That is characters any amount of data can be sent.
5) Data transmission is comparatively slow.
6) No default and should be explicitly specified.
What are difference between truncate and delete?

Ans: 1) Delete keep the lock over each row where Truncate keeps the lock on table not on all the row.
2) Counter of the Identity column is reset in Truncate where it is not reset in Delete.
3) Trigger is not fired in Truncate where as trigger is fired in Delete.
4) In TRUNCATE we cannot rollback.
5) In DELETE we can rollback
What is the difference Grid View and between Data Grid (Windows)?

Ans:
1) GridView Control Enables you to add sorting, paging and editing capabilities without writing any code.
2)GridView Control Automatically Supports paging by setting the ‘PagerSetting’ Property.The Page Setting Property supports four Modles 

a. Numeric(by default)
b. Next Previous
c. NumericFirstLast
d. Next PreviousLast

3)It is Used in asp.net
4)GridView Supports RowUpdating and RowUpdated Events.
5)GidView is Capable of Pre-Operations and Post-Operations.
6)GridView Has EditTemplates for this control
7)It has AutoFormat

DataGrid(Windows)

1)DataGid Control raises single Event for operations
2)DataGird Supports the SortCommand Events that occur when a column is Soted.
3)DataGrid Supports UpdataCommand Event that occurs when the UpdateButton is clicked for an item in the grid.
4)DataGrid is used in Windows GUI Application.
5)It doesnot have EditTemplates for this control
6)It doesnot have AutoFormat
If I write System.exit (0); at the end of the try block, will the finally block still execute?

Ans: No in this case the finally block will not execute because when you say system.exit(0),the control immediately goes out of the program, and thus finally never executes.
What are the different levels of State management in ASP.NET?

Ans:
State management is the process by which you maintain state and page information over multiple requests for the same or different pages.

There are 2 types State Management:

1. Client – Side State Management
This stores information on the client's computer by embedding the information into a Web page, a uniform resource locator (url), or a cookie. The techniques available to store the state information at the client end are listed down below:

a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.

b. Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state.

c. Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed.

d. Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site.

e. Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.

2. Server – Side State Management
a. Application State - Application State information is available to all pages, regardless of which user requests a page.

b. Session State – Session State information is available to all pages opened by a user during a single visit.

Both application state and session state information is lost when the application restarts. To persist user data between application restarts, you can store it using profile properties.
Abstract Class:
Abstract class is a class which can’t be instantiate. Class should have “Abstract” key word with the name.  In any one of the method of class having abstract method with in it, then it should be define as abstract class. The class which derived the abstract class should have definition of the abstract method. These classes which derived the abstract class and implement the abstract methods call concrete class.
Abstract class may have the definition of function or may not.  Below is the simple example of an abstract class
public abstract alass AbstractStudent
    {
        String Roll
        {
            get;
            set;
        }

        String FirstName
        {
            get;
            set;
        }
       
        String LastName
        {
            get;
            set;
        }
       

        Public String GetStudentDetails()
             {

                  // Implementation of Method   
             }

        public String SaveStudentDetails ()
            {
                  // Implementation of Method   
             }

        public abstract String CalculateWage();

    }
So, the class having one abstract method so we need to mention the class as "abstract" .
Difference between Abstract Class and Interface?
Abstract class is a class which can’t be instantiated and which can have methods with definition as well as declaration also. This can be inherited. 

As for Example:

public abstract class AbstractStudent
    {
        String Roll
        {
            get;
            set;
        }

        String FirstName
        {
           get;
           set;
        }
  
        String LastName
        {
           get;
            set;
        }

        Public String GetStudentDetails()
            {
                 // Implementation of Method  
             }

        public String SaveStudentDetails ()
            {
                  // Implementation of Method  
            }

        public abstract String CalculateWage();

    }


Interface can only contain the methods declaration and can be implemented in the class.

As for Example:
Public interface IStudnet
    {
        String Roll
        {
           get;
            set;
        }

        String FirstName
        {
            get;
            set;
        }
   
        String LastName
        {
            get;
            set;
        }
  
        String GetStudentDetails();
        String SaveStudentDetails ();
    }

Below are the few main difference between Abstract Class and Interface

a.    In abstract class method can have definition as well as declaration also. But Interface should have only definition.
b.    All the Methods are Public as default and don’t have any access Modifier Controls in interface, whereas for abstract class we can have access modifier for methods.
c.    Abstract class can have constructor or destructor, whereas interface not.
d.    Abstract class can’t be part of multiple inheritance and we can implement multiple interface.
What do you mean by String objects are immutable?

String objects are immutable as its state cannot be modified once created. Every time when we perform any operation like add, copy, replace, and case conversion or when we pass a string object as a parameter to a method a new object will be created.

Example:
String str = "ABC";
str.Replace("A","X");

Here Replace() method will not change data that "str" contains, instead a new string object is created to hold data "XBC" and the reference to this object is returned by Replace() method.

So in order to point str to this object we need to write below line.
str = str.Replace("A","X");
Now the new object is assigned to the variable str. earlier object that was assigned to str will take care by garbage collector as this one is no longer in used.
What is dll hell problem in .NET and how it will solve?

Ans: Dll hell, is kind of conflict that occurred previously, due to the lack of version supportability of dll for (within) an application
.NET Framework provides operating system with a global assembly cache. This cache is a repository for all the .net components that are shared globally on a particular machine. When a .net component installed onto the machine, the global assembly cache looks at its version, its public key and its language information and creates a strong name for the component. The component is then registered in the repository and indexed by its strong name, so there is no confusion between the different versions of same component, or DLL
What is a Partial class?

Ans: Instead of defining an entire class, you can split the definition into multiple classes by using partial class keyword. When the application compiled, c# compiler will group all the partial classes together and treat them as a single class. There are a couple of good reasons to use partial classes. Programmers can work on different parts of classes without needing to share same physical file
Ex:
Public partial class employee
{
Public void somefunction()
{
}
}
Public partial class employee
{
Public void function ()
{
}
}
What is difference between constants, read-only and, static?

Constants: The value can’t be changed
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.
What is the cross page post backing?

Asp.Net 2.0 fixed this with built-in features that allowed us to easily send information from one page to another.

Button control has property PostBackUrl that can be set to URL of any page in our ASP.Net WebSite where we want to transfer all form values to.
Along with that Asp.Net 2.0 Page class has a property PreviousPage that allows us to get reference to the Page object that initiated the postback (in other words to get the actual reference to the Page object of the aspx page on which user clicked the Submit button on a HTML form).

So for example lets create two sample pages in our Web Application:  
  • SourcePage.aspx
  • DestinationPage.aspx
In SoucePage in Html form we will put two TextBox controls (one for First Name and one for Last Name) and one Button component  and set its PostBackUrl property to "~/DestinationPage.aspx".

SourcePage.aspx:
    <form id="form1" runat="server">
        <div>
            First Name:&nbsp;<asp:TextBox ID="FirstName" runat="server"></asp:TextBox><br />
            Last Name:&nbsp;<asp:TextBox ID="LastName" runat="server"></asp:TextBox><br /><br />
            <asp:Button ID="Button1" runat="server" Text="Submit To Destination Page" PostBackUrl="~/CrossPagePostbacks/DestinationPage.aspx" />
        </div>
    </form>

When our user clicks the Submit button, all the values from the HTML Form on SourcePage.aspx will be transfered to the DestinationPage.aspx and we will also be able to get reference to the SourcePage.aspx in our DestinationPage with the PreviousPage property like this:

So in our DestinationPage.aspx.cs code-behind we can easily access two TextBox controls on SourcePage.aspx and show them in two label controls like this:
    protected void Page_Load(object sender, EventArgs e)
    {
        // first check if we had a cross page postback
        if ( (PreviousPage != null) && (PreviousPage.IsCrossPagePostBack) )
        {
            Page previousPage = PreviousPage;
            TextBox firstName = (TextBox)previousPage.FindControl("FirstName");
            TextBox lastName = (TextBox)previousPage.FindControl("LastName");
            // we can now use the values from TextBoxes and display them in two Label controls..
            labelFirstName.Text = firstName.Text;
            labelLastName.Text = lastName.Text;
         }
    }

You probably noticed that we first checked if PreviousPage property of current page (DestinationPage.aspx) is NOT NULL, this is done to avoid running our code in case that user opens our DestinationPage.aspx directly, without running a cross page postback.

Also here we checked the another PreviousPage property called IsCrossPagePostBack to see if we really had a CrossPagePostback.
(If Server.Transfer is used to redirect to this page, IsCrossPagePostBack property will be set to FALSE.

TIP: We can be completely sure that we have a  real CrossPagePostback ONLY IF:
  1. Page.PreviousPage is NOT NULL,
  2. PreviousPage.IsCrossPagePostback is true
This important to check to avoid errors in code.

Now this is very useful and i'm sure you are eager to use this in your next project. But wait, we are not over yet!

Finding the controls on PreviousPage with FindControl method and type-casting them from object to their real type is a little messy.
It feels like there must be a better solution for this!

And here it is: We can use the <%@ PreviousPageType %> directive in the header of our DestinationPage.aspx like this
    <%@ PreviousPageType VirtualPath="~/SourcePage.aspx" %>
to declare our previous page type, and then we can access Public properties of the PreviousPage without typecasting.
Now all we need to do is to create some public properties on our SourcePage.aspx.cs to expose data/Controls we want to the destionation page:
    public partial class SourcePage : System.Web.UI.Page
    {
        public string FormFirstName
        {
            get { return FirstName.Text; }
        }
        public string FormLastName
        {
            get { return LastName.Text; }
        }
    }

And then we can change the Page_Load code in our DestinationPage.aspx to much cleaner code like this:
    protected void Page_Load(object sender, EventArgs e)
    {
        // first check if we had a cross page postback
        if ( (PreviousPage != null) && (PreviousPage.IsCrossPagePostBack) )
        {
            SourcePage prevPage = PreviousPage;
            // we can now use the values from textboxes and display them in two Label controls..
            labelFirstName.Text = prevPage.FormFirstName;
            labelLastName.Text = prevPage.FormLastName;     
        }
    }

SourcePage type used in the code is offcourse name of the partial class defined is SourcePage.aspx.cs that inherits System.Web.UI.Page that is automatically created for us when we created new WebForm in VisualStudio.

This code is much cleaner and easier to follow, there is no ugly typecasting, just simple property values to use to retrieve the data from previous page.


When should you use Abstract Class vs Interface while programming?

 Ans: When we want that sub class must implement all the methods of base class. In such a situation we will implement the interface. In the other hand when we want only some method of base class in our sub class then use base class as abstract class.
What is the difference between application exception and system exception?

Ans: The difference between application exception and system exception is that system exceptions are thrown by CLR and application exceptions are thrown by applications.
What is the difference between authorization and authentication?

Ans: Authorization is a process of allowing or denying resources to particular user or record 
Declaration of authorization is

<authorization>
<allow users=”Suresh, Sanjay”/>
<deny users=”Ramana, Rakesh”>
</authorization>
Sometimes authorization allows the unauthorized persons at that time we will use
<deny users=”?”/>
Authentication means

Authentication is a process where we identify the credentials of user i.e. username, password and create an identity to mention user as an authenticated.  
What is the use of n-tier architecture and 3-tier architecture?


Check this article for 3-tier architecture 3 tier architecture example in asp.net
How to get the version of the assembly?

Ans: lbltxt.text=Assembly. GetExecutingAssembly().GetName().Version.ToString();
What is the location of Global Assembly Cache on the system?

Ans: c:\Windows\assembly
 What is the serialization?

Ans: Serialization is a process of converting object into a stream of bites.
What is synchronization?

Ans: The mechanism needed to block one thread access to the data. If the data is being accessed by another thread.
Synchronization can be accessed by using system.monitor class
A monitor class methods are enter, exit, pulse for this lock statement is also used
Suppose if we need to synchronize some data at that time we need to place that data in this block
Lock
{
}
Whatever the data has been placed into the lock block that data has been blocked
What are the thread priority levels?

Ans: Thread priority levels are five types
         0 - Zero level
         1 - Below Normal
         2 - Normal
         3 - Above Normal
         4 - Highest
By Default priority level is 2
What is the difference between .tostring(), Convert.tostring()?

Ans: The basic difference between them is “Convert” function handles NULLS while
“.ToString()” does not it will throw a NULL reference exception error. So as a good coding
practice using “convert” is always safe.
What is Collation?

Ans: Collation refers to a set of rules that determine how the data is sorted and compared.
What is the difference between Primary key and unique key?

Ans: Primary key does not allow the null values but unique key allows one null value.
Primary key will create clustered index on column but unique key will create non-clustered index by default.
How many web.config files are there in 1 project?

Ans: There might be multiple web.config files for a single project depending on the hierarchy of folders inside the root folder of the project, so for each folder we can use one web.config file
What is the difference between throw and throw ex?
What is the difference between view state and hidden field?

Ans: viewstate is secured hidden field is insecure
Viewstate will store large amount of data but hidden filed will store small amount of data. 
What is the difference between binary serialization and xml serialization?
What is the Difference between read only and constant variables?

Ans: Read only can assign the values at runtime only.
Constant will assign the values at compile time only.
We cannot modify the both variable values.
What is static keyword in .Net?

Ans: Static is same as constant variable but we can change the value of static variable and we can access the variables without creating any instances
What is the use of business logic layer in 3-tier architecture in .net?

Ans: Though a web site could talk to the data access layer directly, it usually goes through another layer called the business layer. The business layer is vital in that it validates the input conditions before calling a method from the data layer. This ensures the data input is correct before proceeding, and can often ensure that the outputs are correct as well. This validation of input is called business rules, meaning the rules that the business layer uses to make “judgments” about the data.

However, business rules don’t only apply to data validation; these rules apply to any calculations or any other action that takes place in the business layer. Normally, it’s best to put as much logic as possible in the business layer, which makes this logic reusable across applications.

One of the best reasons for reusing logic is that applications that start off small usually grow in functionality. For instance, a company begins to develop a web site, and as they realize their business needs, they later decide to add a smart client application and windows service to supplement the web site. The business layer helps move logic to a central layer for “maximum reusability.”

1 :: 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 by .NET

2 :: How is .NET able to support multiple languages?
A language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.

3 :: How ASP .NET different from ASP?
Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.

4 :: What is smart navigation in .NET?
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.

5 :: What is view state in .NET?
The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control
6 :: How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for validation of any controle.
We have Range Validator, Email Validator in .NET to validate any control.
7 :: Can the validation be done in the server side? Or this can be done only in the Client side?
Client side is done by default. Server side validation is also possible in .NET. We can switch off the client side and server side can be done only in .NET
8 :: How to manage pagination in a page using .NET?
Using pagination option in DataGrid control is available in .NET. We have to set the number of records for a page, then it takes care of pagination by itself automatically.
9 :: What is ADO .NET and what is difference between ADO and ADO.NET?
ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch
10 :: Observations between VB.NET and VC#.NET?
Choosing a programming language depends on your language experience and the scope of the application you are building. While small applications are often created using only one language, it is not uncommon to develop large applications using multiple languages.
For example, if you are extending an application with existing XML Web services, you might use a scripting language with little or no programming effort. For client-server applications, you would probably choose the single language you are most comfortable with for the entire application. For new enterprise applications, where large teams of developers create components and services for deployment across multiple remote sites, the best choice might be to use several languages depending on developer skills and long-term maintenance expectations.
The .NET Platform programming languages - including Visual Basic .NET, Visual C#, and Visual C++ with managed extensions, and many other programming languages from various vendors - use .NET Framework services and features through a common set of unified classes. The .NET unified classes provide a consistent method of accessing the platform's functionality. If you learn to use the class library, you will find that all tasks follow the same uniform architecture. You no longer need to learn and master different API architectures to write your applications.
11 :: Advantages of migrating to VB.NET?
Visual Basic .NET has many new and improved language features — such as inheritance, interfaces, and overloading that make it a powerful object-oriented programming language. As a Visual Basic developer, you can now create multithreaded, scalable applications using explicit multithreading. Other new language features in Visual Basic .NET include structured exception handling, custom attributes, and common language specification (CLS) compliance.
The CLS is a set of rules that standardizes such things as data types and how objects are exposed and interoperate. Visual Basic .NET adds several features that take advantage of the CLS. Any CLS-compliant language can use the classes, objects, and components you create in Visual Basic .NET. And you, as a Visual Basic user, can access classes, components, and objects from other CLS-compliant programming languages without worrying about language-specific differences such as data types.
CLS features used by Visual Basic .NET programs include assemblies, namespaces, and attributes.
12 :: Advantages of VB.NET?
1. First of all, VB.NET provides managed code execution that runs under the Common Language Runtime (CLR), resulting in robust, stable and secure applications. All features of the .NET framework are readily available in VB.NET.
2. VB.NET is totally object oriented. This is a major addition that VB6 and other earlier releases didn't have.
3. The .NET framework comes with ADO.NET, which follows the disconnected paradigm, i.e. once the required records are fetched the connection no longer exists. It also retrieves the records that are expected to be accessed in the immediate future. This enhances Scalability of the application to a great extent.
4. VB.NET uses XML to transfer data between the various layers in the DNA Architecture i.e. data are passed as simple text strings.
5. Error handling has changed in VB.NET. A new Try-Catch-Finally block has been introduced to handle errors and exceptions as a unit, allowing appropriate action to be taken at the place the error occurred thus discouraging the use of ON ERROR GOTO statement. This again credits to the maintainability of the code.
13 :: Using ActiveX Control in .Net?
ActiveX control is a special type of COM component that supports a User Interface. Using ActiveX Control in your .Net Project is even easier than using COM component. They are bundled usually in .ocx files. Again a proxy assembly is made by .Net utility AxImp.exe (which we will see shortly) which your application (or client) uses as if it is a .Net control or assembly.

Making Proxy Assembly For ActiveX Control: First, a proxy assembly is made using AxImp.exe (acronym for ActiveX Import) by writing following command on Command Prompt:

C:> AxImp C:MyProjectsMyControl.ocx
This command will make two dlls, e.g., in case of above command

MyControl.dll
AxMyControl.dll
The first file MyControl.dll is a .Net assembly proxy, which allows you to reference the ActiveX as if it were non-graphical object.

The second file AxMyControl.dll is the Windows Control, which allows u to use the graphical aspects of activex control and use it in the Windows Form Project.

Adding Reference of ActiveX Proxy Assembly in your Project Settings: To add a reference of ActiveX Proxy Assembly in our Project, do this:
14 :: What is Machine.config in .NET?
Machine configuration file: The machine.config file contains settings that apply to the entire computer. This file is located in the %runtime install path%Config directory. There is only one machine.config file on a computer. The Machine.Config file found in the "CONFIG" subfolder of your .NET Framework install directory (c:WINNTMicrosoft.NETFramework{Version Number}CONFIG on Windows 2000 installations). The machine.config, which can be found in the directory $WINDIR$Microsoft.NETFrameworkv1.0.3705CONFIG, is an XML-formatted configuration file that specifies configuration options for the machine. This file contains, among many other XML elements, a browserCaps element. Inside this element are a number of other elements that specify parse rules for the various User-Agents, and what properties each of these parsings supports.

For example, to determine what platform is used, a filter element is used that specifies how to set the platform property based on what platform name is found in the User-Agent string. Specifically, the machine.config file contains:

platform=Win95
platform=Win98
platform=WinNT
...
15 :: What is Web.config in .NET?
In classic ASP all Web site related information was stored in the metadata of IIS. This had the disadvantage that remote Web developers couldn't easily make Web-site configuration changes. For example, if you want to add a custom 404 error page, a setting needs to be made through the IIS admin tool, and you're Web host will likely charge you a flat fee to do this for you. With ASP.NET, however, these settings are moved into an XML-formatted text file (Web.config) that resides in the Web site's root directory. Through Web.config you can specify settings like custom 404 error pages, authentication and authorization settings for the Web sitempilation options for the ASP.NET Web pages, if tracing should be enabled, etc. The Web.config file is an XML-formatted file. At the root level is the tag. Inside this tag you can add a number of other tags, the most common and useful one being the system.web tag, where you will specify most of the Web site configuration parameters. However, to specify application-wide settings you use the tag.

For example, if we wanted to add a database connection string parameter we could have a Web.config file like so.
16 :: What is the difference between ADO and ADO.NET?
ADO uses Recordsets and cursors to access and modify data. Because of its inherent design, Recordset can impact performance on the server side by tying up valuable resources. In addition, COM marshalling - an expensive data conversion process - is needed to transmit a Recordset. ADO.NET addresses three important needs that ADO doesn't address:

1. Providing a comprehensive disconnected data-access model, which is crucial to the Web environment
2. Providing tight integration with XML, and
3. Providing seamless integration with the .NET Framework (e.g., compatibility with the base class library's type system). From an ADO.NET implementation perspective, the Recordset object in ADO is eliminated in the .NET architecture. In its place, ADO.NET has several dedicated objects led by the DataSet object and including the DataAdapter, and DataReader objects to perform specific tasks. In addition, ADO.NET DataSets operate in disconnected state whereas the ADO RecordSet objects operated in a fully connected state.
In ADO, the in-memory representation of data is the recordset. In ADO.NET, it is the dataset. A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table. In contrast, a dataset is a collection of one or more tables.
17 :: What is the difference between VB and VB.NET?
Now VB.NET is object-oriented language. The following are some of the differences:

Data Type Changes

The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET:

. Under .NET the integer data type in VB.NET is also 4 bytes in size.
. VB.NET has no currency data type. Instead it provides decimal as a replacement.
. VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters.
. VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type).
. In VB.NET there is no concept of fixed length strings.
. In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose.
Declaring Variables
Consider this simple example in VB6:
Dim x,y as integer
18 :: What is a Strong Name in .NET?
A strong name consists of the assembly's identity its simple text name, version number, and culture information (if provided) plus a public key and a digital signature. It is generated from an assembly file (the file that contains the assembly manifest, which in turn contains the names and hashes of all the files that make up the assembly), using the corresponding private key. Assemblies with the same strong name are expected to be identical.

Strong names guarantee name uniqueness by relying on unique key pairs. No one can generate the same assembly name that you can, because an assembly generated with one private key has a different name than an assembly generated with another private key.

When you reference a strong-named assembly, you expect to get certain benefits, such as versioning and naming protection. If the strong-named assembly then references an assembly with a simple name, which does not have these benefits, you lose the benefits you would derive from using a strong-named assembly and revert to DLL conflicts. Therefore, strong-named assemblies can only reference other strong-named assemblies.

There are two ways to sign an assembly with a strong name:

1. Using the Assembly Linker (Al.exe) provided by the .NET Framework SDK.
2. Using assembly attributes to insert the strong name information in your code. You can use either the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, depending
19 :: What is a Manifest in .NET?
An assembly manifest contains all the metadata needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE (Portable Executable) file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE (Portable Executable) file that contains only assembly manifest information. The following table shows the information contained in the assembly manifest. The first four items the assembly name, version number, culture, and strong name information make up the assembly's identity.
Assembly name: A text string specifying the assembly's name.

Version number: A major and minor version number, and a revision and build number. The common language runtime uses these numbers to enforce version policy.

Culture: Information on the culture or language the assembly supports. This information should be used only to designate an assembly as a satellite assembly containing culture- or language-specific information. (An assembly with culture information is automatically assumed to be a satellite assembly.) Strong name information: The public key from the publisher if the assembly has been given a strong name. List of all files in the assembly:
20 :: Creating a Key Pair in .NET?
You can create a key pair using the Strong Name tool (Sn.exe). Key pair files usually have an .snk extension. To create a key pair At the command prompt, type the following command:

sn k

In this command, file name is the name of the output file containing the key pair. The following example creates a key pair called sgKey.snk.

sn -k sgKey.snk
21 :: What is the difference between "using System.Data;" and directly adding the reference from "Add References Dialog Box"?
When u compile a program using command line, u add the references using /r switch. When you compile a program using Visual Studio, it adds those references to our assembly, which are added using "Add Reference" dialog box. While "using" statement facilitates us to use classes without using their fully qualified names.

For example: if u have added a reference to "System.Data.SqlClient" using "Add Reference" dialog box then u can use SqlConnection class like this:

System.Data.SqlClient.SqlConnection

But if u add a "using System.Data.SqlClient" statement at the start of ur code then u can directly use SqlConnection class.
On the other hand if u add a reference using "using System.Data.SqlClient" statement, but don't add it using "Add Reference" dialog box, Visual Studio will give error message while we compile the program.
22 :: What is GAC in .NET?
The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to. Assemblies deployed in the global assembly cache must have a strong name. When an assembly is added to the global assembly cache, integrity checks are performed on all files that make up the assembly. The cache performs these integrity checks to ensure that an assembly has not been tampered with, for example, when a file has changed but the manifest does not reflect the change. Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK or Use Windows Explorer to drag assemblies into the cache. To install a strong-named assembly into the global assembly cache At the command prompt, type the following command:

gacutil I

In this command, assembly name is the name of the assembly to install in the global assembly cache.
23 :: What is a Metadata in .NET?
Metadata is information about a PE. In COM, metadata is communicated through non-standardized type libraries.

In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain guidelines; it contains information such as the assembly’s name, version, language (spoken, not computera.k.a., culture), what external types are referenced, what internal types are exposed, methods, properties, classes, and much more.

The CLR uses metadata for a number of specific purposes. Security is managed through a public key in the PE’s header.

Information about classes, modules, and so forth allows the CLR to know in advance what structures are necessary. The class loader component of the CLR uses metadata to locate specific classes within assemblies, either locally or across networks.

Just-in-time (JIT) compilers use the metadata to turn IL into executable code.

Other programs take advantage of metadata as well.

A common example is placing a Microsoft Word document on a Windows 2000 desktop. If the document file has completed comments, author, title, or other Properties metadata, the text is displayed as a tool tip when a user hovers the mouse over the document on the desktop. You can use the Ildasm.exe utility to view the metadata in a PE. Literally, this tool is an IL disassembler.
24 :: What is managed code and managed data in .NET?
Managed code is code that is written to target the services of the Common Language Runtime.
In order to target these services, the code must provide a minimum level of information (metadata) to the runtime.
All C#, Visual Basic .NET, and JScript .NET code is managed by default.
Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR).
Closely related to managed code is managed data--data that is allocated and de- allocated by the Common Language Runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default.
C# data can, however, be marked as unmanaged through the use of special keywords.
Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector.
In addition, the class becomes a full participating member of the .NET Framework community, with the benefits and restrictions that it brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class).
An example of a restriction is that a managed class can only inherit from one base class.
25 :: What is .NET and .NET Framework?
It is a Framework in which Windows applications may be developed and run. The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications. It provides a highly productive, standards-based, multi-language environment for integrating existing investments with next-generation applications and services as well as the agility to solve the challenges of deployment and operation of Internet-scale applications. The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server Pages called ASP.NET. The .NET Framework provides a new programming model and rich set of classes designed to simplify application development for Windows, the Web, and mobile devices. It provides full support for XML Web services, contains robust security features, and delivers new levels of programming power. The .NET Framework is used by all Microsoft languages including Visual C#, Visual J#, and Visual C++.
26 :: What is Reflection in .NET?
It extends the benefits of metadata by allowing developers to inspect and use it at runtime. For example, dynamically determine all the classes contained in a given assembly and invoke their methods. Reflection provides objects that encapsulate assemblies, modules, and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object. You can then invoke the type's methods or access its fields and properties. Namespace: System.Reflection
27 :: What is "Common Type System" (CTS) in .NET?
CTS defines all of the basic types that can be used in the .NET Framework and the operations performed on those type.
All this time we have been talking about language interoperability, and .NET Class Framework. None of this is possible without all the language sharing the same data types. What this means is that an int should mean the same in VB, VC++, C# and all other .NET compliant languages. This is achieved through introduction of Common Type System (CTS).
28 :: What is "Common Language Specification" (CLS) in .NET?
CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow. It is a subsection of CTS and it specifies how it shares and extends one another libraries.
29 :: What is "Common Language Runtime" (CLR) in .NET?
CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that converts a MSIL code into the host machine language code, which is then executed appropriately. The CLR is the execution engine for .NET Framework applications. It provides a number of services, including:

- Code management (loading and execution)
- Application memory isolation
- Verification of type safety
- Conversion of IL to native code.
- Access to metadata (enhanced type information)
- Managing memory for managed objects
- Enforcement of code access security
- Exception handling, including cross-language exceptions
- Interoperation between managed code, COM objects, and pre-existing DLL's (unmanaged code and data)
- Automation of object layout
- Support for developer services (profiling, debugging, and so on)
30 :: What are Attributes in .NET?
Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Predefined attributes such as Assembly Version, which already exist and are accessed through the Runtime Classes; and custom attributes, which you write yourself by extending the System.Attribute class.
31 :: What are the Types of Assemblies in .NET?
Assemblies are of two types:

1. Private Assemblies
2. Shared Assemblies

Private Assemblies:
The assembly is intended only for one application. The files of that assembly must be placed in the same folder as the application or in a sub folder. No other application will be able to make a call to this assembly. The advantage of having a private assembly is that, it makes naming the assembly very easy, since the developer need not worry about name clashes with other assemblies. As long as the assembly has a unique name within the concerned application, there won't be any problems.
Shared Assemblies: If the assembly is to be made into a Shared Assembly, then the naming conventions are very strict since it has to be unique across the entire system. The naming conventions should also take care of newer versions of the component being shipped. These are accomplished by giving the assembly a Shared Name. Then the assembly is placed in the global assembly cache, which is a folder in the file system reserved for shared assemblies.
32 :: What is an Intermediate language?
Assemblies are made up of IL code modules and the metadata that describes them. Although programs may be compiled via an IDE or the command line, in fact, they are simply translated into IL, not machine code. The actual machine code is not generated until the function that requires it is called. This is the just-in-time, or JIT, compilation feature of .NET. JIT compilation happens at runtime for a variety of reasons, one of the most ambitious being Microsoft's desire for cross-platform .NET adoption. If a CLR is built for another operating system (UNIX or Mac), the same assemblies will run in addition to the Microsoft platforms. The hope is that .NET assemblies are write-once-run-anywhere applications. This is a .NET feature that works behind-the-scenes, ensuring that developers are not limited to writing applications for one single line of products. No one has demonstrated whether or not this promise will ever truly materialize.

CTS/CLS

The MSIL Instruction Set Specification is included with the .NET SDK, along with the IL Assembly Language Programmers Reference. If a developer wants to write custom .NET programming languages, these are the necessary specifications and syntax. The CTS and CLS define the types and syntax's that every .NET language needs to embrace. An application may not expose these features, but it must consider them when communicating through IL.
33 :: ASP.NET Authentication Providers and IIS Security?
ASP.NET implements authentication using authentication providers, which are code modules that verify credentials and implement other security functionality such as cookie generation. ASP.NET supports the following three authentication providers:

Forms Authentication: Using this provider causes unauthenticated requests to be redirected to a specified HTML form using client side redirection. The user can then supply logon credentials, and post the form back to the server. If the application authenticates the request (using application-specific logic), ASP.NET issues a cookie that contains the credentials or a key for reacquiring the client identity. Subsequent requests are issued with the cookie in the request headers, which means that subsequent authentications are unnecessary.

Passport Authentication: This is a centralized authentication service provided by Microsoft that offers a single logon facility and membership services for participating sites. ASP.NET, in conjunction with the Microsoft® Passport software development kit (SDK), provides similar functionality as Forms Authentication to Passport users.

Windows Authentication: This provider utilizes the authentication capabilities of IIS. After IIS completes its authentication, ASP.NET uses the authenticated identity's token to authorize access.

To enable a specified authentication provider for an ASP.NET application, you must create an entry in the applicati
34 :: What is the difference between ASP and ASP.NET?
ASP is interpreted. ASP.NET Compiled event base programming.
Control events for text button can be handled at client javascript only. Since we have server controls events can handle at server side.
More error handling.


ASP .NET has better language support, a large set of new controls and XML based components, and better user authentication.

ASP .NET provides increased performance by running compiled code.

ASP .NET code is not fully backward compatible with ASP.

ASP .NET also contains a new set of object oriented input controls, like programmable list boxes, validation controls. A new data grid control supports sorting, data paging, and everything you expect from a dataset control. The first request for an ASP.NET page on the server will compile the ASP .NET code and keep a cached copy in memory. The result of this is greatly increased performance.

ASP .NET is not fully compatible with earlier versions of ASP, so most of the old ASP code will need some changes to run under ASP .NET. To overcome this problem,

ASP .NET uses a new file extension ".aspx". This will make ASP .NET applications able to run side by side with standard ASP applications on the same server.
35 :: Using COM Component in .Net?
As most of you know that .Net does not encourage the development of COM components and provides a different solution to making reusable components through Assemblies. But, there are a lot of COM components present which our .Net application might need to use. Fortunately, .Net provides an extremely simple approach to achieve this. This is achieved by using ‘Wrapper Classes’ and ‘Proxy Components’. .Net wraps the COM component into .Net assembly technically called ‘Runtime Callable Wrapper’ or RCW. Then u can call and use your COM component just as a .Net (or C#, if u are using C#) Assembly.
36 :: What is an assembly in .NET?
An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit. .NET Assembly contains all the metadata about the modules, types, and other elements it contains in the form of a manifest. The CLR loves assemblies because differing programming languages are just perfect for creating certain kinds of applications. For example, COBOL stands for Common Business-Oriented Language because it’s tailor-made for creating business apps. However, it’s not much good for creating drafting programs. Regardless of what language you used to create your modules, they can all work together within one Portable Executable Assembly. There’s a hierarchy to the structure of .NET code. That hierarchy is Assembly - > Module -> Type -> Method." 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.
37 :: What is a Web Service in .NET?
A web service is a software component that exposes itself through the open communication channels of the Internet. Applications running on remote machines, on potentially different platforms, can access these components in a language and platform-independent manner. A Web Service is a group of functions, packaged together for use in a common framework throughout a network.
38 :: Explain webFarm Vs webGardens in .NET?
A web farm is a multi-server scenario. So we may have a server in each state of US. If the load on one server is in excess then the other servers step in to bear the brunt.
How they bear it is based on various models.
1. RoundRobin. (All servers share load equally)
2. NLB (economical)
3. HLB (expensive but can scale up to 8192 servers)
4. Hybrid (of 2 and 3).
5. CLB (Component load balancer).
A web garden is a multi-processor setup. i.e., a single server (not like the multi server above).
How to implement webfarms in .Net:
Go to web.config and Here for mode = you have 4 options.
a) Say mode=inproc (non web farm but fast when you have very few customers).
b) Say mode = StateServer (for webfarm)
c) Say mode = SqlServer (for webfarm)
Whether to use option b or c depends on situation. StateServer is faster but SqlServer is more reliable and used for mission critical applications.
How to use webgardens in .Net:
Go to web.config and Change the false to true. You have one more attribute that is related to webgarden in the same tag called cpuMask.
39 :: What is the difference between a namespace and assembly name in .NET?
A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionally related to file access. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code. The concept of a namespace is not related to that of an assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.
40 :: What’s a Windows process in .NET?
Windows process is an application that’s running and had been allocated memory in .NET
41 :: What’s typical about a Windows process in regards to memory allocation in .NET?
Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.
42 :: Explain what relationship is between a Process, Application Domain, and Application?
Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.
A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.
43 :: What are possible implementations of distributed applications in .NET?
.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.
44 :: What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services?
Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process. Web Services provide an open-protocol-based exchange of information. Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.
45 :: What’s a proxy of the server object in .NET Remoting?
It’s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as marshaling.
46 :: What are remotable objects in .NET Remoting?
Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.
47 :: What are channels in .NET Remoting?
Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.
48 :: What security measures exist for .NET Remoting in System.Runtime.Remoting?
None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.
49 :: What is a formatter in .NET?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
50 :: Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?
Binary over TCP is the most efficient, SOAP over HTTP is the most interoperable in .NET.
51 :: What’s SingleCall activation mode used for in .NET?
If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode in .NET
52 :: What’s Singleton activation mode in .NET?
A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.
53 :: How do you define the lease of the object in .NET?
By implementing ILease interface when writing the class code in .NET
54 :: Can you configure a .NET Remoting object via XML file?
Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.
55 :: How can you automatically generate interface for the remotable object in .NET with Microsoft tools?
Use the Soapsuds tool to generate automatically interface for the remotable object in .NET with Microsoft tools.
56 :: What is Delegation in .NET?
A delegate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.
Delegate is an entity that is entrusted with the task of representation, assign or passing on information. In code sense, it means a Delegate is entrusted with a Method to report information back to it when a certain task (which the Method expects) is accomplished outside the Method's class.
57 :: What is "Microsoft Intermediate Language" (MSIL)?
A .NET programming language (C#, VB.NET, J# etc.) does not compile into executable code; instead it compiles into an intermediate code called Microsoft Intermediate Language (MSIL). As a programmer one need not worry about the syntax of MSIL - since our source code in automatically converted to MSIL. The MSIL code is then send to the CLR (Common Language Runtime) that converts the code to machine language, which is, then run on the host machine. MSIL is similar to Java Byte code. MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects. Combined with metadata and the common type system, MSIL allows for true cross- language integration Prior to execution, MSIL is converted to machine code. It is not interpreted.
58 :: Differences between Datagrid, Datalist and Repeater in .NET?
1. Datagrid has paging while Datalist doesn't.
2. Datalist has a property called repeat. Direction = vertical/horizontal. (This is of great help in designing layouts). This is not there in Datagrid.
3. A repeater is used when more intimate control over html generation is required.
4. When only checkboxes/radiobuttons are repeatedly served then a checkboxlist or radiobuttonlist are used as they involve fewer overheads than a Datagrid.
The Repeater repeats a chunk of HTML you write, it has the least functionality of the three. DataList is the next step up from a Repeater; accept you have very little control over the HTML that the control renders. DataList is the first of the three controls that allow you Repeat-Columns horizontally or vertically. Finally, the DataGrid is the motherload. However, instead of working on a row-by-row basis, you’re working on a column-by-column basis. DataGrid caters to sorting and has basic paging for your disposal. Again you have little control, over the HTML. NOTE: DataList and DataGrid both render as HTML tables by default. Out of the 3 controls, I use the Repeater the most due to its flexibility w/ HTML. Creating a Pagination scheme isn't that hard, so I rarely if ever use a DataGrid.
Occasionally I like using a DataList because it allows me to easily list out my records in rows of three for instance.
59 :: I am constantly writing the drawing procedures with System.Drawing.Graphics, but having to use the try and dispose blocks is too time-consuming with Graphics objects. Can I automate this?
Yes, the code

System.Drawing.Graphics canvas = new System.Drawing.Graphics();
try
{
//some code
}
finally
canvas.Dispose();

is functionally equivalent to

using (System.Drawing.Graphics canvas = new System.Drawing.Graphics())
{
//some code
} //canvas.Dispose() gets called automatically
60 :: How do you trigger the Paint event in System.Drawing?
Invalidate the current form, the OS will take care of repainting. The Update method forces the repaint.
61 :: With these events, why wouldn’t Microsoft combine Invalidate and Paint, so that you wouldn’t have to tell it to repaint, and then to force it to repaint?
Painting is the slowest thing the OS does, so usually telling it to repaint, but not forcing it allows for the process to take place in the background.
62 :: How can you assign an RGB color to a System.Drawing.Color object?
Call the static method FromArgb of this class and pass it the RGB values in .NET
63 :: What class does Icon derive from? Isn’t it just a Bitmap with a wrapper name around it?
No, Icon lives in System.Drawing namespace. It’s not a Bitmap by default, and is treated separately by .NET. However, you can use ToBitmap method to get a valid Bitmap object from a valid Icon object.
64 :: Before in my VB app I would just load the icons from DLL. How can I load the icons provided by .NET dynamically?
By using System.Drawing.SystemIcons class, for example System.Drawing.SystemIcons.Warning produces an Icon with a warning sign in it.
65 :: When displaying fonts, what’s the difference between pixels, points and ems?
A pixel is the lowest-resolution dot the computer monitor supports. Its size depends on user’s settings and monitor size. A point is always 1/72 of an inch. An em is the number of pixels that it takes to display the letter M.
  • StumbleUpon
  • Digg
  • Delicious
  • Twitter
  • FaceBook
  • LinkedIn
  • Google
  • Yahoo
  • MySpace
  • Tell Your Friend

66 :: What is the difference between VB 6 and VB.NET?
VB
1,Object-based Language
2,Doesnot support Threading
3,Not powerful Exception handling mechanism
4,Doesnot having support for the console based applications
5,Cannot use more than one version of com objects in vb application called DLL error
6,Doesnot support for the Disconnected data source.


VB.Net
1,Object-oriented Language
2,supports Threading
3,powerful Exception handling mechanism
4,having support for the console based applications
5,More than one version of dll is supported
6,supports the Disconnected data source by using Dataset class
67 :: What are the authentication methods in .NET?
There are 4 types of authentications.
1.WINDOWS AUTHENTICATION
2.FORMS AUTHENTICATION
3.PASSPORT AUTHENTICATION
4.NONE/CUSTOM AUTHENTICATION

The authentication option for the ASP.NET application is specified by using the tag in the Web.config file, as shown below:
other authentication options
1. WINDOWS AUTHENTICATION Schemes
I. Integrated Windows authentication
II. Basic and basic with SSL authentication
III. Digest authentication
IV. Client Certificate authentication


2. FORMS AUTHENTICATION
You, as a Web application developer, are supposed to develop the Web page and authenticate the user by checking the provided user ID and password against some user database

3.PASSPORT AUTHENTICATION
A centralized service provided by Microsoft, offers a single logon point for clients. Unauthenticated users are redirected to the Passport site

4 NONE/CUSTOM AUTHENTICATION:
If we don’t want ASP.NET to perform any authentication, we can set the authentication mode to “none”. The reason behind this decision could be: We don’t want to authenticate our users, and our Web site is open for all to use. We want to provide our own custom authentication
68 :: What is Serialization in .NET?
The serialization is the process of converting the objects into stream of bytes.
they or used for transport the objects(via remoting) and persist objects(via files and databases)
69 :: What’s the use of System.Diagnostics.Process class in .NET?
By using System.Diagnostics.Process class, we can provide access to the files which are presented in the local and remote system.
Example: System.Diagnostics.Process(”c:globalguidelineexample.txt”) — local file
System.Diagnostics.Process(”http://www.globalguideline.comexample.txt”) — remote file
70 :: Difference Abstract class and Interface in .NET?
Abstract class: This class has abstract methods (no body). This class cannot be instantiated. One needs to provide the implementation of the methods by overriding them in the derived class. No Multiple Inheritance.
Interfaces: Interface class contains all abstract methods which are public by default. All of these methods must be implemented in the derived class. One can inherit from from more than one interface thus provides for Multiple Inheritance.
71 :: Explain re-clarification of object based in .NET?
VB6 DOES support polymorphism and interface inheritance. It also supports the “Implements” keyword. What is not supported in vb6 is implementation inheritance.
Also, from above, vb6 DOES “provides access to third-party controls like COM, DCOM ” That is not anything new in .NET.
72 :: How to achieve Polymorphism in VB.Net?
We can achieve polymarphism in .Net i.e Compile time polymarphism and Runtime polymarphism. Compiletime Polymarphism achieved by method overloading. Runtime polymarphism achieved by Early Binding or Late Binding. Provide the function pointer to the object at compile time called as Early Binding.
provide the function pointer to the object at runtime called as Late Binding
class emp having the method display()
class dept having the method display()


create objects as in the main function
// Early binding
dim obj as new emp
dim ob as new dept


obj.display()-to call the display method of emp class
ob.display-to call the display method of the dept class
// Late binding


create object in the main class as
object obj
obj=new emp
obj.display()-to call the display of emp class
obj=new dept
obj.display()-to call the display of dept class
73 :: Difference between Class And Interface in .NET?
Class is logical representation of object. It is collection of data and related sub procedures with definition.
Interface is also a class containing methods which is not having any definitions.
Class does not support multiple inheritance. But interface can support
74 :: What does mean by .NET framework?
The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, and ASP.NET
75 :: What is assembly in .NET?
It is a single deploy able unit that contains all the information about the implementation of classes , structures and interfaces
76 :: What is namespaces in .NET?
It is a logical group of related classes and interfaces and that can be used by any language targeting the .net framework.
77 :: Tell me about Secure Socket Layer? How to make use of the technology?
Secure Sockets Layer (SSL) and Transport Layer Security (TLS), its successor, are cryptographic protocols which provide secure communications on the Internet. There are slight differences between SSL 3.0 and TLS 1.0, but the protocol remains substantially the same. The term “SSL” as used here applies to both protocols unless clarified by context.
78 :: Can any object be stored in a Viewstate in .NET?
An object that either is serializable or has a TypeConverter defined for it can be persisted in ViewState
79 :: Explain ADO.NET features? Benefits? Drawbacks?
1. Data will be retrieved through DataSets
2. Scalability
80 :: ASP.NET interview questions only?
1. How does ASP page work?
2. How ASP.NET page works?
3. What are the contents of cookie?
4. How do you create a permanent cookie?
5. What is ViewState? What does the “EnableViewState” property do? Whay would I want it on or off?
6. Give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
7. Describe the role of global.asax?
8. How can you debug your.NET application?
9. How do you deploy your ASP.NET application?
10. Where do we store our connection string in ASP.NET application?
11. Explain security types in ASP.NET?
12. Where do we store our connection string in ASP.NET application?
13. Explain different Authentication modes in ASP.NET?
14. How.NET has implemented security for web applications?
15. How to do forms authentication in ASP.NET?
16. Explain authentication levels in.NET?
17. Explain authorization levels in.NET?
18. How can you debug an ASP page, without touching the code?
19. How can you handle Exceptions in ASP.NET?
20. How can you handle UnManaged Code Exceptions in ASP.NET?
81 :: How is meant by DLL in .NET?
A DLL (Dynamic Link Library) in .NET is a file that can be loaded and executed by programs dynamically. Basically it’s an external code repository for programs. Since usually several different programs reuse the same DLL instead of having that code in their own file, this dramatically reduces required storage space. A synonym for a DLL would be library in .NET
82 :: How does output caching work in ASP.NET?
Output caching is a powerful technique that increases request/response throughput by caching the content generated from dynamic pages. Output caching is enabled by default, but output from any given response is not cached unless explicit action is taken to make the response cacheable.
To make a response eligible for output caching, it must have a valid expiration/validation policy and public cache visibility. This can be done using either the low-level OutputCache API or the high-level @ OutputCache directive. When output caching is enabled, an output cache entry is created on the first GET request to the page. Subsequent GET or HEAD requests are served from the output cache entry until the cached request expires.
The output cache also supports variations of cached GET or POST name/value pairs.
The output cache respects the expiration and validation policies for pages. If a page is in the output cache and has been marked with an expiration policy that indicates that the page expires 60 minutes from the time it is cached, the page is removed from the output cache after 60 minutes. If another request is received after that time, the page code is executed and the page can be cached again. This type of expiration policy is called absolute expiration - a page is valid until a certain time.
83 :: Explain how Viewstate is being formed and how it’s stored on client in .NET?
The type of ViewState is System.Web.UI.StateBag, which is a dictionary that stores name/value pairs. ViewState is persisted to a string variable by the ASP.NET page framework and sent to the client and back as a hidden variable. Upon postback, the page framework parses the input string from the hidden variable and populates the ViewState property of each control. If a control uses ViewState for property data instead of a private field, that property automatically will be persisted across round trips to the client. (If a property is not persisted in ViewState, it is good practice to return its default value on postback.)
84 :: Explain assemblies in .NET?
Assemblies are similar to dll files. Both has the reusable pieces of code in the form of classes/ functions. Dll needs to be registered but assemblies have its own metadata.
85 :: Explain DataSet.AcceptChanges and DataAdapter.Update methods in .NET?
DataAdapter.Update method Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the DataSet.
DataSet.AcceptChanges method Commits all the changes made to this row since the last time AcceptChanges was called.
86 :: Explain Difference between Panel and GroupBox classes using .NET?
Panel and Group box both can used as container for other controls like radio buttons and check box.
the difference in panel and group box are Panel
1) In case of panel captions cannot be displayed
2) Can have scroll bars.


Group box
1) Captions can be displayed.
2) Cannot have a scroll bar
87 :: How many types of exception handlers are there in .NET?
From
MSDN>gt; “How the Runtime Manages Exceptions”
http://msdn.microsoft.com/library/default.asp? url=/library/en-us/cpguide/html/cpconexceptionsoverview.asp
The exception information table represents four types of exception handlers for protected blocks:
A finally handler that executes whenever the block exits, whether that occurs by normal control flow or by an unhandled exception.
A fault handler that must execute if an exception occurs, but does not execute on completion of normal control flow.
A type-filtered handler that handles any exception of a specified class or any of its derived classes.
A user-filtered handler that runs user-specified code to determine whether the exception should be handled by the associated handler or should be passed to the next protected block.
88 :: What are the advantages and drawbacks of using ADO.NET?
Pros
====
ADO.NET is rich with plenty of features that are bound to impress even the most skeptical of programmers. If this weren’t the case, Microsoft wouldn’t even be able to get anyone to use the Beta. What we’ve done here is come up with a short list of some of the more outstanding benefits to using the ADO.NET architecture and the System.Data namespace.

* Performance – there is no doubt that ADO.NET is extremely fast. The actual figures vary depending on who performed the test and which benchmark was being used, but ADO.NET performs much, much faster at the same tasks than its predecessor, ADO. Some of the reasons why ADO.NET is faster than ADO are discussed in the ADO versus ADO.NET section later in this chapter.

* Optimized SQL Provider – in addition to performing well under general circumstances, ADO.NET includes a SQL Server Data Provider that is highly optimized for interaction with SQL Server. It uses SQL Server’s own TDS (Tabular Data Stream) format for exchanging information. Without question, your SQL Server 7 and above data access operations will run blazingly fast utilizing this optimized Data Provider.
89 :: What are different methods of session maintenance in ASP.NET?
3 types:
In-process storage.
Session State Service.
Microsoft SQL Server.


In-Process Storage
The default location for session state storage is in the ASP.NET process itself.

Session State Service
As an alternative to using in-process storage for session state, ASP.NET provides the ASP.NET State Service. The State Service gives you an out-of-process alternative for storing session state that is not tied quite so closely to ASP.NET’s own process.

To use the State Service, you need to edit the sessionState element in your ASP.NET application’s web.config file:
You’ll also need to start the ASP.NET State Service on the computer that you specified in the stateConnectionString attribute. The .NET Framework installs this service, but by default it’s set to manual start up. If you’re going to depend on it for storing session state, you’ll want to change that to automatic start up by using the Services MMC plug-in in the Administrative Tools group.

If you make these changes, and then repeat the previous set of steps, you’ll see slightly different behavior: session state persists even if you recycle the ASP.NET process.
90 :: List of ASP.NET interview questions only?
1. What is a static class?
2. What is static member?
3. What is static function?
4. What is static constructor?
5. How can we inherit a static variable?
6. How can we inherit a static member?
7. Can we use a static function with a non-static variable?
8. How can we access static variable?
9. Why main function is static?
10. How will you load dynamic assembly? How will create assesblies at run time?
11. What is Reflection?
12. If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) in my application?
13. How do you create threading in.NET? What is the namespace for that?
14. What do you mean by Serialize and MarshalByRef?
15. What is the difference between Array and LinkedList?
16. What is Asynchronous call and how it can be implemented using delegates?
17. How to create events for a control? What is custom events? How to create it?
18. If you want to write your own dot net language, what steps you will you take care?
19. Describe the diffeerence between inline and code behind - which is best in a loosely coupled solution?
20. How dot net compiled code will become platform independent?
91 :: What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why?
In a interface class, all methods are abstract without implementation where as in an abstract class some methods we can define concrete. In interface, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers. Interface and abstract class are basically a set of rules which u have to follow in case u r using them(inheriting them).
92 :: What is CLR in .NET?
CLR(Common Language Runtime) is the main resource of .Net Framework. it is collection of services like garbage collector, exception handler, jit compilers etc. with the CLR cross language integration is possible.
93 :: What exactly is being serialized when you perform serialization in .NET?
The object’s state (values)
94 :: What do you know about ADO.NET’s objects and methods?
ADO.NET provides consistent access to data sources such as Microsoft SQL Server, as well as data sources exposed through OLE DB and XML.
Data-sharing consumer applications can use ADO.NET to connect to these different data sources and retrieve, manipulate, and update data.
ADO.NET provides first-class support for the disconnected, n-tier programming environment for which many new applications are written.
95 :: .NET framework overview?
1. Has own class libraries. System is the main namespace and all other namespaces are subsets of this.
2. It has CLR(Common language runtime, Common type system, common language specification)
3. All the types are part of CTS and Object is the base class for all the types.
4. If a language said to be .net complaint, it should be compatible with CTS and CLS.
5. All the code compiled into an intermediate language by the .Net language compiler, which is nothing but an assembly.
6. During runtime, JIT of CLR picks the IL code and converts into PE machine code and from there it processes the request.
7. CTS, CLS, CLR
8. Garbage Collection
9. Dispose, finalize, suppress finalize, Idispose interface
10. Assemblies, Namespace: Assembly is a collection of class/namespaces. An assembly contains Manifest, Metadata, Resource files, IL code
11. Com interoperability, adding references, web references
12. Database connectivity and providers
96 :: Name some of the languages .NET support?
Some of the languages that are supported by .NET
1. Visual Basic.NET
2. Visual C#
3. Visual C++
97 :: Main differences between ASP and ASP.NET?
1. ASP: Code is Interpreted
ASP.NET: Code is Compiled

2. ASP: Business Logic and Presentation Logic are in a single file
ASP.NET: Business Logic and Presentation Logic are in separate files (.cs or .vb) and (.aspx) respectively.
3. ASP: No Web Server Controls
ASP.NET: Web Server Controls supported by strong .NET Framework
4. ASP: No RAD in Classic ASP
ASP.NET: Supports RAD
98 :: What is the base class of .NET?
Base class provides a base set of methods that all derived classes can use
99 :: What is the base class of Button control in .NET?
Listing from visual studio .net > Button Class System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ButtonBase
System.Windows.Forms.Button
100 :: ASP.NET interview questions list only?
1. Describe the difference between a Thread and a Process?
2. What is a Windows Service and how does its lifecycle differ from a .standard. EXE?
3. What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
4. What is the difference between an EXE and a DLL?
5. What is strong-typing versus weak-typing? Which is preferred? Why?
6. What.s wrong with a line like this? DateTime.Parse(myString
7. What are PDBs? Where must they be located for debugging to work?
8. What is cyclomatic complexity and why is it important?
9. Write a standard lock() plus double check to create a critical section around a variable access.
10. What is FullTrust? Do GAC’ed assemblies have FullTrust?
11. What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
12. What does this do? gacutil /l | find /i about
13. What does this do? sn -t foo.dll
14. What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
15. Contrast OOP and SOA. What are tenets of each
16. How does the XmlSerializer work? What ACL permissions does a process using it require?
17. Why is catch(Exception) almost always a bad idea?
18. What is the difference between Debug.Write and Trace.Write? When should each be used?
101 :: What is serialization, how it works in .NET?
Serialization is when you persist the state of an object to a storage medium so an exact copy can be re-created at a later stage.
Serialization is used to save session state in ASP.NET.
Serialization is to copy objects to the Clipboard in Windows Forms
Serialization is used by remoting to pass objects by value from one application domain to another
102 :: What is Response object? How is it related to ASP’s Response object?
Response object allows the server to communicate with the client(browser). It is useful for displaying information to the user (or) redirecting the client.
Eg: Response.Write(”Hello World”)
103 :: What is .NET?
.NET is essentially a framework for software development.It is similar in nature to any other software development framework (J2EE etc) in that it provides a set of runtime containers/capabilities, and a rich set of pre-built functionality in the form of class libraries and APIs
The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, and ASP.NET.
104 :: What is IIS? Have you used it?
IIS - Internet Information Server
IIS is used to access the ASP.Net web applications
Yes, I used in ASP.NET web applications.
105 :: What is Delegate and what is it used for?
Delegate is kinda like a pointer to a function in C++ or like an event handler in Java
You can use it to “multicast” which means running multiple functions in different instances of object already created.
This is useful when you want your objects to “register” to an event raised by another object.
The way it works is the object you are registered to listen to receives the delegate of the function it is supposed to run in your object, the delegate is then run from it. (if you switch the word delegate for pointer, this would be much simpler)
106 :: What is connection pooling and how do you make your application use it?
Opening database connection is a time consuming operation. Connection pooling increases the performance of the applications by reusing the active database connections instead of create new connection for every request.
Connection pooling Behavior is controlled by the connection string parameters.
Following the the 4 parameters that control most of the connection pooling behavior.
1. Connect Timeout
2. Max Pool Size
3. Min Pool Size
4. Pooling
Please go through the following link as well
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q169470
107 :: Which dll is required to translate XML to SQL in Internet Information Server (IIS)?
Microsoft.data.sqlxml.dll used to translate XML to SQL using Internet Information Server IIS
108 :: what is the difference between user control an custom control? advantages/disadvantages?
Web user controls Vs Web custom controls Easier to create Vs Harder to create
Limited support for consumers who use a visual design tool Vs Full visual design tool support for consumers
A separate copy of the control is required in each application Vs Only a single copy of the control is required, in the global assembly cache
Cannot be added to the Toolbox in Visual Studio Vs Can be added to the Toolbox in Visual Studio
Good for static layout Vs Good for dynamic layout


http://msdn.microsoft.com/library/default.asp?url=/library/ en-us/vbcon/html/vbconwebusercontrolsvscustomwebcontrols.asp
109 :: When we go for html server controls and when we go for web server controls?
Server controls are a part of ASP.net. When a server control is used there will be an extra overhead on the server to create the control at run time and accordingly set the values. HTML controls are static controls and are easy to use. They are supported is ASP.net.
As a rule, if there is a corresponding HTML control available instead of the server control, you should always go for the HTML control as it enhances the server performance and ensures faster response. Server controls should be used when it is found that the available HTML controls are not sufficient to achieve the task.
110 :: Why The JavaScript Validation Not Run on the Asp.Net Button But Run Successfully On The HTML Button?
The Asp.Net Button Is post backed on the server & not yet Submit & when It goes to the server its states is lost So if we r using JavaScript in our application so we always use the Input Button in the asp Button
111 :: Which DLL translate XML to SQL in Internet Information Server (IIS)?
Sqlisapi.dll
DLL used to translate XML to SQL in Internet Information Server (IIS)
112 :: What is the Difference Between Response.write & response.output.Write?
In ASP.NET the Response object is of type HttpResponse and when you say Response.Write you’re really saying (basically) HttpContext.Current.Response.Write and calling one of the many overloaded Write methods of HttpResponse. Response.Write then calls .Write() on it’s internal TextWriter object:
public void Write(object obj){ this._writer.Write(obj);}
HttpResponse also has a Property called Output that is of type, yes, TextWriter, so:
public TextWriter get_Output(){ return this._writer; }
Which means you can to the Response whatever a TextWriter will let you. Now, TextWriters support a Write() method ala String.Format, so you can do this:
Response.Output.Write(”Scott is {0} at {1:d}”, “cool”,DateTime.Now);
But internally, of course, this this is happening:
public virtual void Write(string format, params object[] arg)
{
this.Write(string.Format(format, arg));
}
113 :: What is the use of ErrorProvider Control in .NET?
The ErrorProvider control is used to indicate invalid data on a data entry form. Using this control, you can attach error messages that display next to the control when the data is invalid, as seen in the following image. A red circle with an exclamation point blinks, and when the user mouses over the icon, the error message is displayed as a tooltip.
114 :: What is Viewstate in .NET?
A server control’s view state is the accumulation of all its property values. In order to preserve these values across HTTP requests, ASP.NET server controls use this property, which is an instance of the StateBag class, to store the property values.
115 :: What should one do to make class serializable?
To make a class serializable is to mark it with the Serializable attribute as follows.
[Serializable]
public class MyObject {
public int n1 = 0;
public int n2 = 0;
public String str = null;
}


116 :: What should you do to store an object in a Viewstate?
Do serialization of convert the object to string 

How to Access Parent Page (.aspx) control (IDs) from its child User Control (.ascx)
The easiest way would be.
In the parent page, add this JavaScript (replace "Panel1" with the correct ID).
<script type="text/javascript">
<!--
function getPanelId()
{
 var panelId = '<%= Panel1.ClientID %>';
 return panelId;
}
// -->
</script>
Then in the User Control:
<script type="text/javascript">
<!--
function hideShowPanel1(whatToDo)
{
 var panelId = getPanelId();
 var panelRef = document.getElementById(panelId);
 panelRef.style.display = (whatToDo == 'Show') ? 'block' : 'none';
}

Or\\

TextBox txt= this.Parent.FindControl("txtVisitorName") as TextBox;
        txt.Text = "Krishna"; /
 
 
         Access user control from parent page
Not sure what I was thinking but I even posted mixed things. Here is what I got to work. I was trying to use a different user control's property that didn't exist. Was getting so frustrated on why it wasn't showing up but just a stupid deal.

topbanner.ascx
Code:
Partial Class topbanner
    Inherits System.Web.UI.UserControl

    Public WriteOnly Property H1LabelText() As String
        Set(ByVal value As String)
            Me.ltlH1.Text = value
        End Set
    End Property
End Class
page.aspx
HTML Code:
<uc3:topbanner ID="Topbanner1" runat="server" />
page.aspx.vb
Code:

Topbanner1.H1LabelText() = "text that I want to go in the usercontrol literal control
Using properties is definitely the cleanest way to do it. 
 

7 comments:

  1. Great post! This is for a good information, It's very helpful for this blog. And great valu for these information.This is good work you and you are doing well.
    Dot Net Training in Chennai

    ReplyDelete
  2. I am very glad that you always put in so much effort. With my remote developers working with me earlier, the updated tech niches were impossible to address. So, I always refused to have those projects due to the lack of an operational team. One day, my ex-colleague, who is also running a game-developing business, suggested Eiliana.com, and I rushed to see the magic. I hired a few experts, and it transformed my business.

    ReplyDelete