Sie sind auf Seite 1von 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

FAQ

1.

What are the different types of objects available in ADO.Net.

2.

How ADO.Net differs from ADO.

3.

What are delegates in C#. How they are used?

4.

How do you make ASP applications secure?

1 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

5.

Suppose you have an application for credit card validation. What steps will you

take to restrict unauthiorised users from using the application?

6. Write the code snippet for fetching data from a table and populating in a list box control of an asp page.

7.

How will you design a program for the game of chess?

8. You have a table containing information about empid, empname, emailid, emailname and emailtext. How will you normalize the table?

9. You have a table containing empid, empname, managerid. Write an SQL to display the emp name along with his manager's name.

2 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

10.

How state is maintained in ASP.Net?

MS interview.

1.

In C# he asked what are the Value types and Reference types

2. In depth explanation of stack and Heap with respect to .NET and other languages like C++

3 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3. What r the advantages comparatively, Value types are derived from which namespace and reference types as well.

4.

Why u have chosen C#, what r the reasons behind in choosing this in my last project.

5.

How this is more advantageous then other languages as well when ur targeting

6.

What r the data types in C# and explain in detail

7.

How many types of access modifiers r there in C# and explain internal

8.

Diff b/w ASP and ASP.NET (Only this question came from list)

4 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

9.

Explain any 3 ASP.NET features u know in ASP.NET which u have used in project

1.

What are the main differences between asp and asp.net?

2.

What is user control?

3.

How do you a replicate a set of controls across a number of ASP Pages.

4. do?

If you have to replicate a set of controls(UI) across a number of web pages, what will you

5 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

5.

What are different types of controls available in ASP.Net

6. How can you pass values between two pages in asp?how will you do the same in ASP.net?

7.

What are the validation controls available in ASP.net?

8.

How will you upload a file to IIS in Asp and how will you do the same in ASP.net?

9.

What is Attribute Programming? What are attributes? Where are they used?

6 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

10.

What are the Database related classes available in .Net?

11.

What is the diff. bet DataReader & DataSet?

12.

How do you connect to database in ASp.net and in ASP?

13.

What is the difference between recordset and dataset?

14.

What are the new object introduced in ado.net that are nor there in ADO?

15.

What is a WebService? Give an example.

7 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

16.

How is a WebService qualified or defined

17.

What is format of WSDL?

18.

What is xml?diffrences between xml and html?

What xsl?where will you use this technology..give an example.

19.

What is Reflection?

8 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

20.

How will you return results as xml from SQL server?

21.

How do you design a database? - basics of DB Design, SPs, triggers?

22.

What are the normal forms and which is the best?

23.

If a database is in 3NF, how many minimum number of tables should it have?

24.

What is referential integrity & how is it achieved?

9 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

25.

What is a Primary Key? Can it have >1 field?

26.

What are constraints?

27.

Why should you create index? Types on indexes?

28.

What is a trigger and stored procedure?

29.

What are inserted and deleted tables?

30.

What is a view?where will you use views?

10 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

31.

What is fillfactor?

32.

Pillars of OO Progg

33.

What is a Constructor?

34.

What is a Destructor?

35.

What is late binding and early binding?

11 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

36.

How objects will be managed in .net?

37.

How do you handle errors in VB.net or c#?

38.

How do you handle errors in VB?

39.

Question on on error goto 0?

40.

How are structures implemented in VB?

41.

What is the necessity for Resume Next?

12 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

COM

1.

What is COMInterop?

2.

Question on Tlbimp,Tlbexp and other tools?

3.

What is the difference between COM and DCOM?

13 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

4.

Question on iunknown interface and methods i.r addref,release etc..

5.

What is the default interface for any COM component?

6.

What are the methods available in IUnknown?

7.

What is IDispatch?

8.

What is the diffrence between activex exe and activex dll?

9.

How will you choose between activex exe and activex dll?

14 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

10.

OLE

11.

ActiveX.exe example.

ASP

1.

Ways to Instantiate a Object

15 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

2.

Modeling languages.

3.

ASP built-in objects

4.

HTML and DHTML

16 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

SQL

1.

What is clustered index and a non-clustered index?

2.

What is an indexed view and why do you need it?

17 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3.

What is an execution plan?

4.

How will you return results as xml from SQL server?

5.

How do you design a database? - basics of DB Design, SPs, triggers?

6.

What are the normal forms and which is the best?

7.

If a database is in 3NF, how many minimum number of tables should it have?

8.

What is referential integrity & how is it achieved?

18 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

9.

What is a Primary Key? Can it have >1 field?

10.

What are constraints?

11.

Why should you create index? Types on indexes?

12.

What is a trigger and stored procedure?

13.

Types of triggers?

14.

What are inserted and deleted tables?

19 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

15.

What is a view? where will you use views?

16.

What is fillfactor?

17. You have a table containing information about empid, empname, emailid, emailname and emailtext. How will you normalize the table.

18. You have a table containing empid, empname, managerid. Write an SQL to display the emp name along with his manager's name.

19.

Desing a db for a school database?

20.

What is SQL Trace?

20 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

21.

What is a join and what are different types of joins?

22.

Difference between union and join

23.

Difference between Group by and Having clause

24.

Implementation of Stored procedures

25.

SQL performance tuning

21 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

XML

1.

What is xml? Diffrences between xml and html?

2.

What xsl? Where will you use this technology..give an example.

3.

What are the XML parsers you are aware of?

4.

What is the difference between DOM and SAX?

22 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

23 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

OO Programming

1.

Pillars of OO Progg

2.

What is a Constructor?

3.

What is a Destructor?

4.

What is inheritance and why is it needed?

5.

What is Polymorphism?

6.

Say you have identified a set of objects how will identify a base class?

7.

What is an abstract class?

8.

What is late binding and early binding?

24 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

9.

Modeling languages.

ASP

1.

What are the built-in objects in ASP?

2.

What are the data type in ASP?

3.

Are vbscript, vb strongly typed languages?

4.

How can you pass values between two pages in asp?

5.

How do you make ASP applications secure.

6. Suppose you have an application for credit card validation. What steps will you take to restrict unauthorized users from using the application.

7. Write the code snippet for fetching data from a table and populating in a list box control of an asp page.

25 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

8.

HTML and DHTML

9. Say you are designing a product page the products list is constant? How will you design this page? (will you go to db each time to retrieve the list of products for each user?)

10.

Similarly how will you store user orders ?

11.

How will you manage user session in a web-farm scenario?

12.

Performance tuning ASP applications

ASP Performance Improvement:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnserv/html/server03272000.asp

26 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

VB & COM

1.

What is late binding and early binding?

2.

What are the various ways in which you instantiate an object in VB?

3. What are the threading models that you can choose in VB? Which one will you recommend and why?

4.

Can you store a VB object in ASP session variable? Is it recommended? Why not?

5.

Compatibility settings in vb?

6.

How do you handle errors in VB?

7.

Question on on error goto 0?

8.

How are structures implemented in VB?

27 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

9.

What is the necessity for Resume Next?

10.

What is the diffrence between activex exe and activex dll?

11.

How will you choose between activex exe and activex dll?

12.

ActiveX.exe example.

13.

What is COMInterop?

14.

Question on Tlbimp,Tlbexp and other tools?

15.

What is the difference between COM and DCOM?

16.

Question on iunknown interface and methods i.r addref,release etc..

17.

What is the default interface for any COM component?

18.

What are the methods available in IUnknown?

19.

What is IDispatch?

28 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

.NET

1.

What is the difference between object type and value type?

2.

What are the different types of objects available in ADO.Net.

3.

How ADO.Net differs from ADO.

29 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

4.

What are delegates in C#. How they are used?

5.

What is a WebService? Give an example.

6.

How is a WebService qualified or defined

7.

What is format of WSDL?

8.

Question on Reflection?

9.

What is Attribute Programming? What are attributes? Where are they used?

10.

How state is maintained in ASP.Net.

11.

How objects will be managed in .net?

12. How can you pass values between two pages in asp?how will you do the same in ASP.net?

13.

What are the main differences between asp and asp.net?

14.

What is user control?

15.

How do you a replicate a set of controls across a number of ASP Pages.

30 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

16. do?

If you have to replicate a set of controls(UI) across a number of web pages, what will you

17.

What are different types of controls available in ASP.Net

18.

What are the validation controls available in ASP.net?

19.

How will you upload a file to IIS in Asp and how will you do the same in ASP.net?

20.

What are the Database related classes available in .Net?

21.

What is the diff. bet DataReader & DataSet?

22.

How do you connect to database in ASp.net and in ASP?

23.

What is the difference between recordset and dataset?

24.

What are the new object introduced in ado.net that are nor there in ADO?

25.

How do you handle errors in VB.net or c#?

26. What is the difference between new and override keywords in c# in the context of inheritance?

31 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

27.

Does .NET support multiple inheritance?

28.

Security in ASP.NET

Specific to Dev Lead

1.

How do you go about designing an app?

2.

How would you allocate work to your team?

3. If you have only 2 weeks for release and you know that the project cannot be completed in 2 weeks what would you do?(answer is to prioritize tasks)

4.

You have a weak member in the team what will you do?

5.

You have a problematic member in the team what will you do?

6.

Traceability matrix?

32 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

7.

SDLC process and contents of doc?

1.

What is .NET & Why?

2.

What is Namespace?

3.

What is class?

4.

What is Component?

5.

What is Control?

6.

Difference between Control and Component?

7.

What is Data Type? How it differ from Class Type?

8.

What asp_wp.exe does?

9.

Where Temporary DLLS reside in the system?

10.

How do you develop a secured web site?

33 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

11.

What is role of https in developing secured web site?

12.

What is IIS and what u did in IIS so far?

13.

OOPS Inheritance, Abstraction, Polymorphism and Encapsulation

14.

What is Abstract class?

15.

What is Interface?

16.

Difference between Interface and Abstract class?

17.

What is Encapsulation? Can u implement Encapsulation with out Abstraction?

18.

Class A

Int I =10;

Void new()

34 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

I = 20 ;

When u create a object for A, which value assigned to I first? 10 or 20

19. Class B inherited from Class A. Class B is used in Class C. I created an object for class C. Tell me the order of Constructors invoked?

20.

Can I set Child object to the Parents Object? Why so?

21.

What are disadvantages of multiple inheritance?

22.

Can u implement multiple inheritance in .NET?

23.

What are delegates?

24.

What are call back procedures?

35 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

25.

How do u write an event in class? Show me syntax in VB.NET?

26.

Tell me any page u written in VB.NET or ASP.NET?

27.

I can write the same page in VB/ASP also. Whats the difference?

28.

How do you write properties VB? And in VB.NET?

29.

Why Let is not provided in VB.NET?

30.

What is COM?

31.

What Iunknown interface does?

32.

What Idispatch does?

33.

What Istandard does?

34.

While building VB dll, we select Binary Compatibility . What for it is?

35.

How can u maintain versioning in building dlls?

36 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

36.

ClsID, GUID and InterfaceID. Explain each.

37.

Why Activex Control extension is .OCX? why not .DLL?

38.

What is the difference between ActiveXEXE and ActiveXDll?

39.

What is Proxy component?

40.

What is Two Tier and what is three tier architecture?

41.

Can you tell me the case where four tier (Multi tier) architecture is present?

42.

Do u have an idea about STACK and HEAP?

43.

Is COM is language dependent?

44.

What is the use of MTS?

45.

Early binding and Late binding?

46.

Dim RS as Recordset.

Is this is Early or Late?

47.

Dim RS as new ADODB.Recordset. Is this is Early or Late?

37 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

48.

Dim Rs as Recordset

Set RS = new ADODB.Recordset

Is this is Early or Late?

49.

Dim RS as Recordset

set RS = create Object(ADODB.RECORDSET) Is this is Early or Late?

50.

What are the advantages and Disadvantages of each binding?

51.

What are ASP.NET controls available?

52.

Is validation done on Client side for validation controls?

53.

How can u write a java script for a server control at client side?

54.

What is the difference between server side HTML controls and ASP Server Controls.

55.

Tell me the ASPX page request cycle. How HTML output comes to the client?

56.

How do you trim a string value at client?

38 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

57.

Write a trim function in java script with exact syntax?

58.

How do you debug a stored procedure in ASP.NET?

59.

What you know about T-SQL debugger?

60.

What is Application Domain?

61.

What is Reflection?

62.

What is Remoting?

63.

What is WEB SERVICE?

64.

How WEB SERVICE is secure over network?

65.

How good u r in XML? What is NODE, ELEMENT and ATTRIBUTE?

66.

Tell me any one parser to read XML? Did u use it before?

67.

Why do u prefer XML serialization in .NET?

68.

Tell me ADO.NET architecture?

39 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

69.

How can I update the Datasets date to the database?

70.

What is Dataview ? How it is useful?

71. Why SQLClient and OLEDB classes are given in Data namespace? Which one is optimistic?

72.

What are Instance Types available in VB 6.0?

73.

How GC collects Objects?

74.

Does GC collects Value Types? If not, what happen to them after scope is over?

75. When GC moves memory addresses while collecting unused objects, what happen to the addresses of unmanaged objects and their addresses?

76.

What is meant by Windows authentication?

77. My database server and Application server are different. When I connect to database server from Application, I use connection string. So, it passes through network I think definining like server=xx;databse=pubs;uid=pqr;pwd=abc is insecure. Is there any methodology to make safe while pass through network.

78.

What is Distributed database?

40 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

79.

What is Linked Server?

80.

Is there any relation to the Linked server with the Distributed database?

81.

What is database tuning?

82.

What is Lock?

83.

What is Trace?

84.

Tell me three normal forms.

85.

What is Composite key?

86.

Explain joins

87.

What is Equi join?

88.

What is Self join?

89.

What is an extended stored procedure?

90.

What is a trigger?

41 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

91.

How many types of triggers we have in SQL server 2000?

92.

What is INSTEAD of trigger type?

93.

What is cursor?

94.

Tell me few keywords while declaring a cursor?

95.

When we go for dynamic cursor?

96. In a stored proc, string variable is consisting SQL statement. How do you run it? Is there any other alternative to run it?

97.

Name few functions used in SQL server?

98.

What is difference between PatIndex and CharIndex?

99. My table doesnt have key. So many duplicate rows exists in the table. I want to eliminate all the duplicate rows and keep only one unique row. Can u accomplish this task in a single query? If not, how do you do it?

100.

What are default databases present with SQL server?

101.

What are the must present databases to work with SQL server?

42 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

102.

What is UNICODE?

103.

What is difference between varchar and Nvarchar?

104.

What is difference between WHERE and HAVING?

105.

Why do we use GROUP BY

106.

How clustered index works in table?

107.

What is COMPUTE , CUBE , ROLLUP?

108.

How do you maintain transaction in Stored Procedure?

109.

If error comes in the middle of stored proc, does remaining part execute?

110.

How do you find whether error occurred or not?

111. My SP has three DML statements in an order. Insert, Delete and Update. I am not maintaining transaction. Some how I got error while running a Delete statement. Does Update statement execute? Does earlier(Insert) statement committed?

112.

How do you write code for the above case using transactions?

43 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

113.

What is execution plan?

114. What do you observe in Execution Plan to know the performance of the query/statement?

115.

What are UNION and INTERSECT?

116.

What is alternate Key?

117.

Tell me the case where we ignore normalization?

118.

What is BCNF and tell me few cords rules.

119.

What are data types available in SQL Server?

120.

How do u normalize given non-normalized table? Tell me steps u follow.

44 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Question on ASP.NET

1. What are the main differences between asp and asp.net?

Better Language Support

ASP .NET uses the new ADO .NET.

ASP .NET supports full Visual Basic, not VBScript.

ASP .NET supports C# (C sharp) and C++.

ASP .NET supports JScript as before

45 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Programmable Controls

ASP .NET contains a large set of HTML controls. Almost all HTML elements on a page can be defined as ASP .NET control objects that can be controlled by scripts.

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.

Event Driven Programming

46 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

All ASP .NET objects on a Web page can expose events that can be processed by ASP .NET code.

Load, Click and Change events handled by code makes coding much simpler and much better organized.

XML Based Components

ASP .NET components are heavily based on XML. Like the new AD Rotator, that uses XML to store advertisement information and configuration.

47 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

User Authentication, with Accounts and Roles

ASP .NET supports forms-based user authentication, including cookie management and automatic redirecting of unauthorized logins.

(You can still do your custom login page and custom user checking).

ASP .NET allows for user accounts and roles, to give each user (with a given role) access to different server code and executables.

Higher Scalability

48 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Much has been done with ASP .NET to provide greater scalability.

Server to server communication has been greatly enhanced, making it possible to scale an application over several servers. One example of this is the ability to run XML parsers, XSL transformations and even resource hungry session objects on other servers.

Increased Performance - Compiled Code

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.

49 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Easier Configuration and Deployment

Configuration of ASP .NET is done with plain text files.

Configuration files can be uploaded or changed while the application is running. No need to restart the server. No more metabase or registry puzzle.

Xcopy deployment. No more server restart to deploy or replace compiled code. ASP .NET simply redirects all new requests to the new code.

50 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

2. How will you upload a file to IIS in Asp and how will you do the same in ASP.net?

In asp we had to read binary data posted by the form and parse the headers etc.

In asp.net we can use the same html input file (html control but run at server) and can save the file by simply calling controlname.postedFile.saveAs(filename)

51 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3. What are different types of controls available in ASP.Net

HTML server controls HTML elements exposed to the server so you can program them. HTML server controls expose an object model that maps very closely to the HTML elements that they render.

Web server controls Controls with more built-in features than HTML server controls. Web server controls include not only form-type controls such as buttons and text boxes, but also special-purpose controls such as a calendar. Web server controls are more abstract than HTML server controls in that their object model does not necessarily reflect HTML syntax.

Validation controls Controls that incorporate logic to allow you to test a user's input. You attach a validation control to an input control to test what the user enters for that input control. Validation controls are provided to allow you to check for a required field, to test against a

52 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

specific value or pattern of characters, to verify that a value lies within a range, and so on.

User controls Controls that you create as Web Forms pages. You can embed Web Forms user controls in other Web Forms pages, which is an easy way to create menus, toolbars, and other reusable elements.

4. What are the validation controls available in ASP.net?

RequiredFieldValidator

53 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Ensures that the user does not skip a required field when entering data on a Web Forms page

CompareValidator

Compares a user's entry against a constant value, against the property value of another control, or against a database value

RangeValidator

Ensures that a user's entry is between specified upper and lower bounds

RegularExpressionValidator

54 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Ensures check that a user's entry matches a pattern defined by a regular expression.

CustomValidator

Ensures that a user's entry matches validation logic you create yourself.

5. If you have to replicate a set of controls(UI) across a number of web pages, what will you do?

I think using user control (Need to discuss)

55 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

6. What is the importance of IMPORT directive?

This directive is used explicitly to import namespace onto the page. This will allow all the classes and interfaces of the namespace to be accessible within the code.

We can use the classes and interface in the code without importing namespaces also but we need to prefix complete namespace to the class that we are going to use.

For example

56 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

With import directive

<%@ Import Namespace=system.data.sqlclient%>

<%

dim cn as new sqlConnection(connection string comes here)

%>

Without import directive

<%

dim cn as new system.data.sqlclient.sqlConnection(connection string comes here)

%>

57 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

7. What is Global Assembly Cache?

Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. 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.

There are several ways to deploy an assembly into the global assembly cache:

Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.

Use a developer tool called the Global Assembly Cache tool (Gacutil.exe) provided by the .NET Framework SDK.

Use Windows Explorer to drag and drop assemblies into the cache.

58 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

8. How do we handle client side variables in ASP.NET?

Needs to discuss

9. How will you pass values between two pages in ASP.net?

Using querystrings

59 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

In the source file

Attach the querystring values to the URL and use response.redirect

Response.redirect(url?name=abc)

In the target page, receive the value by

Dim sName as string = request.QueryString("name")

Using Session Variables

60 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

In the source file declare

Session(name) = abc

In the target page, receive the value by

Dim sName as string = Session(name)

Using Server.Transfer

In the source file

61 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

We create read only property (that returns the value which u want to access across pages) in the source file

Public ReadOnly Property FirstName() As String

Get

' first is the name of a TextBox control.

Return first.text

End Get

End Property

We pass the control to the second page as

Server.Transfer("secondpage.aspx")

62 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

In the target file

On the Web Forms page that receives the information, add an @ Reference directive at the top of the page, with the Page attribute set to the source Web Forms page (the Web Forms page that contains the information you want to pass).

<%@ Reference Page="firstpage.aspx" %>

Declare a variable in server-side script to store an instance of the class defined in the Web Forms page sending the information.

[Visual Basic]

<script runat="server">

63 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Dim fp As FirstPageClass

</script>

Assigns the IHttpHandler implemented object for the current HTTP request to the variable declared in the previous step when the Web Forms page does not post back to itself.

The IHttpHandler implemented object contains an instance of the handler that first received the HTTP request. Because the IHttpHandler implemented object is not the same type of object as the variable declared in the previous step, it must be converted to the class encapsulating the information sent from the first Web Forms page before it can be assigned to the variable. Retrieve the handler object by using the Handler property of the HttpContext object.

[Visual Basic]

64 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

<script runat="server">

Sub Page_Load()

If Not IsPostBack Then

fp = CType(Context.Handler, FirstPageClass)

End If

End Sub

</script>

The variable declared in the second step now contains an instance of the class encapsulating the information from the previous Web Forms page.

<%=fp.FirstName%>

65 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Question on ADO.NET

1. What are the different types of objects available in ADO.Net?

Two key elements are .net data provider (set of components) and dataset.

Objects in ADO.Net

66 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Connection: For connection to and managing transactions against a database.

Command: For issuing SQL commands against a database.

DataReader : For reading a forward-only stream of data records from a data source.

DataSet : For storing, remoting and programming against flat data, XML data and relational data.

DataAdapter: For pushing data into a DataSet, and reconciling data against a database.

Note: There are two sets of objects for Connection/Command/DataReader/DataAdapter

Namespace : System.Data.SqlClient (Specific to SQL Server)

sqlConnection, sqlCommand, sqlDataReader and sqlDataAdapter

67 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Namespace : System.Data.Oledb (For other data sources)

oledbConnection, oledbCommand, oledbDataReader and oledbDataAdapter

2. How ADO.Net differs from ADO

ADO

ADO.NET

In-memory Representations of Data

68 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

In-memory representation of data is the recordset dataset

In-memory representation of data is the

Number of Tables

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.

A dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database. A dataset usually also contains relationships. Because the dataset can hold multiple, separate tables and maintain information about relationships between them, it can hold much richer data structures than a recordset, including self-relating tables and tables with many-to-many relationships.

Data Navigation

In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method In ADO.NET, rows are represented as collections, so you can loop through a table as you would through any collection, or access particular rows via ordinal or primary key index. DataRelation objects maintain information about master and detail records and provide a

69 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

method that allows you to get records related to the one you are working with.

Minimized Open Connections

In ADO the recordset can provide disconnected access, but ADO is designed primarily for connected access.

In ADO.NET you open connections only long enough to perform a database operation, such as a Select or Update. You can read rows into a dataset and then work with them without staying connected to the data source.

Sharing Data Between Applications

To transmit an ADO disconnected recordset from one component to another, you use COM marshalling.

70 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Transmitting an ADO.NET dataset between applications is much easier than transmitting an ADO disconnected recordset.

To transmit data in ADO.NET, you use a dataset, which can transmit an XML stream.

The transmission of XML files offers the following advantages over COM marshalling

Richer data types

COM marshalling provides a limited set of data types those defined by the COM standard. Because the transmission of datasets in ADO.NET is based on an XML format, there is no restriction on data types. Thus, the components sharing the dataset can use whatever rich set

71 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

of data types they would ordinarily use.

Performance

Transmitting a large ADO recordset or a large ADO.NET dataset can consume network resources; as the amount of data grows, the stress placed on the network also rises. Both ADO and ADO.NET let you minimize which data is transmitted. But ADO.NET offers another performance advantage, in that ADO.NET does not require data-type conversions. ADO, which requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.

72 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Penetrating Firewalls

A firewall can interfere with two components trying to transmit disconnected ADO recordsets. Remember, firewalls are typically configured to allow HTML text to pass, but to prevent system-level requests (such as COM marshalling) from passing.

Because components exchange ADO.NET datasets using XML, firewalls can allow datasets to pass.

3. How do you connect to database in Asp.net and in ASP?

73 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

In asp.net

<%@ Import Namespace=System.Data.sqlClient %>

<%

dim cnString as string = Data Source=<DbServerName>; database=<dbName>; uid=<username>; pwd=<password>

dim cn as new sqlConnection(cnString)

cn.open

%>

In ASP

74 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

<%

dim cnString

cnString provider=sqloledb;Data Source=<DbServerName>; database=<dbName>; uid=<username>; pwd=<password>

dim cn

set cn = server.createobject(adodb.connection)

cn.open cnString

75 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

%>

4. What are the new object introduced in ado.net that are nor there in ADO

Dataset, Datareader, Datatable

76 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

5. What is the diff. bet DataReader & DataSet?

Datareader need all the time to be connected to the datasource but dataset is disconnected one.

Datareader is forward, read only.

6. What are the Database related classes available in .Net?

77 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Sqlconnection, sqlcommand, sqldataadapter, sqldatareader,

oledbconnection, oledbcommand, oledbdataadapter, oledbdatareader,

Dataset, Datatable

7. Maintaining transactions in ADO.net

There are two ways to handle transactions in updating data source.

78 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Database Transactions

Transactions can be handled in the database itself using stored procedures.

BEGIN TRANSACTION, COMMIT TRANSACTION, ROLLBACK TRANSACTION

Connection Based Transactions

We can make use of connection object to handle the transactions.

Connection.BeginTransaction, Transaction.Commit, Transaction.Rollback

79 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

We can create transaction object by

Dim objTran as sqlTransaction

Cn.open()

objTran = cn.BeginTransaction

assigning transaction object to the command object

objCommand.Transaction = objTran

finally you can call the following statements according to your conditions

80 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

objTran.Commit()

or

objTran.Rollback()

81 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

8. Which class you have commonly used from the System.Data namespace

Dataset , Datatable, DataRelation

Question on Security in ASP.NET

1. Securing ASP.Net Application

82 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Basic concepts

Authentication is a process of discovering the individual identity of users, and making them prove that they are who they say they are.

Authorization is the process of determining if a particular user is entitled to access the resource they have requested.

Impersonation is the process whereby the resource is accessed under a different identity usually the context of a remote user.

Data or functional security is the process of securing the system through physical means, OS

83 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

updates, and the use of robust software.

Authentication in Windows 2000

Windows 2000 maintains a list of users that are allowed to access resource on a machine. This is either stored on the machine itself, or on a domain controller elsewhere. The list is managed through computer management tool or active directory users and computers tool on a domain controller.

Authentication in IIS

Following checks are done by IIS before actually serving a request.

IP Address and Domain Restriction

84 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Here we can allow/deny access to the web application for a particular IP address or domain.

Anonymous access and authentication control

Anonymous Access : Any user can access the application unless his IP address or domain is unrestricted. This uses IUSR_MachineName account to access the resource.

Basic Authentication : If anonymous access is disabled, users will be presented with logon dialog. Username and password are Base 64 encoded and passed to IIS that checks with the accounts in windows, and will only allow the user to access the resource if the account is valid and has appropriate permission for that resource. Base64 encoding is not very secure.

Digest Authentication : If anonymous access is disabled, users will be presented with logon dialog. The browser combines this with other information stored on the client and send an encoded hash to the server. The server already has a copy of information, and so can get original details from its own hash. This only works with IE an d.NET webservices. Finally IIS checks with the accounts in windows, and will only allow the user to access the resource if the account is valid and has appropriate permission for that resource. This works fine in

85 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

proxy/firewalls.

Integrated Windows Authentication : This also know as NTLM authentication or challenge Response authentication. This is the same method used when you log onto your local network. This also uses hash algorithm to code and decode the client credentials. This does not work with most proxy/ firewalls. This is also very secure way. Finally IIS checks with the accounts in windows, and will only allow the user to access the resource if the account is valid and has appropriate permission for that resource.

Authorization in windows 2000

Access control list(ACL) defines which user has got what rights (Full control, read , write). Right

86 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

click on the folder and set the security options.

Authorization in IIS

In website properties ? Home Directory

You can set Script Source Access, Log Visits, Read, Index this resource, Write, directory browsing.

This applies to all the users who have access to this application.

ASP.net impersonation

87 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Impersonation can be set in web.config file.

<identity impersonate=true username=user password=pwd>

There are three types of authentication and authorization

Windows

Passport

Forms

This can be set in web.config file as

88 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Forms based (password format = Clear;SHA1;MD5)

<configuaration>

<system.web>

<authentication mode=Forms >

<forms name=MyApp Path=/ loginUrl=Login.aspx timeout=30>

<credentials passwordFormat=clear>

<user name=test password=test />

</credentials>

</forms>

</authentication>

</system.web>

</configuaration>

89 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

In the forms based authentication, we can use credentials or use xml file that has username/password or database in order to authenticate.

Windows based

<configuaration>

<system.web>

<authentication mode=Windows />

<identity impersonate=true />

<authorization>

<allow roles=some roles users=some users />

<deny roles=some roles users=some users />

90 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

</authorization>

</system.web>

</configuaration>

ASP.NET

91 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

1.

What is the difference between object type and value type?

When an object is allocated from the managed heap, the new operator returns the memory address of the object. You usually store this address in a variable. This is called a reference type variable because the variable does not actually contain the object's bits; instead, the variable refers to the object's bits

There are some performance issues to consider when working with reference types. First, the memory must be allocated from the managed heap, which could force a garbage collection to occur. Second, reference types are always accessed via their pointers. So every time your code references any member of an object on the heap, code must be generated and executed to dereference the pointer in order to perform the desired action. This adversely affects both size and speed.

Error! Unknown switch argument.In addition to reference types, the virtual object system supports lightweight types called value types. Value type objects cannot be allocated on the garbage-collected heap, and the variable representing the object does not contain a pointer to an object; the variable contains the object itself. Since the variable contains the object, a pointer

92 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

does not have to be dereferenced in order to manipulate the object. This, of course, improves performance

The main advantage of value types is that they are not allocated in the managed heap. Of course, value types have several limitations compared with reference types. Here are some of the ways in which value types and reference types differ.

Error! Unknown switch argument.Value type objects have two representations: an unboxed form and a boxed form. Reference types are always in a boxed form.

Boxing is an implicit conversion of a value type to the type object or to any interface type implemented by this value type. Boxing a value of a value allocates an object instance and copies the value into the new object.

Unboxing is an explicit conversion from the type object to a value type or from an interface type to a value type that implements the interface. An unboxing operation consists of:

93 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Checking the object instance to make sure it is a boxed value of the given value type.

Copying the value from the instance into the value-type variable.

2.

What are the different types of objects available in ADO.Net.

The Central components of ADO.NET are

Dataset ? The ADO.NET DataSet is the core component of the disconnected architecture of ADO.NET. The DataSet is explicitly designed for data access independent of any data source. As a result it can be used with multiple and differing data sources, used with XML data, or used to manage data local to the application. The DataSet contains a collection of one or more DataTable objects made up of rows and columns of data, as well as primary key, foreign key, constraint, and relation information about the data in the DataTable objects

94 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

DataTableCollection

DataTable

DataRowCollection

DataColumnCollection

ConstraintCollection

DataRelationCollection

.Net Data providers ?

Connection: Establishes a connection to a specific data source.

95 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Command: Executes a command against a data source. Exposes Parameters and can execute within the scope of a Transaction from a Connection.

DataReader: Reads a forward-only, read-only stream of data from a data source.

DataAdapter: Populates a DataSet and resolves updates with the data source.

3. How ADO.Net differs from ADO.

i. ADO .NET does not replace ADO rather it provides .Net programmer with access to relational data sources, XML and Appln data.

ii. ADO .NET similar to ADO + several new concepts in design + better interoperability and scalable data access

iii.

Improved integration with XML

96 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

iv.

Improved support for disconnected model (ADO had the same using cursor location)

v.

Improved design time support

vi. ADO u have a single obj that behaves in many diff ways viz recordset (keeps object model simple)

vii. vii. ADO .NET has object viz; DataReader (forward only readonly), DataSet (in memory relational representation of data), DataAdapter (bridge betw data source and dataset)

viii.

ADO .NET has command obj that supports ExecuteNonQuery () and ExecuteScalar

ix.

Data can be loaded from db, XML or can be application generated

x. In ADO communication to b happens thro OLE DB provider, where as in ADO .NET the communication happens thro DataAdapter which in turn makes calls to OLE DB providers or APIs provided

xi. Using ADO .NET it is possible to transmit data betwn applns where as in ADO u need to use disconnected recordsets to pass recordsets betwn components and u need to use COM marshalling (and requires the data types to be converted to COM data types when marshalling)

xii. Firewalls prevent transmit of data between components using COM Marshalling where as in ADO .NET firewalls does not create a problem as the data is passed in XML format.

xiii.

ADO.NET has minimized Database connections

97 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

5. What is a Web Service? Give an example.

Web Services are programmable business logic components that serve as black boxes to provide access to functionality via internet using standard protocols such as HTTP. Web services are based upon an application of XML called SOAP

SOAP stands for Simple Object Access Protocol. It is a communication protocol for sending information between application over internet via HTTP.

6. How is a Web Service qualified or defined.

7. what is format of WSDL?

98 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

WSDL stands for Web service description language

It is as xml based language for describing web services & how to access the web service. It specifies the location of the service and the operations (or methods) the service exposes.

Universal Description, Discovery and Integration (UDDI) is a directory service where businesses can register and search for Web services. It is a directory for storing web services and communicated via SOAP.

3.

How state is maintained in ASP.Net.

State management is the persistence of object or values through out the life of a web application or for the duration of a users interface within the application.

ASP.NET provides 4 ways to manage the state of a web application.

User State(Session)? User State is controlled through the session object. Session Allows us to maintain data for a limited duration of time, for a particular user and isolate that data from the other users.

99 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Application State ? Application state is controlled through the application object. Application allows us to maintain data for a given ASP.NET application. Setting should be done to access the data for all the resources like web services, ASP.NET page and so on.

Transient Application State(cache)? Transient Application State is maintained by the cache object. Cache is similar to the application, it is accessible for our entire application but has extra functionality like in the form of dependencies, callbacks and expiration

Static Variables ?Only one copy of the variable is created no matter how many instances of the classes are created and these are available through out the application in more efficient way than the Application.

100 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

4.

How objects will be managed in .NET?

5. How can you pass values between two pages in asp? How will you do the same in ASP.net?

In ASP values can be passed between two pages using request object.

In ASP.Net values between 2 pages can be passed Using Inline Code.

101 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Web form page whose information needs to be send to the second page

1.

specify ClassName attribute with the class name in the @page directive.

2. Next, create a property with a get accessor, in the class for each value that to be shared. This get accessor returns the value that need to passed

3. Then transfer the control of the web application to other web form page using transfer method of the server object.

The web form that receives the values

1.

Add @reference directive at the top of the page instead of @page attribute.

102 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

2.

Create an instance of the class defined in the web form page sending the information.

3. Can access the information by creating the instance of the handler that first received the HTTP request from the handler property of the Context object which in turn is converted in to an instance of the class which contains the passed information. After conversion the passed values can be accessed through the properties of the converted object.

Using Code-Behind File

When using code-behind files, the code-behind file contains a class declaration for the code associated with the Web Forms page. In the code-behind file for the Web Forms page sending the information, first create a property with a get accessor, in the class, for each value you want to share. The get accessor should return the value you want to pass, such as the value of a text box. To send the information, transfer control of the application to a different Web Forms page by using the Transfer method of the Server object.

On the receiving Web Forms page, reference the class declared in the sending page by adding an @Reference directive, at the top of the page, with the Page attribute set to the sending page. You can then retrieve an instance of the handler that first received the HTTP request from the Handler property of the Context object.

103 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

6.

What are the main differences between asp and asp.net?

a.

ASP is interpreted language where as asp.net is compiled language

b. In ASP is a mixture of code & content but in asp.net code can be separated from the content using codebehind concept.

c. ASP supports scripting language like vbscript/jscript but ASP.NET supports multiple languages.

d.

Validation of form controls

e. Asp is browser compatibility not a device compatability whereas in ASP.net can be compatability to any device/browser

f. Apart from this ASP.NET has many features like Multiple languages, server processing, enhanced controls, configuration, Deployment.

7.

What is user control?

104 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

These are custom controls with a file extension as .ascx.

8.

How do you a replicate a set of controls across a number of ASP Pages.

Using include files

9. do?

If you have to replicate a set of controls(UI) across a number of web pages, what will you

Using custom controls.NEED TO DISCUSS

10.

What are different types of controls available in ASP.Net

HTMLServerControls

Web Controls

List controls

105 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Rich Controls

Validation Controls

Custom Controls

Mobile Controls

11.

What are the validation controls available in ASP.net?

Validation server controls are the collection of controls that validates the user input server control and display a custom message when validation fails .These controls are available at system.web.UI.WebControls

Types of validation control are

i.

RequiredFieldValidator Checks if the input control has any value.

106 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ii.

RegularExpressionValidator Checks the value against a regular expression (pattern).

iii. CompareValidator Checks if the value is acceptable compared to a given value or compared to the content of another control.

iv.

RangeValidator Checks if the input controls value is within a specified range.

v.

CustomValidator Allows you to develop custom validation.

vi.

ValidationSummary Reports a summary of all errors.

12.

How will you upload a file to IIS in Asp and how will you do the same in ASP.net?

In ASP using File control , Response.BinaryRead, Response.AddContentType

In ASP.NET usinfg server side file input control and filecontrol.PostedFile object

107 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

13.

What are the Database related classes available in .Net?

Connection

Command

DataReader

DataAdapter

14.

What is the diff. bet DataReader & DataSet?

Data Reader is a forward only recordset.

108 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

15.

How do you connect to database in ASP.net and in ASP?

In ADO.NET you open connections only long enough to perform a database operation, such as a Select or Update. You can read rows into a dataset and then work with them without staying connected to the data source. In ADO the recordset can provide disconnected access, but ADO is designed primarily for connected access.

There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. The important difference is that in ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database by optimizing for performance, performing data validation checks, or adding any other extra processing.

16.

What is the difference between recordset and 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. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database.

109 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

A dataset usually also contains relationships. A relationship within a dataset is analogous to a foreign-key relationship in a database that is, it associates rows of the tables with each other. For example, if a dataset contains a table about investors and another table about each investor's stock purchases, it could also contain a relationship connecting each row of the investor table with the corresponding rows of the purchase table.

17.

What are the new object introduced in ADO.NET that are not there in ADO?

DataAdapter, DataReader, DataSet & its collection.

18.

Security in ASP.NET

19. What is the importance of IMPORT directive?

110 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ANS: The import directive specifies another IDL, ODL, or header file containing definitions you wish to reference from your main IDL file.

20. Which class you have commonly used from the System.Data namespace.

DataSet, DataColumn, DataColumnCollection, DataTable, DataType, DataRow, DataRelation, DataView

21. How do we handle client side variables in ASP.NET.

22. When should we consider the Session states and application states. where do we declare them?

111 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

23. What is the file extension of webservices?

.asmx

24. What is SOAP? What it is composed of ?

SOAP stands for Simple Object Access Protocol

SOAP is a communication protocol

SOAP is for communication between applications

SOAP is a format for sending messages

SOAP is designed to communicate via Internet

SOAP is platform independent

112 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

SOAP is language independent

SOAP is based on XML

SOAP is simple and extensible

SOAP allows you to get around firewalls

SOAP will be developed as a W3C standard

25. What is UDDI? What for it is used?

UDDI is a platform-independent framework for describing services, discovering businesses, and integrating business services by using the Internet.

UDDI stands for Universal Description, Discovery and Integration

UDDI is a directory for storing information about web services

UDDI is a directory of web service interfaces described by WSDL

UDDI communicates via SOAP

113 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

UDDI is built into the Microsoft .NET platform

24. How do you optimize your web applications performance?

.NET

11.

What are delegates in VB.NET/C#. How they are used?

12.

What are the Value types and Reference types?

13.

In depth explanation of stack and Heap with respect to .NET?

14. What r the advantages comparatively, Value types are derived from which namespace and reference types as well.

15.

What r the data types in vb.net and explain in detail

114 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

16.

How many types of access modifiers r there in vb.net and explain internal

17.

What is Attribute Programming? What are attributes? Where are they used?

18.

What is Reflection?

19.

What is a Constructor?

20.

What is a Destructor?

21.

How objects will be managed in .net?

22.

How do you handle errors in VB.net or c#?

23.

What is Polymorphism?

24.

Say you have identified a set of objects how will identify a base class?

25.

What is an abstract class?

26. What is the difference between new and override keywords in c# in the context of inheritance?

27.

Does .NET support multiple inheritance?

115 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

a.

No.

ADO.NET

1.

What are the different types of objects available in ADO.NET.

a.

116 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

2.

How ADO.Net differs from ADO?

3.

What are the Database related classes available in .Net?

4.

What is the diff. bet DataReader & DataSet?

5.

How do you connect to database in ASp.net and in ASP?

6.

What is the difference between recordset and dataset?

7.

What are the new object introduced in ADO.NET that are nor there in ADO?

The stack is an orderly first-in last-out memory structure, and is used for storing value-type objects.

Objects that own resources other than memory (in particular handles, such as Windows handles, file handles and SQL handles) need to be told explicitly to release those resources when the object is no longer required. This includes all Windows controls, since they all own Windows handles! You might ask, why not put the code to release those resources in the objects destructor? There are two reasons for this:

117 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The automatic garbage collector, which is responsible for initiating the destructor (by identifying and deleting dead objects) is concerned with memory issues and not resource issues. Hence if running on a PC with a few gigabytes of free RAM, it may wait an hour or two before even getting out of bed!

There is no guarantee that the destructor will ever get called, even once memory is released.

The last point is very important due to the complexities of automatic garbage collection, you cant rely on destructors, and this is an inherent limitation in the CLR.

While destructors do not work properly, memory management does. You can be sure that the memory belonging to an orphaned object will always be released, even though its destructor may never be called.

The other effect of adding it to the Controls collection is that the .NET framework will deterministically call a method called Dispose on all of its members the instant theyre no longer needed. And in this Dispose method, the control can release its Windows handle, as well as dropping the textbox off the screen.

118 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

All classes descending from MarshalByRefComponent (including all Windows Forms controls) have a Dispose method. This method must be called when an object is no longer needed in order to release resources other than memory. There are two ways this happens:

- manually (by calling Dispose explicitly)

- automatically: by adding the object to a .NET container, such as a Form, Panel, TabPage or UserControl. The container will ensure that when its Disposed, so are all of its members. Of course, the container itself must be Disposed (or in turn, be part of another container).

In the case of Windows Forms controls, we nearly always add them to a container and hence rely on automatic disposal.

Class objects have an extra storage and execution overhead in that they require a pointer, which must be de-referenced at runtime. This overhead, while quite small, is not desirable with a type so fundamental as Size or Point

119 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

1.

What are the different types of objects available in ADO.Net.

DataReader

DataSet

DataAdapter

2. How ADO.Net differs from ADO.

120 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ADO .NET does not replace ADO rather it provides .Net programmer with access to relational data sources, XML and Appln data.

ADO .NET similar to ADO + several new concepts in design + better interoperability and scalable data access

Improved integration with XML

Improved support for disconnected model (ADO had the same using cursor location)

Improved design time support

ADO u have a single obj that behaves in many diff ways viz recordset (keeps object model simple)

ADO .NET has object viz; DataReader (forward only readonly), DataSet (in memory relational representation of data), DataAdapter (bridge betw data source and dataset)

ADO .NET has command obj that su

121 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

pports ExecuteNonQuery () and ExecuteScalar

Data can be loaded from db, XML or can be application generated

In ADO communication to b happens thro OLE DB provider, where as in ADO .NET the communication happens thro DataAdapter which in turn makes calls to OLE DB providers or APIs provided

Using ADO .NET it is possible to transmit data betwn applns where as in ADO u need to use disconnected recordsets to pass recordsets betwn components and u need to use COM marshalling (and requires the data types to be converted to COM data types when marshalling)

Firewalls prevent transmit of data between components using COM Marshalling where as in ADO .NET firewalls does not create a problem as the data is passed in XML format.

ADO .NET has minimized Database connections

3. What are delegates in C#. How they are used?

Delegates are function pointers

122 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

It exhibits the property of a class and a function

They can access static as well as member functions

An event is a message sent by an object to indicate the occurrence of an action

A delegate is a class that can hold reference to a method. It has a signature (unlike class). It can hold reference only to method that matches its signature. Therefore delegate is a type safe function pointer.

event

By default it wud need two parameters, viz; source that raised the event + data for the

Event delegates are multicast; i.e they can hold reference to more than one event handling methods

123 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

4. How do you make ASP applications secure.

5. Suppose you have an application for credit card validation. What steps will you take to restrict unauthiorised users from using the application.

6. Write the code snippet for fetching data from a table and populating in a list box control of an asp page.

7. How will you design a program for the game of chess.

8. You have a table containing information about empid, empname, emailid, emailname and emailtext. How will you normalize the table.

9. You have a table containing empid, empname, managerid. Write an SQL to display the emp name along with his manager's name.

10. How state is maintained in ASP.Net.

124 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

My Experience with MS interview.

1.

In C# he asked what are the Value types and Reference types

Value types single space allocated where as reference type two space allocated (one for the object and the other for the reference of the object)

Value type directly deals with underlying data where as ref type is a pointer to the actual object

When copy a reference type both point to the same obj where as in case of value type we get two independent var

When passing a value by ref to a function the local obj (of a function) even if set to null does not effect the actual obj.. but the changes made to the obj properties remain .. as both the variables point to the same obj. one is a copy of the other

If we use the key word ref while passing the variable (objs/structs).. then assigning a null to the local var of func makes nullifies original obj .. as this time we deal with the original reference var and not a copy

In case of obj.. actual pbject is always placed on heap.. whereas the obj ref cud be placed on heap or stack depending on whether its a part of heap obj or local variable

125 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Mem allocated for value type freed when out of scope where as for ref type they r freed when they are no longer being referenced

Mem allocation of stack is faster than that of heap (ideal for small objs)

Incase of large objs avoid value type allocation as an assignment of it to another variable will create a copy the entire obj consuming additional mem

Boxing is converting value type to reference type and unboxing is converting reference type to value type

It is interesting to note that the runtime type of box is returned as the boxed value type;

int i = 123;

object box = i; (box is int) returns true

126 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Boxing allocates memory for the value being boxed on heap, copies the value into this memory and stores its reference in an object type. Consider the following code.

int i = 12 ;

Console.WriteLine ( The value is {0} , i ) ;

The WriteLine( ) method is written to accept objects. When we pass a variable of value type, int in this case, it gets boxed into an object. Using this object a method ToString( ) is called, which returns the string equivalent of the value stored in a variable. WriteLine( ) then displays this string.

The primitive data types in C# are mapped to underlying structures defined by the .NET base class library. This is done to ensure that code written in C# can be used in other .NET compliant languages.

Implicit type conversion is allowed so long as there is no loss of data. If we want to convert a data type into another for which implicit conversion is not possible, we can do so by type casting.

127 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Reference types actually hold the value of a memory address occupied by the object they reference. Consider the following piece of code, in which two variables are given a reference to the same object (for the sake of the example, this object is taken to contain the numeric property 'myValue').

object x = new object();

x.myValue = 10;

object y = x;

y.myValue = 20; // after this statement both x.myValue and y.myValue equal 20

This code illustrates how changing a property of an object using a particular reference to it is reflected in all other references to it. Note, however, that although strings are reference types, they work rather more like value types. When one string is set to the value of another, eg

string s1 = "hello";

string s2 = s1;

Then s2 does at this point reference the same string object as s1. However, when the value of s1 is changed, for instance with

128 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

s1 = "goodbye";

what happens is that a new string object is created for s1 to point to. Hence, following this piece of code, s1 equals "goodbye", whereas s2 still equals "hello".

The reason for this behaviour is that string objects are 'immutable'. That is, the properties of these objects can't themselves change. So in order to change what a string variable references, a new string object must be created.

You can find out whether an Object variable is acting as a reference type or a value type by passing it to the IsReference method on the Information class in the Microsoft.VisualBasic namespace. Microsoft.VisualBasic.Information.IsReference returns True if the content of the Object variable represents a reference type.

2. In depth explanation of stack and Heap with respect to .NET and other languages like C++

129 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3. What r the advantages comparatively, Value types are derived from which namespace and reference types as well.

4.

Why u have chosen C#, what r the reasons behind in choosing this in my last project.

C# allows unmanaged code

C# has structured error handling

VB .Net has project level setting to check for integer over flow (can be turned on or off)

C# can run in checked or unchecked context.. in checked arithmetic overflow raises exception else the data gets truncated.

C# allows use of XML Documentation (can be translated to HTML using XSLT/ create web site using comments/ convert to CHM)

C# has neater code (clarity of code)

5.

How this is more advantageous then other languages as well when ur targeting

6.

What r the data types in C# and explain in detail

130 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

7.

How many types of access modifiers r there in C# and explain internal

8.

Diff b/w ASP and ASP.NET (Only this question came from list)

9.

Explain any 3 ASP.NET features u know in ASP.NET which u have used in project

1.

what are the main differences between asp and asp.net?

2.

what is user control?

3.

How do you a replicate a set of controls across a number of ASP Pages.

4. do?

If you have to replicate a set of controls(UI) across a number of web pages, what will you

5.

What are different types of controls available in ASP.Net

6. how can you pass values between two pages in asp?how will you do the same in ASP.net?

131 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

7.

what are the validation controls available in ASP.net?

8.

how will you upload a file to IIS in Asp and how will you do the same in ASP.net?

9.

What is Attribute Programming? What are attributes? Where are they used?

1.

What are the Database related classes available in .Net?

2.

11.What is the diff. bet DataReader & DataSet?

3.

12.how do you connect to database in ASp.net and in ASP?

4.

13.what is the difference between recordset and dataset?

5.

14.what are the new object introduced in ado.net that are nor there in ADO?

6.

15.What is a WebService? Give an example.

7.

16.How is a WebService qualified or defined

132 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

8.

17.what is format of WSDL?

9.

18.what is xml?diffrences between xml and html?

10.

19.what xsl?where will you use this technology..give an example.

11.

20.question on Reflection?

12.

21.how will you return results as xml from SQL server?

13.

22.How do you design a database? - basics of DB Design, SPs, triggers?

14.

23.What are the normal forms and which is the best?

15.

24.If a database is in 3NF, how many minimum number of tables should it have?

16.

25.What is referential integrity & how is it achieved?

17.

26.What is a Primary Key? Can it have >1 field?

133 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

18.

27.What are constraints?

19.

28.why should you create index? Types on indexes?

20.

29.what is a trigger and stored procedure?

21.

30.what are inserted and deleted tables?

22.

31.what is a view?where will you use views?

23.

32.what is fillfactor?

24.

33.Pillars of OO Progg

25.

34.What is a Constructor?

26.

35.What is a Destructor?

27.

36.what is late binding and early binding?

28.

37.how objects will be managed in .net?

134 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

29.

38.How do you handle errors in VB.net or c#?

30.

39.How do you handle errors in VB?

31.

40.Question on on error goto 0?

32.

41.How are structures implemented in VB?

33.

42. What is the necessity for Resume Next?

34.

43.what is COMInterop?

35.

44.Question on Tlbimp,Tlbexp and other tools?

36.

45.What is the difference between COM and DCOM?

37.

46.question on iunknown interface and methods i.r addref,release etc..

135 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

38.

47.What is the default interface for any COM component?

IUnknown

39.

48.What are the methods available in IUnknown?

Add ref (whenever an object is instantiated the counter for the obj gets increased by 1)

QueryInterface (searches for the GUID from the Projectname.Classname given)

Release

The IUnknown interface lets clients get pointers to other interfaces on a given object through the QueryInterface method, and manage the existence of the object through the IUnknown::AddRef and IUnknown::Release methods. All other COM interfaces are inherited, directly or indirectly, from IUnknown. Therefore, the three methods in IUnknown are the first entries in the VTable for every interface.

136 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

40.

49.What is IDispatch?

Interface that exposes objects, methods and properties to programming tools and applications that support automation

137 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

IDispatch Methods

Description

GetTypeInfoCount

Retrieves the number of type information interfaces that an object provides (either 0 or 1).

GetTypeInfo

Gets the type information for an object.

GetIDsOfNames

Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs.

Invoke

Provides access to properties and methods exposed by an object.

Located on oleauto.h header file for 32 bit system and Dispatch.h on 16- bit and Machintosh system.

138 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

41.

50.what is the diffrence between activex exe and activex dll?

42.

51.how will you choose between activex exe and activex dll?

43.

52.OLE

44.

53.ActiveX.exe example.

45.

54.Ways to Instantiate a Object

46.

55.Modeling languages.

47.

56.ASP built-in objects

48.

57.HTML and DHTML

49.

Diff. betwn web user control and web control

50.

datareader and dataset

139 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

51.

In order to publish 1000 records, which of the above should be used?

52.

what is correlated subquery?

53.

threading in .net.

54.

complete SDLC stages

55.

Early Binding Late Binding

There are two ways to use Automation (or OLE Automation) to programmatically control another application.

Late binding uses CreateObject to create and instance of the application object, which you can then control. For example, to create a new instance of Excel using late binding:

140 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Dim oXL As Object

Set oXL = CreateObject("Excel.Application")

On the other hand, to manipulate an existing instance of Excel (if Excel is already open) you would use GetObject (regardless whether you're using early or late binding):

Dim oXL As Object

Set oXL = GetObject(, "Excel.Application")

To use early binding, you first need to set a reference in your project to the application you want to manipulate. In the VB Editor of any Office application, or in VB itself, you do this by selecting Tools + References, and selecting the application you want from the list (e.g. Microsoft Excel 8.0 Object Library).

To create a new instance of Excel using early binding:

Dim oXL As Excel.Application

141 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Set oXL = New Excel.Application

In either case, incidentally, you can first try to get an existing instance of Excel, and if that returns an error, you can create a new instance in your error handler.

Advantages of Early Binding

1. Your code will run considerably faster, because it can all be compiled up front. With late binding, the code relating to an application you declared as an object has to, in effect, be compiled as it runs.

2. Because your code can all be compiled up front, debugging is far easier select Debug + Compile, and the compiler will be able to spot syntax errors which would have been missed had you used late binding.

142 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3. You have full access in your project to intellisense (type a keyword and a dot to get a popup list of properties and methods supported by that keyword, select one to insert it; pe a keyword and press F1 to launch the Help topic on that keyword).

ty

4. You have full access to the application's object model via the Object Browser and VBA Help.

5. You have access to the application's built-in constants. For instance, if you are automating Word from Excel, you can use:

Dim objWord As Word.Application

Set objWord = New Word.Application

With objWord

143 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

.Visible = True

.Activate

.WindowState = wdWindowStateMaximize

.Documents.Open ("c:temptemp.doc")

End With

Furthermore, when you type

.WindowState =

you'll get a pop-up list of the supported constants, and can simply pick wdWindowStateMaximize from the list.

If you used late binding, you would need to use:

.WindowState = 1

.. and you would need to know (by looking it up in Word's Object Browser) that the value of the constant wdWindowStateMaximize happens to be 1.

144 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

All this makes programming using early binding immeasurably easier than using late binding.

Advantages of Late Binding

1. The main advantage is that code which uses late binding is more certain to be version-independent

If you set a reference in a Word 97 project to Microsoft Excel 8.0 Object Library, then the project willrun OK on a machine which has Office 2000 installed. Word 2000 changes the reference on the fly to the crosoft Excel 9.0 Object Library.

Mi

But as they famously say, YMMV. Problems have been found in certain circumstances. For instance, if you run a Word 97 project containing a reference to the Excel 8.0 object library on a machine with Office 2000 installed, it will run OK, but you may get the occasional cannot open macro storage error unless you save the project in Word 2000. If you do save it in Word 2000, the reference will change to the Excel 9.0 object library. So if you use early binding and support a mixed environment, it may be safest to create separate Word 97 and Word 2000 versions of your addins, despite the maintenance overhead.

145 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

2. The more references your project contains, the larger the file size and the longer it takes to compile.

3. Some programming environments don't allow you to create references to another application.

Summary

Personally, as someone who finds programming difficult at the best of times, I would never dream of using late binding why make life harder for yourself than it has to be? But some programming geniuses prefer to use late binding, because of the peace of mind it gives them regarding version independence or maybe some of them just enjoy the challenge! <g> But you pays your money and makes your choice ...

To those unfortunate souls using programming environments in which you have to use late binding, all I can say is: Look on the bright side you could have ended up as an Assembly language programmer ...

146 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

You can author new controls by combining existing controls using class composition. A composite control renders a user interface that reuses the functionality of existing controls. A composite control can synthesize properties from the properties of its child controls and handle events raised by its child controls. It can also expose custom properties and events.

Early and Late Binding

There are two different ways of implementing OLE Automation: VTBL (virtual method table, pronounced V-Table) binding, and the IDispatch (pronounced EYE-Dispatch) interface. Using VTBL binding is similar to programming the speed dialer on your phone. You look up the number once and program it into the phone. Once you verify that it's valid, a single button dials the number. All the work of looking up the phone number is handled long before you use the

147 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

phone number. Using the IDispatch interface is similar to looking up the phone number in a phone book before each call, and then dialing the phone. Both will get the intended results, but the speed dialer is much more efficient when you need to make the call. However, looking up the number each time verifies its correctness.

Early Binding: VTBL Binding

A VTBL is a data structure containing the addresses (pointers) for the methods and properties of each object in an Automation server. Using the VTBL is generally known as early binding in VBA. Frequently, early binding requires type information provided in the form of a type library. This type information allows VBA to perform compile-time syntax and type checking. At run time, this type of binding is faster, as the entry points for the Automation server are already known and the data types and syntax have already been verified.

Late Binding: The IDispatch Interface

Using the IDispatch interface is a way to call member functions within an object without knowing the exact location of their entries in the VTBL. An IDispatch implementation is frequently referred to as late binding. With IDispatch, VBA has no preexisting information about the server it will be calling. It assumes during its compile phase that the code is correct. It then attempts at run time to execute the code and trap for run-time errors. This is much less elegant and represents a step backward from the familiar syntax and type checking we have come to expect

148 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

from VBA. An IDispatch call also requires both the client and the server to marshal their arguments into a consistent form that is understood by both. In most cases, this means that arguments are copied into and out of variants. This not only slows down IDispatch, but it also limits the data types that can be passed using this technique. In all future discussions VTBL binding will be referred to as early binding and IDispatch as late binding.

What does this mean to you as a developer using VBA? If possible you should attempt to early bind when using Automation objects from VBA. Early binding not only increases performance, but you get syntax and type checking at compile-time. If you can't early bind you must use late binding, which is slower and doesn't allow you to catch simple errors (such as type mismatches) until run time.

Early binding should be used whenever possible. However, there are programming situations in which late binding is preferred. If you are implementing polymorphic code (one call can represent multiple different objects), then late binding is required. For example, you can create three classes widgets, gidgets, and gadgets all with a Create method. By defining your variable as an object, you can call the Create method for any of the three classes based on run-time conditions.

When testing this type of late-bound strategy, it's generally best to test a single object, early bind to get the syntax and type checking, and then switch to late binding after you've tested each object individually.

Binding in VBA

149 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

What does early binding versus late binding look like in VBA? The main difference is in how you declare your variables. The following code snippet declares an object variable that refers to an instance of Microsoft Word. This example represents late binding, since we have used the generic Object data type. VBA doesn't know what type of object it is and will use late binding at run time to handle it. This is like running to the phone book before dialing the phone.

Dim wrd as Object

In the following code snippet, we declare the same object variable and specifically type it as Word.Application. This can be done only after we have referenced the Microsoft Word type library using Tools/References. Since VBA knows about the type of this object, it attempts to use early binding when dealing with it.

Dim wrd As Word.Application

How you declare the object variable is the factor that determines whether an object is early or late bound. How you create the object has no bearing on the type of binding VBA does, but it does have some performance implications.

To create an object, you can use either the New keyword or the CreateObject method. The

150 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

CreateObject method is typically used when you don't know the Program ID (ProgID) of the object you are going to create until run time. Excel.Application is an example of a ProgID. Typically, a ProgID is composed of the application name followed by a period and then the class name (for example, Application.Class). To arrive at the ProgID for a particular object, use this method and then look at HKEY_CLASSES_ROOT in the registry to verify that you are correct. If you are correct, the ProgID should show up in this hive as a key. It's often assumed that if you use CreateObject you are using late binding, but this is not always the case. The declaration of the object variable is the overriding factor. CreateObject does have a slight performance disadvantage when compared to New. CreateObject assumes there is no reference to the object it is trying to instantiate and loads all the type information from the registry. This process is slower than using the type information available in a type library.

The New keyword has two syntaxes. The following example declares and instantiates the object in separate lines:

Dim wrd As Word.Application

Set wrd = New Word.Application

This is the recommended syntax. The following example shows how New can be used to declare and instantiate an object at the same time:

Dim wrd As New Word.Application

This ensures that wrd always contains a valid instance of Word.Application. You don't have to worry about checking to see if wrd has been initialized yet. But there is a minor penalty for this,

151 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

since the VBA compiler adds some overhead to be sure the object was loaded. This is transparent to you, but your compiled code will be slightly larger compared with the previous syntax.

CreateObject can also be used, and it retrieves the type information for Word.Application from the referenced type library. The results of the following are identical with but slightly slower than using the similar construct with the New keyword:

Dim wrd as Word.Application

Set wrd = CreateObject("Word.Application")

New is the recommended method for instantiating objects if you have access to the object's type library.

Early binding: associating with every variable its abstract data type -- enables type checking

Late binding: attributes data types are not known until run time. Polymorphism allows to select the implementation at run-time.

The main advantage of late binding is that programs look simpler, the disadvantage is that many type errors are not caught until run-time (if at all).

In-Process vs. Cross-Process

152 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

OLE Automation objects are instantiated in two different manners: in-process and cross-process. An in-process Automation object is loaded as a DLL into the process space (the memory of the application) of the controller. This has a distinct performance advantage, since the controller and object are in the same process space and direct function calls may be made between them. However, there are some drawbacks. When loading servers in-process, each controller must load its own copy of the object. There is no sharing of objects between processes. When an object is in-process, a bug in the object can bring down both the controller and the object. Despite the pitfalls, in-process object communication is fastest and is typically the method you want to use.

Cross-process objects load in separate process spaces and use remote procedure calls (RPC) to communicate. There is a certain amount of overhead involved in cross-process RPC, and as a result this method is typically slower than the in-process implementation. It does, however, have the advantage of partitioning the processes, and it allows a single object to be shared by multiple controllers.

The Capability Maturity Model for Software describes the principles and practices underlying software process maturity and is intended to help software organizations improve the maturity of their software processes in terms of an evolutionary path from ad hoc, chaotic processes to mature, disciplined software processes. The CMM is organized into five maturity levels:

153 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

1) Initial. The software process is characterized as ad hoc, and occasionally even chaotic. Few processes are defined, and success depends on individual effort and heroics.

2) Repeatable. Basic project management processes are established to track cost, schedule, and functionality. The necessary process discipline is in place to repeat earlier successes on projects with similar applications.

3) Defined. The software process for both management and engineering activities is documented, standardized, and integrated into a standard software process for the organization. All projects use an approved, tailored version of the organization's standard software process for developing and maintaining software.

4) Managed. Detailed measures of the software process and product quality are collected. Both the software process and products are quantitatively understood and controlled.

5) Optimizing. Continuous process improvement is enabled by quantitative feedback from the process and from piloting innovative ideas and technologies.

154 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Except for Level 1, each maturity level is decomposed into several key process areas that indicate the areas an organization should focus on to improve its software process.

The key process areas at Level 2 focus on the software project's concerns related to establishing basic project management controls. They are Requirements Management, Software Project Planning, Software Project Tracking and Oversight, Software Subcontract Management, Software Quality Assurance, and Software Configuration Management.

The key process areas at Level 3 address both project and organizational issues, as the organization establishes an infrastructure that institutionalizes effective software engineering and management processes across all projects. They are Organization Process Focus, Organization Process Definition, Training Program, Integrated Software Management, Software Product Engineering, Intergroup Coordination, and Peer Reviews.

The key process areas at Level 4 focus on establishing a quantitative understanding of both the software process and the software work products being built. They are Quantitative Process Management and Software Quality Management.

The key process areas at Level 5 cover the issues that both the organization and the projects must address to implement continual, measurable software process improvement. They are Defect Prevention, Technology Change Management, and Process Change Management.

155 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ASP

28.

How do you make ASP applications secure?

a. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnproasp2/html/implement ingaspsecurity.asp

29.

What are the main differences between asp and asp.net?

http://www.learnasp.com/freebook/learn/differences.aspx

30.

How do you a replicate a set of controls across a number of ASP Pages?

a.

#include file

31. How can you pass values between two pages in ASP?how will you do the same in ASP.net?

156 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

a.

Query String

b.

Post/Hidden members

c.

Session Variables

32.

How will you upload a file to IIS in Asp?

a. Microsoft has one free DLL, namely CPSHOST.DLL, with which you can upload files. It requires a folder with write permissions since it is there where the file(s) will be posted (saved) when they arrive to the Web server (IIS). Another drawback is that you are focusing only on file uploading and not on other uploading possibilities. Remember, when you upload a file, you can also upload (post) any other inputs, such as the input file, input checkbox, input password, and input image, etc. And you can check their value just as if you were posting an ordinary form. So when you upload a file you are really posting a form's content to the browser by using a different encoding type (enctype) in your form. That encoding is specified as enctype="multipart/form-data" as an attribute of your form.

b.

http://www.15seconds.com/issue/001003.htm

157 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

33.

What are the built-in objects in ASP?

a.

Request

b.

Response

c.

Session

d.

Application

e.

Server

f.

ObjectContext

g.

Error

34.

What are the data type in ASP?

a.

Variant

158 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

35.

Are vbscript, vb strongly typed languages?

a.

Vbscript is not but vb is.

36.

Performance tuning ASP applications

There are many things that you can do to optimise ASP applications but the follow list is a good starting point;

If you dont absolutely need session management disable it.

Be careful where you store COM objects, especially those written in VB.

Always remember to release COM objects to prevent memory leaks.

Utilise SQL commands fully when doing database access.

159 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

VB

42.

What is late binding and early binding?

There are two different ways of implementing OLE Automation: VTBL (virtual method table, pronounced V-Table) binding, and the IDispatch (pronounced EYE-Dispatch) interface.

Early Binding: VTBL Binding

A VTBL is a data structure containing the addresses (pointers) for the methods and properties of each object in an Automation server. Using the VTBL is generally known as early binding in VBA. Frequently, early binding requires type information provided in the form of a type library. This type information allows VBA to perform compile-time syntax and type checking. At run time, this type of binding is faster, as the entry points for the Automation server are already known and the data types and syntax have already been verified.

Late Binding: The IDispatch Interface

160 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Using the IDispatch interface is a way to call member functions within an object without knowing the exact location of their entries in the VTBL. An IDispatch implementation is frequently referred to as late binding. With IDispatch, VBA has no preexisting information about the server it will be calling. It assumes during its compile phase that the code is correct. It then attempts at run time to execute the code and trap for run-time errors. This is much less elegant and represents a step backward from the familiar syntax and type checking we have come to expect from VBA. An IDispatch call also requires both the client and the server to marshal their arguments into a consistent form that is understood by both. In most cases, this means that arguments are copied into and out of variants. This not only slows down IDispatch, but it also limits the data types that can be passed using this technique. In all future discussions VTBL binding will be referred to as early binding and IDispatch as late binding.

Early binding not only increases performance, but you get syntax and type checking at compile-time. If you can't early bind you must use late binding, which is slower and doesn't allow you to catch simple errors (such as type mismatches) until run time.

Early binding should be used whenever possible. However, there are programming situations in which late binding is preferred. If you are implementing polymorphic code (one call can represent multiple different objects), then late binding is required. For example, you can create three classes widgets, gidgets, and gadgets all with a Create method. By defining your variable as an object, you can call the Create method for any of the three classes based on run-time conditions.

161 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

When testing this type of late-bound strategy, it's generally best to test a single object, early bind to get the syntax and type checking, and then switch to late binding after you've tested each object individually.

43.

How do you handle errors in VB?

a.

On Error Resume Next

b.

On Error GoTo

c.

On Error GoTo 0

44.

Question on on error goto 0?

a.

To neutralize On Error Resume Next

162 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

45.

How are structures implemented in VB?

a.

Type

46.

What are the various ways in which you instantiate an object in VB?

To create an object, you can use either the New keyword or the CreateObject method. The CreateObject method is typically used when you don't know the Program ID (ProgID) of the object you are going to create until run time. Excel.Application is an example of a ProgID. Typically, a ProgID is composed of the application name followed by a period and then the class name (for example, Application.Class). To arrive at the ProgID for a particular object, use this method and then look at HKEY_CLASSES_ROOT in the registry to verify that you are correct. If you are correct, the ProgID should show up in this hive as a key. It's often assumed that if you use CreateObject you are using late binding, but this is not always the case. The declaration of

163 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

the object variable is the overriding factor. CreateObject does have a slight performance disadvantage when compared to New. CreateObject assumes there is no reference to the object it is trying to instantiate and loads all the type information from the registry. This process is slower than using the type information available in a type library.

The New keyword has two syntaxes. The following example declares and instantiates the object in separate lines:

Dim wrd As Word.Application

Set wrd = New Word.Application

This is the recommended syntax. The following example shows how New can be used to declare and instantiate an object at the same time:

Dim wrd As New Word.Application

This ensures that wrd always contains a valid instance of Word.Application. You don't have to worry about checking to see if wrd has been initialized yet. But there is a minor penalty for this, since the VBA compiler adds some overhead to be sure the object was loaded. This is transparent to you, but your compiled code will be slightly larger compared with the previous syntax.

CreateObject can also be used, and it retrieves the type information for Word.Application from

164 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

the referenced type library. The results of the following are identical with but slightly slower than using the similar construct with the New keyword:

Dim wrd as Word.Application

Set wrd = CreateObject("Word.Application")

New is the recommended method for instantiating objects if you have access to the object's type library.

47. What are the threading models that you can choose in VB? Which one will you recommend and why?

Apartment Threading model.

Because in this model the COM object is instantiated only on the first call to it.

165 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

48.

Can you store a VB object in ASP session variable? Is it recommended? Why not?

Code that places objects in session or even application scope on the basis that it is more efficient to only create the object once and that this has the advantage of persisting not only data but also business logic as well. Whilst it is true that the creation of an object can be time consuming and the idea of persisted business logic is tempting, placing the VB object in session scope has a peculiar side effect it can seriously impair the performance of the application.

To understand this problem we have to lift the lid and examine how ASP actually works. The core of the ASP runtime executes in an MTA process which enables it to do many things at once, however requests for ASP pages are placed into a queue which then distributes the requests to a number of STA worker threads each of which can only deal with one request at a time. ASP uses up to 25 STA worker threads at any one time (per processor). The problem with the VB components is that they exhibit thread affinity. Once a object has been created in session scope by an ASP script that was processed by STA worker number 6, that session is pinned to worker number 6 for its life cycle. This means that when the client places a subsequent request it can only be processed by worker thread number 6, even if all the rest of the workers are idle the request will stay in the queue until worker thread 6 becomes free. You can see how detrimental this side effect can be with session scope objects but placing VB

166 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

objects

application scope is even worse as it will pin all requests for your application to one single worker thread effectively only using one 25th of your servers capability.

49.

Compatibility settings in vb?

The Compatibility setting allows you to determine the Visual Basic project's compatibility to older versions of the ActiveX Components generated from the project.

The ActiveX Components you create contain a default interface (for example, CName_D where CName is the ClassName for the ActiveX Component) that contains all of the methods and properties you have created. If your Class raises events, you also have an additional interface called IConnectionPointContainer. When you build an ActiveX Control or Server, these Interfaces are given a unique identifier. If you modify your control or server, these interfaces may change. Any applications using an older version of your component may fail at this point. To ensure that your new and old interfaces will work with all applications, you need to set the appropriate Compatibility setting.

167 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

You can set the Project's Compatibility in the ProjectProperties dialog box, under the Component tab.

Visual Basic has three different compatibility settings for Projects:

No compatibility.

Project compatibility.

Binary compatibility.

168 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

No Compatibility

With this setting, no compatibility is enforced. Visual Basic creates new Interface IDs and Class IDs every time you build or compile your project. Each version built can only be used with applications created to work with that specific build of the component.

Project Compatibility

With this setting, you can make your project compatible to a specific component project. While new type library information is generated, the type library identifier is maintained so that test projects can still refer to the component project. This setting is for maintaining compatibility during testing. Therefore, once the component is released, it behaves the same as the No Compatibility setting.

Binary Compatibility

When you compile your project, Visual Basic only creates new Class and Interface IDs when necessary. It preserves the class and interface IDs from the previous version(s) so that programs compiled using an earlier version will continue to work. If you are making a change that will result in an incompatible version, Visual Basic will warn you. If you want to maintain compatibility with older, released versions of an ActiveX component, this is the setting you need to use.

50.

What is the necessity for Resume Next?

169 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

a.

To continue executing the code even a runtime error occurs.

COM

12.

What is the difference between COM and DCOM?

a.

DCOM is used to work with components located in different machines.

b.

COM is a Specification

c.

DCOM is a Model/Implementation

13.

What is the default interface for any COM component?

a.

IUnKoown

14.

What are the methods available in IUnknown?

170 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

a.

QueryInterface, AddRef, Release

15.

What is IDispatch?

a.

Ref Attachment IDispatch

16.

What is the diffrence between activex exe and activex dll?

Components are characterized by their location relative to clients. An out-of-process component is an .exe file that runs in its own process, with its own thread of execution. Communication between a client and an out-of-process component is therefore called cross-process or out-of-process communication.

An in-process component, such as a .dll or .ocx file, runs in the same process as the client. It provides the fastest way of accessing objects, because property and method calls dont have to be marshaled across process boundaries. However, an in-process component must use the clients thread of execution.

In-process components execute in the process space of the calling application; out-of-process components execute in their own distinct process space. When an application (any .exe file) starts, Windows creates a process space in which the application runs. This process space gets its own memory address space that's inaccessible to other processes. When an application instantiates an object from an in-process component (DLL, OLE custom controlOCX), code executes in the calling application. This calling application is called the client. The in-process

171 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

component can share the memory address space of the client application.

17.

How will you choose between activex exe and activex dll?

18.

ActiveX.exe example.

a.

DLLHHost.exe

XML

5.

What is xml? Diffrences between xml and html?

XML is a markup language for documents containing structured information.

Structured information contains both content (words, pictures, etc.) and some indication of what role that content plays (for example, content in a section heading has a different meaning from

172 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

content in a footnote, which means something different than content in a figure caption or content in a database table, etc.). Almost all documents have some structure.

A markup language is a mechanism to identify structures in a document. The XML specification defines a standard way to add markup to documents.

XML is to data as what HTML is to text. One thing to note is that XML is NOT a replacement for HTML.

XML

HTML

Is used for storing and exchanging data

Is used for formatting data for display

Is used to describe data

Is used to display data

Users define their own tags Users have to utilize the pre-defined tags

White space is preserved

White space is not preserved

While there are differences between XML and HTML, in syntax they are very similar, although XML demands that the user pay attention to the little details. Next I will explain some of the new rules that XML uses that make its use slightly different from that of HTML.

173 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

6.

What xsl? Where will you use this technology..give an example?

XSL is a language for expressing style sheets. An XSL style sheet is, like with CSS, a file that describes how to display an XML document of a given type. XSL shares the functionality and is compatible with CSS2 (although it uses a different syntax). It also adds:

A transformation language for XML documents: XSLT. Originally intended to perform complex styling operations, like the generation of tables of contents and indexes, it is now used as a general purpose XML processing language. XSLT is thus widely used for purposes other than XSL, like generating HTML web pages from XML data.

Advanced styling features, expressed by an XML document type which defines a set of elements called Formatting Objects, and attributes (in part borrowed from CSS2 properties and adding more complex ones.

174 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

http://www.w3.org/Style/XSL/WhatIsXSL.html

7.

What are the XML parsers you are aware of?

a.

MSXML

8.

What is the difference between DOM and SAX?

a. SAX (Simple API for XML) like DOM (Document Object Model) gives access to the information stored in XML documents using any programming language (and a parser for that language). However, both of them take very different approaches to giving you access to your information: DOM creates a tree of nodes (based on the structure and information in your XML document) and you can access your information by interacting with this tree of nodes. DOM gives you access to the information stored in your XML document as a hierarchical object model. The textual information in your XML document gets turned into a bunch of tree nodes. With SAX, the parser tells the application what is in the document by notifying the application of a stream of parsing events. Application then processes those events to act on data. SAX is very useful when the document is large.

175 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

b. http://msdn.microsoft.com/library/en-us/xmlsdk30/ htm/sax2_gettingstarted_saxordom.asp

ASP

* What are the built-in objects in ASP?

The seven built-in objects are:

Application

ASPError

ObjectContext

Request

176 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Response

Server

Session

The Application object shares, stores, and retrieves information in response to requests from users to the application.

COLLECTION PROPERTIES

Contents Object

177 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

A collection of all of the items which have been created and added to the Application object during client sessions through script commands, such as the Server.CreateObject, rather than by using the HTML <OBJECT> tag.

StaticObjects Object

A collection of all of the items which have been created and added to the Application object during client sessions by using the HTML <OBJECT> tag, rather than using script commands.

METHODS

178 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Contents.Remove Method Implemented in version 3.0

The Contents.Remove method is used to remove a single item from a Contents collection.

Contents.RemoveAll Method Implemented in version 3.0

The Contents.RemoveAll method is used to remove all items from a Contents collection.

Lock Method

The Lock method prevents all other users from making changes in the Application object.

Unlock Method

The Unlock method allows any user to have access to any of the Application object properties in order to make changes.

179 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

EVENTS

OnEnd Event

The OnEnd event occurs when the Application quits. This should not occur unless all user sessions are over. The signal of this event will run a handler script in the Global.asa file, if the script exist.

OnStart Event

180 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The OnStart event occurs before the start of any new session by a user (i.e., before the Application object is first referenced). The signal of this event will run a handler script in the Global.asa file, if the script exist.

ASPError

The ASPError object is used to obtain detailed information on an error condition. This information, provided by the nine read-only properties of ASPError, can only be accessed by using the Server.GetLastError method.

PROPERTIES

181 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ASPCode Property

The ASPCode property returns the error code generated by IIS.

ASPDescription Property

The ASPDescription property returns a string that provides more detailed description of the error as compared to the short description returned by the Description property. (Not available for all errors.)

Category Property

The Category property returns a string indicating if the error was generated by IIS, an object, or a scripting language.

Column Property

182 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The Column property returns a long integer defining the column position inside the ASP file where the error occurred.

Description Property

The Description property returns a string that is a short description of the error. If you desire a longer description, use the ASPDescription property.

File Property

The File property returns the name of the ASP (Active Server Page) file in which the error occurred.

Line Property

The Line property returns an long integer defining the line number inside the ASP file where the error occurred.

183 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Number Property

The Number property returns a long integer defining the standard COM error code returned by a COM component.

Source Property

The Source property returns a string with the actual line from the source code where the error occurred (if available).

ObjectContext object

The ObjectContext object is used to control Active Server Pages transactions which are managed by the Microsoft Transaction Server (MTS). You may either complete (commit) or abort a transaction.

The @Transaction directive must be on the first line of the .asp file in order to use this object (see code examples). The @Transaction directive causes a transaction to run to completetion unless an abort occurs.

184 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

METHODS

SetAbort Method

The SetAbort method declares that a transaction has not been completed and resources should not be updated.

SetComplete Method

The SetComplete method declares that the transaction has been completed and resources can be updated.

185 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

EVENTS

OnTransactionAbort Event

The OnTransactionAbort event occurs when a transaction has been aborted for some kind of processing error. The signal of this event will run a handler script in the same file, if it exist.

OnTransactionCommit Event

The OnTransactionCommit event occurs when a transaction has been successfully completed. The signal of this event will run a handler script in the same file, if it exist.

Request object

The Request object provides access to all of the information that is passed in a request from the browser to the server. This information is stored among five types of Request collections. A collection is similar to a data structure or array. Individual items in the collection are accessed via a unique key assigned to that item.

186 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

All variables can be accessed directly by calling Request(variable) without the collection name. In this case, the Web server searches the collections in the following order: QueryString, Form, Cookies, ClientCertificate, then ServerVariables.

PROPERTY

TotalBytes Property

The TotalBytes property specifies the total number of bytes sent in the body of the HTTP request.

187 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

COLLECTION PROPERTIES

ClientCertificate Collection Property

The ClientCertificate collection property contains the values of the client certification fields of the request.

Cookies Collection Property

The Cookies collection property contains the values of the cookies sent in the request.

Form Collection Property

The Form collection property contains the values of the <FORM> elements posted to a form using the POST method.

188 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

QueryString Collection Property

The QueryString collection property contains the values of the variables in the HTTP query string, which are the statements that follow a question mark.

ServerVariables Collection Property

The ServerVariables collection property contains the values of server environmental variables. This allows access to the HTTP headers.

METHOD

BinaryRead (Count) Method

The BinaryRead method retrieves the data that was sent to the server from the browser as part of a POST request, and returns the number of bytes read.

189 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Response object

The Response object sends information back to the user (browser).

PROPERTIES

Buffer Property Modified in version 3.0

The Buffer property tells whether the page output being sent to the browser is buffered.

190 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

CacheControl Property

The CacheControl property determines whether a proxy server can cache the Active Server Page.

Charset Property

The Charset property appends the name of the character set being used to the content-type header contained in the response object.

ContentType Property

The ContentType property specifies the HTTP content type/subtype for the response header.

Expires Property

The Expires property specifies the length of time in minutes until a cached page on the browser expires.

191 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ExpiresAbsolute Property

The ExpiresAbsolute property specifies a date and time when a cached page on the browser will expire.

IsClientConnected Property Modified in version 3.0

The IsClientConnected property indicates whether the browser has disconnected from the server since the last Response.Write.

PICS Property

The PICS property specifies the value of a PICS rating label for a document or a site.

Status Property

The Status property specifies the value of the status line returned by the server.

192 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

COLLECTION PROPERTIES

Cookies Collection Property

The Cookies collection property allows you to add a cookie to a browser and add values to the cookie.

METHODS

AddHeader Name, Value Method

The AddHeader method adds a new named HTTP header with a specific value to the response.

193 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

AppendToLog (String) Method

The AppendToLog method adds a string to the end of an entry in the Web server log for this request.

BinaryWrite (Data) Method

The BinaryWrite method sends specific data to the current HTTP output without any character conversions.

Clear Method

The Clear method clears (erases) any buffered HTML outpu

End Method

194 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The End method causes the web server to stop processing the script and to return the current results without processing the rest of the file.

Flush Method

The Flush method sends the contents of the buffer.

Redirect (URL) Method

The Redirect method tries to connect the browser to a different URL.

195 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Write (variant) Method

The Write method sends any specified variant to the browser.

Server object

The Server object provides access to the utility functions of the server.

PROPERTY

196 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ScriptTimeout Property

The ScriptTimeout property is the amount of runtime in seconds for a script before it terminates.

METHODS

CreateObject (ObjectID) Method

The CreateObject method creates an instance of an object to use in an Active Server Page.

Execute (Path) Method Implemented in version 3.0

The Execute method allows you to call another ASP page from inside an ASP page. When the called ASP page completes its tasks, you are then returned to the calling ASP page.

GetLastError Method Implemented in version 3.0

197 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The GetLastError method returns an ASPError object that describes any pre-processing, runtime, or script compiling errors that occurred.

HTMLEncode (String) Method

The HTMLEncode method applies HTML syntax to a specified string of ASCII characters.

MapPath (Path) Method

The MapPath method maps a relative or virtual path to a physical path.

Transfer (Path) Method Implemented in version 3.0

The Transfer method allows you to transfer all of the state information for all of the built-in objects from one ASP page to another. Unlike the Execute method, when the ASP page that you have transferred to is finished, you do not return the original ASP page.

198 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

URLEncode (String) Method

The URLEncode method applies URL rules to a specified string of ASCII characters.

Session Object

Session object is assigned to the user and it is used to store, share, and retrieve information concerning the user session. By default, the Session object is destroyed after a session has been idle for twenty minutes.

PROPERTIES

CodePage Property

The CodePage property specifies the server codepage that will be used to display dynamic content.

199 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

LCID Property

The LCID property specifies the location identifier that will be used to display dynamic content.

SessionID Property

The SessionID property returns the unique identifier for a user session.

Timeout Property

The Timeout property is the length of time in minutes before an idle session is terminated.

COLLECTION PROPERTIES

200 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Contents Collection Property

The Contents collection property contains all of the items that have been created and added to the Session object through script commands, rather than using the HTML <OBJECT> tag.

StaticObjects Collection Property

The StaticObjects collection property contains all of the items created in the Global.asa file using the HTML <OBJECT> tag within the scope of the Session object.

METHODS

Abandon Method

The Abandon method terminates a user session, destroys all data and objects in the current Session object, and releases its resources.

201 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Contents.Remove Method Implemented in version 3.0

The Contents.Remove method is used to remove a single item from a Contents collection.

Contents.RemoveAll Method Implemented in version 3.0

The Contents.RemoveAll method is used to remove all items from a Contents collection.

EVENTS

OnEnd Event

The OnEnd event occurs when the Session quits. The signal of this event will run a handler script in the Global.asa file, if the script exists.

OnStart Event

202 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The OnStart event occurs before the start of any new Session by a user. The signal of this event will run a handler script in the Global.asa file, if the script exists.

* What are the data type in ASP?

What are the VBScript Data Types?

VBScript has only one data type and it's called a Variant. A Variant is a special kind of data type that can contain different kinds of information, depending on how it's used. Because Variant is the only data type in VBScript, it's also the data type returned by all functions in VBScript.

203 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

At its simplest, a Variant can contain either numeric or string information. A Variant behaves as a number when you're using it in a numeric context and as a string when you use it in a string context. That is, if you're working with data that looks like numbers, VBScript assumes that it is numbers and does the thing that is most appropriate for numbers. Of course, you can always make numbers behave as strings, by enclosing them in quotation marks. Similarly, if you're working with data that can only be string data, VBScript treats it as string data.

Beyond the simple numeric or string classifications, a Variant can make further distinctions about the specific nature of numeric information. For example, you can have numeric information that represents a date or a time. When used with other date or time data, the result is always expressed as a date or a time. Of course, you can also have a rich variety of numeric information ranging in size from Boolean values to huge floating-point numbers. These different categories of information that can be contained in a Variant are called subtypes. Most of the time, you can just put the kind of data you want in a Variant and it behaves in a way that is most appropriate for the data it contains.

The following table shows the various subtypes of data that a Variant can contain.

204 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Subtype

Description

Empty Variant is uninitialized. Value is either 0 for numeric variables or a zero-length string ("") for string variables.

Null

Variant intentionally contains no valid data.

Boolean

Contains either True or False.

Byte

Contains integer in the range 0 to 255.

Integer

Contains integer in the range -32,768 to 32,767.

Currency

-922,337,203,685,477.5808 to 922,337,203,685,477.5807.

Long Contains integer in the range -2,147,483,648 to 2,147,483,647.

Single Contains a single-precision, floating-point number in the range -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values.

205 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Double Contains a double-precision, floating-point number in the range -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values.

Date (Time) Contains a number that represents a date between January 1, 100 to December 31, 9999.

String Contains a variable-length string that can be up to approximately 2 billion characters in length.

Object Contains an object.

Error Contains an error number.

If you want to convert from one subtype to another, there is a rich set of conversion functions you can use. In addition, the VarType function returns information about how your data is stored within a Variant.

206 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* Are vbscript, vb strongly typed languages?

1. A language is strongly typed if type annotations are associated with variable names, rather than with values. If types are attached to values, it is weakly typed.

2. A language is strongly typed if it contains compile-time checks for type constraint violations. If checking is deferred to run time, it is weakly typed.

3. A language is strongly typed if there are compile-time or run-time checks for type constraint violations. If no checking is done, it is weakly typed.

4. A language is strongly typed if conversions between different types are forbidden. If such conversions are allowed, it is weakly typed.

5. A language is strongly typed if conversions between different types must be indicated explicitly. If implicit conversions are performed, it is weakly typed.

6. A language is strongly typed if there is no language-level way to disable or evade the type system. If there are casts or other type-evasive mechanisms, it is weakly typed.

7. A language is strongly typed if it has a complex, fine-grained type system with compound types. If it has only a few types, or only scalar types, it is weakly typed.

207 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

8. A language is strongly typed if the type of its data objects is fixed and does not vary over the lifetime of the object. If the type of a datum can change, the language is weakly typed.

VbScript is not strongly typed but VB is .

* How can you pass values between two pages in asp?

Using GET and POST

208 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* How do you make ASP applications secure.

Active Server Pages is a component of Internet Information Server, and thus uses Windows NT Security. ASP files can be easily restricted to just certain users through secure Windows NT authentication, basic Web authentication, or client-side certificates. For additional security, all client-to-server communications can be secured with Secure Sockets Layer (SSL).

* Suppose you have an application for credit card validation. What steps will you take to restrict unauthorized users from using the application

SSL

* Write the code snippet for fetching data from a table and populating in a list box control of an asp page.

Open ADO connection and go thru the table and keep in a variable and assign to the listbox

* HTML and DHTML

209 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* Say you are designing a product page the products list is constant? How will you design this page? (will you go to db each time to retrieve the list of products for each user?)

Session

* Similarly how will you store user orders ?

Session

* How will you manage user session in a web-farm scenario?

Using Database

210 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* Performance tuning ASP applications

ASP Page Performance

Are you storing Visual Basic objects in Session or Application scope?

Visual Basic and other Single-Threaded Apartment (STA) objects should be used only at page scope. Storing STAs in a Session variable locks the object down to the thread that created the object, defeating the purpose of a thread pool. Storing an STA in Application scope serializes access for all users.

211 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Are you storing the Scripting.Dictionary in Session or Application scope?

The Scripting.Dictionary is Apartment threaded and should be used only at page scope, or your application will suffer serious serialization issues . This limitation usually raises the question of what dictionaries can be used at Session or Application scope. Options are somewhat limited, but include the Commerce Dictionary and the LookupTable Object.

Are your ASP scripts hundreds of lines long?

Script is interpreted line by line, so eliminating redundant script or creating more efficient script can improve performance. If you have hundreds of lines of ASP script in a single page, perhaps you can better partition your user, business, and data services.

Are your #include files too big?

There are no hard and fast rules for include-file sizes, but knowing how includes work can help you gauge whether you are using them efficiently. When ASP processes includes, it reads the entire file into memory. Because ASP will cache the entire expanded code (your page + the

212 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

include), not just the functions you call, you may end up with large, inefficient namespaces that ASP must search when calling methods or looking up variables. Note that this process occurs for each page that uses the include. A good guide is to create fine-grained includes, so that you can be more selective about which pages will include them

Are you using global variables?

Global variables increase the namespace used by ASP to retrieve values from memory. Variables declared within subroutines or functions are faster.

Does your script excessively intersperse ASP and HTML?

Keep blocks of ASP server-side script together, rather than switching back and forth between server-side and client-side code. This switching usually happens when concatenating HTML with simple values from ASP, as when you are writing out an HTML table:

Are you buffering output?

Buffering is on by default in Windows 2000, but may be off if you've upgraded from Internet Information Server (IIS) 4.0.

When buffering is on, ASP will wait until processing is complete before sending down the response, reducing network roundtrips and server-processing delays. When buffering is off, ASP waits for TCP acknowledgements from clients, which can really hurt performance,

213 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

particularly over slow connections.

Note that while buffering may improve throughput, it may reduce perceived performance. If perceived performance is an issue, you can turn off buffering with Response.Buffer = False or you can call Response.Flush.

Are you using Session state?

ASP Sessions are a convenient facility, but they limit scalability. Sessions limit the scalability of a single box because they consume resources for each user. While Session size is largely determined by what you stuff into the Session variable, the real cost is resource contention. Sessions also limit your application's ability to scale out across multiple machines, because each Session is Web-server specific.

214 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Have you disabled Session state if you aren't using it?

If the application doesn't rely on Sessions, disable Session state for the Web or virtual directory through the ISM (Internet Services Manager). Disabling Session state allows ASP to skip an extensive amount of source code, reducing overhead

Are you using some form of caching for data?

Caching is one of the most difficult aspects of Web application development, because it threatens the scalability of your application. Determining what to cache is based on data volatility and scope. Data that is static or used application-wide can be a good candidate for caching. Data that changes frequently or is user-specific would not be a good candidate.

Determining where in your application you should cache your data is based on your application goals, and you need to know the trade-offs. For example, caching an ActiveX Data Objects (ADO) Recordset offers flexibility, because you can still grab an array or save the recordset as XML. However, if your application will be rendering the same HTML repeatedly, such as to display a list box of countries, you might cache the HTML string in Application scope, rather than just the data

Are you redimensioning arrays?

It is generally more expensive to redimension arrays than it is to grab more than you need up front. Redimensioning arrays requires Visual Basic Scripting Edition (VBScript) to allocate space for the new array -- and, if you've used the Preserve modifier to preserve the contents of the array, to copy the data from the old array into the new. This means that not only are you

215 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

spending extra processor cycles to redimension the array, but also that the process initially requires twice as much memory for the copy. However, if you allocate more space than you need initially (you need only five elements initially, but allocate space for 128), then adding more data to the array requires VBScript to insert only the new values into the existing array.

Are you using multiple languages on a page?

Multiple languages on a given page mean multiple script engines for that page. Script engines use Thread Local Storage (TLS), so multiple threads cannot use an instance of a script engine concurrently. Therefore, five simultaneous requests to the same page will cause ASP to instantiate five script engines. More engines means more overhead, so you may be able to gain some performance by limiting your number of languages used on a given page.

Are you checking Response.IsClientConnected before processing long routines?

By testing Response.IsClientConnected your application can avoid wasting CPU cycles by quitting methods if the client is no longer connected. Note that IIS 5.0 overcomes a limitation in IIS 4.0 (the need to send content to the browser before checking the property).

Are you using Server.MapPath unnecessarily?

216 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

When you request Server.MapPath, you are generating an additional request for the server to process. To improve performance, replace Server.MapPath with a fully qualified path when deploying your Web site.

Are you parsing strings?

Use regular expressions in validation routines, in formatting functions, and instead of looping through strings

Are you using the same object many times?

VBScript 5.0 provides the With statement. The With statement allows you to execute a series of statements on a specific object without requalifying the name of the object

Does the global.asa contain empty Session_OnStart or Session_OnEnd methods?

Stripping out empty Session events reduces the amount of source code that ASP must traverse, and improves performance

Component Performance

217 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Are you storing your objects in Session or Application scope?

Storing references to objects in ASP's Session or Application scope will cause many performance and scalability issues if those objects aren't designed to be shared across threads or activities. Only agile components -- or, in Windows 2000, components marked Neutral -- can be referenced in Session or Application variables with direct access by client threads

Are you using SQL Server for your middle-tier cache?

If you need to cache data that is read frequently and seldom updated in the middle-tier, use SQL Server rather than a roll-your-own solution. SQL Server provides high-performance middle-tier caching

Are you concatenating strings in components?

Use fixed-length strings in Visual Basic for string concatenation. Don't just keep adding to a string, or you'll reallocate it multiple times -- and reallocation is expensive.

218 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Are you using transactions when you don't need to?

Transactions provide a service -- and that service can add a performance hit. Evaluate whether methods actually need transactions. For example, if you're grabbing a recordset to hand off to a browser client for reading data, you don't need a transaction. By factoring out operations that read data into separate components from operations that perform updates, you have more flexibility in marking your components for transactions.

Are you calling SetComplete/SetAbort in each method?

Calling SetComplete and SetAbort in each method of your Microsoft Transaction Server (MTS) components will release resources earlier, and will ensure that a component does not live outside the scope of its transaction. In Windows 2000, COM+ provides the setting 'Automatically deactivate this object when this method returns,' which performs the equivalent code. You can enable this setting on a per-method basis in the Component Services console.

Are you crossing processes effectively?

219 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Minimizing marshaling overhead and reducing network calls are keys to improving performance of distributed applications. Use early binding in your components to minimize expensive network round trips by eliminating the extra call to GetIdsOfNames that late binding incurs. You can further reduce network trips by bundling your parameters into arguments for method calls, instead of setting a bunch of properties individually. Rather than pass parameters ByRef, pass ByVal where you can to minimize marshaling overhead.

Data Access Performance

Are you using indexes in your database?

Indexes provide immediate impact on your application's performance. Poor indexes will slow your application to a crawl, while good indexes will help optimize your application's performance.

Are you calling stored procedures rather than dynamic SQL?

Using stored procedures prevents your database from having to recompile your SQL statements repeatedly. Use stored procedures or parameterized SQL strings.

Are you returning just the required data?

Check your SELECT statements to ensure that you're returning only the required columns and only the necessary rows. If you have queries that can potentially return a lot of records, consider paging through your recordsets.

220 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Are you storing ADO connection in Session or Application scope?

This defeats the purpose of connection pooling and creates resource contention. Create connection at page scope or within the functions that need them, and set the connections to nothing to free the connection back to the pool.

Are you explicitly closing Recordset and Connection variables?

Recordsets need to be closed if they are going to be reused (but reusing recordsets is discouraged). Closing Connection variables as soon as you can releases them back to the pool, so that they can be pooled for reuse. It is always good practice to explicitly close your object variables.

Are you reusing Recordset and Command variables?

Create new Recordset and Command variables rather than reusing existing ones. This won't necessarily improve your application's performance but it will make your application more reliable and easier to maintain.

Are you disconnecting the recordsets?

Disconnecting recordsets frees the Connection object back to the pool, allowing the Connection to be closed and reused sooner.

Are you using the right cursor and lock-type for the job?

221 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Use "Firehose" (forward-only, read-only) cursors when you need to make a single pass through the data. Firehose cursors, the default in ADO, provide the fastest performance and have the least amount of overhead.

Are you using DSN-less connections?

In general, DSN-less connections are faster than System DSNs (data source names), which are faster than File DSNs.

IIS Settings

Is ASP debugging enabled?

Check the ISM. If ASP debugging is enabled, the application is locked down to a single thread of execution

Are you using SSL?

Secure Sockets Layer (SSL) is expensive in terms of bandwidth and CPU usage. If you're using SSL, it's because of security needs. Your best bet is to restrict SSL usage to where you need it, and keep the pages simple.

Is ASP configured to have enough threads/script engines

222 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ASP Performance Improvement:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnserv/html/server03272000.asp

223 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

VB & COM

* What is late binding and early binding?

There are two ways to use Automation (or OLE Automation) to programmatically control another application.

Late binding uses CreateObject to create and instance of the application object, which you can then control. For example, to create a new instance of Excel using late binding:

224 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Dim oXL As Object

Set oXL = CreateObject("Excel.Application")

On the other hand, to manipulate an existing instance of Excel (if Excel is already open) you would use GetObject (regardless whether you're using early or late binding):

Dim oXL As Object

Set oXL = GetObject(, "Excel.Application")

To use early binding, you first need to set a reference in your project to the application you want to manipulate. In the VB Editor of any Office application, or in VB itself, you do this by selecting Tools + References, and selecting the application you want from the list (e.g. Microsoft Excel 8.0 Object Library).

To create a new instance of Excel using early binding:

Dim oXL As Excel.Application

225 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Set oXL = New Excel.Application

In either case, incidentally, you can first try to get an existing instance of Excel, and if that returns an error, you can create a new instance in your error handler.

* What are the various ways in which you instantiate an object in VB?

CreateObject, GetObject, New,

* What are the threading models that you can choose in VB? Which one will you recommend and why?

In Visual Basic, apartment-model threading is used to provide thread safety. In apartment-model threading, each thread is like an apartment all objects created on the thread live in this apartment, and are unaware of objects in other apartments.

226 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Visual Basics implementation of apartment-model threading eliminates conflicts in accessing global data from multiple threads by giving each apartment its own copy of global data

* Can you store a VB object in ASP session variable? Is it recommended? Why not?

Storing references to objects in ASP's Session or Application scope will cause many performance and scalability issues if those objects aren't designed to be shared across threads or activities. Only agile components -- or, in Windows 2000, components marked Neutral -- can be referenced in Session or Application variables with direct access by client threads

* Compatibility settings in vb?

227 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

When an ActiveX component is compiled, there are three possible project compatibility settings:

No Compatibility

Project Compatibility

Binary Compatibility

No Compatibility

With this setting, new class IDs, new interface IDs and a new type library ID will be generated by VB each time the ActiveX component project is compiled. This will cause any compiled client components to fail (with error 429!) and report a missing reference to the 'VB ActiveX Test Component' when a client project is loaded in the VB IDE.

TIP: Use this setting to compile the initial release of a component to other developers.

Project Compatibility

228 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

With this setting, VB will generate new interface IDs for classes whose interfaces have changed, but will not change the class IDs or the type library ID. This will still cause any compiled client components to fail (with error 429!) but will not report a missing reference to the 'VB ActiveX Test Component' when a client project is loaded in the VB IDE. Recompilation of client components will restore them to working order again.

TIP: Use this setting during the initial development and testing of a component within the IDE and before the component is released to other developers.

Binary Compatibility

VB makes it possible to extend an existing class or interface by adding new methods and properties etc. and yet still retain binary compatibility. It can do this, because it silently creates a new interface ID for the extended interface and adds registration code to register the original interface ID but with a new Forward key containing the value of this new interface ID. COM will then substitute calls having the old ID with the new ID and hence applications built against the old interface will continue to work (assuming the inner workings of the component remain backward compatible!).

229 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

With this setting, VB will not change any of the existing class, interface or type library IDs, however in order that it can do so, VB requires the project to specify an existing compiled version that it can compare against to ensure that existing interfaces have not been broken.

TIP: Use this setting following the release of a component to other developers.

Breaking Compatibility

When the need to break compatibility arises, be sure to tackle it head on and make a clean break. To do so, create a new version of the project with compatibility set to 'No Compatibility'. Next, change the project 'Name' attribute and compile to a different component name. Taking this approach ensures that existing applications can continue to work with the old component while new versions can use the new component.

230 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Working With Binary Compatibility And Avoiding Error 429

The first time an ActiveX component is built for release then the 'No Compatibility' setting should be selected thereby causing new class, interface and type library IDs to be generated. (Only use 'Project Compatibility' during the initial development of a component within the IDE and before releasing the component to other developers.)

A copy of the released component should then be placed into a sub-folder (preferably named 'Compat') beneath the project folder and the compatibility setting changed to 'Binary Compatible' with the compatible image being set to the component in the 'Compat' sub-folder.

The following rules ensure binary compatibility is maintained:

231 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The name of the project cannot change.

The names of any public classes cannot change.

The names of any public methods or properties cannot change.

The number of parameters to any public method cannot change.

The data types of the parameters cannot change.

The calling convention (ByRef, ByVal) of the parameters cannot change.

The names of public enums cannot change.

The order/values of elements in public enums cannot change.

The names of public user-defined types cannot change.

The names and data types of elements in public user-defined types cannot change.

If a public class implements user-defined interfaces then the 'Implements' statement cannot change.

Whenever the component is amended, always update the component's version information to

232 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

allow different versions to be correctly distinguished. You should also update the compatible image in the 'Compat' folder with the latest compiled component binary once the component has been successfully tested and released to other developers. It is a good habit to do this even when interfaces remain unchanged.

* How do you handle errors in VB?

On Error GoTo line

Enables the error-handling routine that starts at line specified in the required line argument. The line argument is any line label or line number. If a run-time error occurs, control branches to line, making the error handler active. The specified line must be in the same procedure as the On

233 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Error statement; otherwise, a compile-time error occurs.

On Error Resume Next

Specifies that when a run-time error occurs, control goes to the statement immediately following the statement where the error occurred where execution continues. Use this form rather than On Error GoTo when accessing objects

* Question on on error goto 0?

Disables any enabled error handler in the current procedure.

* How are structures implemented in VB?

Type

End Type

234 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* What is the necessity for Resume Next?

On Error Resume Next causes execution to continue with the statement immediately following the statement that caused the run-time error, or with the statement immediately following the most recent call out of the procedure containing the On Error Resume Next statement. This statement allows execution to continue despite a run-time error. You can place the error-handling routine where the error would occur, rather than transferring control to another location within the procedure. An On Error Resume Next statement becomes inactive when another procedure is called, so you should execute an On Error Resume Next statement in each called routine if you want inline error handling within that routine.

* what is the difference between activex exe and activex dll?

ActiveX Exe runs in another process than the calling app; an ActiveX DLL runs in the same process.

If Calling app ends. Reference to the ActiveX DLL has gone, and the instance of the Dll should be destroyed, automatically.

235 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

On the other hand, an instance of the ActiveX Exe would still run when the calling app ends, as it runs in a seperate process.

* ActiveX.exe example.

Winword.exe, Dllhost.exe

* what is COMInterop?

236 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* Question on Tlbimp,Tlbexp and other tools?

Most COM components will work with ASP.NET. As with previous versions of ASP, you can still make late-bound calls to your components using Server.CreateObject.

While late binding to components is still supported, early binding is a better choice for performance reasons. A utility named the Type Library Importer (TlbImp), included with the .NET Framework SDK in the file Tlbimp.exe, converts standard COM components in DLL files to equivalent .NET Framework assemblies by building managed wrappers around the components. The converted components can be early-bound to managed code for greatly increased performance

Once the COM component is converted to a .NET assembly, you can import it into an ASP.NET page by placing a directive at the top of the page. For example, the following directive imports the namespace MyNewNamespace, which was created by the Tlbimp utility:

<%@Import Namespace="MyNewNamespace"%>

237 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The assembly file generated by Tlbimp.exe must be placed in the ASP.NET application's bin directory. The original COM component file must be registered for the directory in which it resides.

When using single-threaded (STA) COM components, such as components developed using Visual Basic, from an ASP.NET page, you must include the compatibility attribute aspcompat=true in an <%@ Page > tag on the ASP.NET page. For example:

<%@Page aspcompat=true Language = VB%>

The aspcompat attribute forces the page to execute in STA mode. The runtime throws an exception if the compatibility tag is omitted and an STA component is referenced on the page. If you convert the STA component to an assembly using TlbImp, the runtime does not detect that the component uses the STA model and does not throw an exception, but your application can suffer from poor performance and possible deadlocks. STA components cannot be used from .NET Framework code modules (compiled .NET assemblies); they can be used only from ASP.NET pages.

238 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* What is the difference between COM and DCOM?

COM is the general term (Component Object Model). It is a general term that represents all objects that follow this modle.

DCOM is just Distributed COM . It is really just a COM object that may be located on another machine on a network or even over the internet. The idea is, you dont need the COM object on your machine to run...you can have it run from another location and still use it.

COM+ really refers to another package that encapsulates COM. COM + provides means of providing security to your COM objects (only certain people can access them) and allowing them to participate in transactions with other programs/COM Objects.

239 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* Question on iunknown interface and methods

The IUnknown interface lets clients get pointers to other interfaces on a given object through the QueryInterface method, and manage the existence of the object through the IUnknown::AddRef and IUnknown::Release methods. All other COM interfaces are inherited, directly or indirectly, from IUnknown. Therefore, the three methods in IUnknown are the first entries in the VTable for every interface.

240 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

* What is the default interface for any COM component?

IUnknown is the fundamental interface in COM.

241 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* What is IDispatch?

Interface that exposes objects, methods and properties to programming tools and applications that support automation

IDispatch Methods

Description

GetTypeInfoCount

Retrieves the number of type information interfaces that an object provides (either 0 or 1).

GetTypeInfo

Gets the type information for an object.

242 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

GetIDsOfNames

Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs.

Invoke

Provides access to properties and methods exposed by an object.

IIS threading and State Management: http://www.microsoft.com/mind/0299/basics/basics0299.asp

Problem with using Global vars in VB components developed for Web Apps:

http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0598/activex0598.htm&nav=/msj/05 98/newnav.htm

Interruptible Async tasks:

243 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

http://www.vbug.co.uk/vbug99/multithread.doc

General Threading:

http://www.devarticles.com/art/1/182/2

Glossary of COM/DCOM:

http://www.innovatia.com/software/papers/com.htm

244 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Changes in VB.Net

ASP.NET does not support Visual Basic Scripting Edition (VBScript), but it does support Visual Basic .NET, which is very similar to VBScript. However, most existing ASP pages that contain VBScript will still have to be rewritten to some extent to run under ASP.NET.

Specific Visual Basic changes that might affect existing ASP pages containing VBScript include changes to Visual Basic syntax and changes in the threading model.

Visual Basic Syntax

The following list describes specific changes in Visual Basic .NET that may require changes to existing Visual Basic or VBScript applications.

The data type Variant no longer exists. It has been replaced with the type Object. Object types must be explicitly cast to other primitive data types.

Parentheses are now required around the parameter list in all method calls, even for methods that do not take parameters. For example:

245 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

If Flag = False Then

DisplayMessage()

End If

By default, arguments are passed by value, not by reference as in previous versions of Visual Basic. If you want to pass arguments by reference, you must use the ByRef keyword in front of the argument, as in the following example:

Call MyFunction(argbyvalue, ByRef argbyref)

Set and Let are no longer supported. Objects can be assigned by a simple assignment operation:

Object1 = Object2

To set a default property of an object, you must now explicitly reference the property. For

246 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

example:

Object1.Name = Object2.Name

Most objects no longer have default properties. All nonindexed properties must be explicitly referenced. In previous versions of Visual Basic, if you wanted to access the default property of an object, specifying the name of the property was optional. For example, if you wanted to access the Text property of a TextBox control, you could use the following code:

Dim str As String = TextBox1

Using Visual Basic .NET, the above code must be modified as follows:

Dim str As String = TextBox1.Text

As another example, you must explicitly reference the Value property of the Field object when retrieving fields from a Recordset (RS in the following example):

Response.Write (RS("au_fname").Value)

Indexed default properties are still supported, however. The Fields property, a default collection property of the Recordset, does not have to be explicitly referenced because it is an indexed property and the argument provides sufficient information to the compiler to evaluate the expression. The preceding line of code is functionally equivalent to the following line:

Response.Write (RS.Fields("au_fname").Value)

247 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The Integer data type is now 32 bits; the Long data type is 64 bits.

Multipart Boolean expressions are short-circuited. If the first part of a multiple AND expression evaluates to False, evaluation of the expression terminates and the entire expression returns False. If the first part of a multiple OR expression evaluates to True, evaluation terminates and the entire expression returns True.

Data types should always be explicitly cast to other data types. For instance, always cast numerical values to String if a string is expected:

Response.Write("The count is " & CStr(count))

Variables created within the same Dim statement will be of the same type. For example, in Visual Basic .NET, the Dim statement Dim i, j, k As Integer creates each of the three objects (i, j, and k) as an Integer. Previous versions of Visual Basic would create i and j as Variants and k as an Integer.

Class property syntax has changed and no longer includes Property Let, Property Get, and Property Set. The new property syntax is similar to that in C#.

[Visual Basic]

Public Property ThisProperty As String

Get

ThisProperty = InternalValue

248 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

End Get

Set

InternalValue = value

End Set

End Property

Spaces must always be included around the & operator when concatenating strings. VBScript allowed you to write a&b&c; in Visual Basic. NET this must be written as a & b & c to avoid a syntax error.

All If statements must be constructed on multiple lines. With VBScript, it was possible to write a single-line If statement such as If x Then y. In Visual Basic .NET, this must be written as follows:

If x Then

End if

249 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Option Explicit is on by default, so all variables must be declared before they can be used.

Importing a Type Library as an Assembly

COM type definitions usually reside in a type library. In contrast, CLS-compliant compilers produce type metadata in an assembly. The two sources of type information are quite different. This topic describes techniques for generating metadata from a type library. The resulting assembly is called an interop assembly.

When available, always use the primary interop assembly published by the author of the COM component you intend to incorporate in your managed code. Types in the primary interop assembly have been imported for you and are ready to activate and call from managed code.

Generating Metadata

250 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

COM type libraries can be standalone TLB files, such as Loanlib.tlb. Some type libraries are embedded in the resource section of a DLL or EXE file. Other sources of type-library information are OLB and OCX files.

After locating the type library containing the implementation of your target COM type, you have the options described in the following table for generating an interop assembly containing type metadata.

Option Description

Visual Studio .NET

Automatically converts COM types in a type library to metadata in an assembly.

251 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Type Library Importer

Provides command-line switches to adjust metadata in the resulting interop file, imports types from an existing type library, and generates an interop assembly and a namespace.

TypeLibConverter Class

Exposes methods that perform conversion-related actions. Can convert in-memory type library information to metadata.

Custom Wrappers

As a less-desirable option, you can create type definitions from scratch. Requires advanced programming skills.

For details about the COM interop import process, see Type Library to Assembly Conversion Summary.

252 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Visual Studio .NET

Visual Studio .NET generates an interop assembly containing metadata when you add a reference to a given type library.

To add a reference to a type library

1. Install the COM DLL or EXE file on your computer, unless a Windows Setup.exe performs the installation for you.

2.

From the Project menu, select References.

3.

Select the COM tab.

4.

Select the type library from the Available References list, or browse for the TLB file.

5.

Click OK.

Type Library Importer

The Type Library Importer (Tlbimp.exe) is a command-line tool that converts the coclasses and interfaces contained in a COM type library to metadata. This tool creates an interop assembly and namespace for the type information automatically. After the metadata of a class is available, managed clients can create instances of the COM type and call its methods, just as if it were a .NET instance. Tlbimp.exe converts an entire type library to metadata at once and cannot generate type information for a subset of the types defined in a type library.

253 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

To generate an interop assembly from a type library

Use the following command to produce the Loanlib.dll assembly in the Loanlib namespace.

c:>tlbimp Loanlib.dll

Adding the /out: switch produces an interop assembly with an altered name, such as LOANLib.dll. Altering the interop assembly name can help distinguish it from the original COM DLL and prevent problems that can occur from having duplicate names.

c:>tlbimp LoanLib.dll /out: LOANLib.dll

TypeLibConverter Class

254 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The TypeLibConverter Class (in the System.Runtime.InteropServices namespace) provides methods to convert coclasses and interfaces in a type library to metadata within an assembly. This API produces the same metadata output as Tlbimp.exe. However, unlike Tlbimp.exe, the TypeLibConverter class can convert an in-memory type library to metadata.

Custom Wrappers

When a type library is unavailable or incorrect, one option is to create a duplicate definition of the class or interface in managed source code. You then compile the source code with a compiler that targets the runtime to produce metadata in an assembly.

To define COM types manually, you must have access to the following items:

Precise descriptions of the coclasses and interfaces being defined.

A compiler, such as the C# compiler, that can generate the appropriate .NET Framework class definitions.

Knowledge of the type library-to-assembly conversion rules.

Writing a custom wrapper is an advanced technique that you seldom perform. For additional information on generating a custom wrapper, see the Customizing Standard Wrappers topic.

255 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

What is operator overloading?

Operator overloading enables developers to define new struct types that behave much like the predefined value types. For instance, a Digit struct can support the same mathematical operations as the predefined integral types, and can define conversions between Digit and predefined types. The predefined types employ operator overloading themselves.

The following are the points to be remembered when using operator overloading

1. Only the operators mentioned in the list can be overloaded, other operators like new, typeof, sizeof etc. cannot be overloaded.

2.

Operator overloading methods cannot return void.

3. At least one of the parameters for the operator overloading method should be the class for which the operator overloading is defined.

256 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

4. User defined operator implementations are given preference over predefined implementations.

5. When an arithmetic operator is overloaded it implicitly overloads the corresponding assignment operator. For example if we overload the "+" operator it implicitly overloads the "+=" operator.

6.

Operator overloading methods should be declared as both public and static.

7. Comparison operators should be overloaded only in pairs. (i.e.) if < is overloaded then > should also overloaded.

Why is finally block used?

Why is the namespace System.collection used?

257 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Diff b/w Array and Arraylist?

What is a Destructor ?

Ans : A destructor is a member that implements the actions required to destruct an instance of a class. Destructors cannot have parameters, cannot have accessibility modifiers, and cannot be called explicitly. The destructor for an instance is called automatically during garbage collection.

What is a instance constructor?

Ans : An instance constructor is a member that implements the actions required to initialize an instance of a class.

What is a Static Constructor?

A static constructor is used to initialize a class and is called automatically to initialize the class before the static members are accessed.

258 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

A static constructor is only called once throughout the application's lifetime. The static constructor method is called when any of the defining class' members are first accessed. The constructor is called once only

cannot have parameters,

cannot have accessibility modifiers,

and cannot be called explicitly.

The static constructor for a class is called automatically.

What is static Readonly fields ?

Ans : Static fields are not a perfect match for this scenario. The fields are initialized at some point before they are used, but after this initialization there is nothing to stop a client from changing them. Such a modification could cause unpredictable errors in other programs that use Color and assume that the values do not change. Readonly fields can be used to prevent such problems.

259 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Assignments to a readonly field can only occur as part of the declaration,

or in an instance or static constructor in the same class.

A static readonly field can be assigned in a static constructor,

and a non-static readonly field can be assigned in an instance constructor.

Thus, the Color class can be enhanced by adding the readonly modifier to the static fields:

class Color

internal ushort redPart;

internal ushort bluePart;

internal ushort greenPart;

260 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

public Color(ushort red, ushort blue, ushort green) {

redPart = red;

bluePart = blue;

greenPart = green;

public static readonly Color Red = new Color(0xFF, 0, 0);

public static readonly Color Blue = new Color(0, 0xFF, 0);

public static readonly Color Green = new Color(0, 0, 0xFF);

public static readonly Color White = new Color(0xFF, 0xFF, 0xFF);

261 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

What is a constant?

Ans : A constant is a class member that represents a constant value:

a value that can be computed at compile-time.

Constants are permitted to depend on other constants within the same program as long as there are no circular dependencies.

The rules governing constant expressions are defined in constant expression

The example

262 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

class Constants

public const int A = 1;

public const int B = A + 1;

shows a class named Constants that has two public constants.

Even though constants are considered static members, a constant declaration neither requires nor allows the static modifier. Constants can be accessed through the class, as in

class Test

static void Main() {

Console.WriteLine("{0}, {1}", Constants.A, Constants.B);

263 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

which prints out the values of Constants.A and Constants.B.

What is a method?

Ans : A method is a member that implements a computation or action that can be performed by an object or class. Methods have a list of formal parameters (which may be empty), a return value (or void), and are either static or non-static.

Static methods are accessed through the class.

Non-static methods, which are also called instance methods, are accessed through instances of the class.

264 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Methods can be overloaded, which means that multiple methods may have the same name so long as they have unique signatures.

The signature of a method consists of the name of the method and the number, modifiers, and types of its formal parameters.

The signature of a method does not include the return type.

What is a Property ?

265 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Ans : A property is a member that provides access to a characteristic

of an object or a class.

Examples of properties include the length of a string, the size of a font,

the caption of a window, the name of a customer, and so on.

Properties are a natural extension of fields.

Both are named members with associated types, and the syntax for accessing fields and properties is the same. However, unlike fields, properties do not denote storage locations.

Instead, properties have accessors that specify the statements to be executed when their values are read or written.

What r delegates and events?

Ans : It suffices to simply state that a delegate is the object-oriented (and type-safe) equivalent of a function pointer.

A delegate instance holds a reference to an instance or class method, permitting anonymous

266 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

invocation of the bound method.

Events are special constructs declared on a class that help to expose state changes to interested objects at run time.

An event represents a formal abstraction (supported by the CLR and various compilers)

of the registration, unregistration, and notification methods we used previously to implement the Observer pattern.

Delegates are registered with specific events at run time.

When the event is raised, all registered delegates are invoked so that they receive notification of the event.

1)What is xmldatadocument and xmldocument

2)What is response.buffer

3)can i have multiple web.config files in the application

4)can i use javascript in the webservercontrols

267 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

5)how to access server variables inside javascript

6)what is the difff between htmlservercontrols and webservercontrols

7)how to configure smtp server for sending mails

8)can i use variable in the include file

9)what is the diff between server.transfer and response.redirect

10)how is the version is maintained in the assembly

11)how can i refer to an assembly with a different version

12)can i use action="a.exe" inside the form tag

13)can i use server.createobject(a.exe)

14)can i pass querystring in server.transfer

15)diff between server.transfer and server.execute

16)what is the step to be done before making an instance of excel file using server.createobject

268 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

17)what are type datasets

18)what is the difference between manifest and metadata

Database:

What are normalisation rules?

Types of joins and examples Join sql select statement.

Difference between types of joins

What is a cursor.

What is clustering

What is indexing

Types of indexes

269 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Given a problem and asked for database design

ASP:

Types of objects

Types of authentication

C#:

CLR features

270 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

CLS and CTS definitions

Assembley and dll differences

Private and shared assemblies differences

what are static constructors

Memory management

Remoting concept

Typrs of proxies in remoting

Type of protocols and channels and difference

Webservices concept

Difference between webservices and remoting

Assembly loading, signing, generating keys

271 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Java:

Diffrence between awt and swing

RMI concepts

What are EJB's

What are the feature's of application server

Multithreading concepts

Secutiry concepts, signing applets

272 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Oops:

Difference between abstract classes and interfaces (Descriptive answer with example)

Why interfaces are required

What is polymorphism

Different keywords and thier access types

static variables and static methos.

273 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Patterns:

Types of Patterns

Singlton Pattern implementation

Observer Pattern implementation

MVC Pattern implementation

UML:

274 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Usecase and class diagram concepts

xMLXSL:

What is sort?

sysntax of if,while and for loops in xsl

what is DTD?

what is xpath?

Advantages of oops?

what is inheritance,polymorphism?

275 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

advantages of asp.net over asp?

.net features?

what is normalisation?

advantages of normalisation?

what are design patterns?

what are attributes in .net?

ado.net architecture?

1)How to maintain transaction in asp and asp.net

2)how caching is done in asp and asp.net

3)what is the diff between disconnected recordset and dataset

4)what are the diff types of inheritance

276 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

5)name few of the abstract class in .net

6)how to maintain state in asp and asp.net

7)what is the best form of validation (server side and client side)

8)GAC what are the advantages and disadvantages

9)what is join like += and *=

10)what is the diff between sql 2000 and sql 7.0 in terms of triggers

11)what is magic table and temp table

12)Can u deploy .net assemblies in MTS

1)What is usercontrols?

2)Can we have dynamic usercontrols and can we pass values from the usercontrols to the aspx pages?

3)What is the diff between abstract class and interface

4)Can u use javascript in aspx

277 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

5)what is the diff between windows dll and com dll

6)Diff between asp and asp.net

7)Diff between having and where clause

8)Can i have mulitple global.asa files

9)Diff between machine.config and web.config

10)what is web.config

11)Types of parameters passed in c# methods

12)byref and byval

13)diff between repeater,datalist and datagrid

14)threading

15)can i have a connected dataset

278 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

16)why u need dataadpater

17)diff between servercontrols and htmlcontrols

18)what is response.end,response.clear and response.flush

19)what is diff between asp caching and asp.net caching

20)what is global assembly cache.how to put the components in the GAC and is there any steps before that

21)CLR,CTS and CLS

22)what are strongnames

23)what all u can pass in byval and byref

24)what is assembly

25)what is namespace and can we have nested namespace in a dll and where exactly the namespace is stored

26)what is the version control in .net

279 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

27)what is the disadvantage of using static

28)Apart from DOM how can u retreive records in XML

29)how to use com in .net and vice versa

30)oops,operator overloading(What happend when the return type is different and the signature is the same)

31)What is the difference between operator overloading and overiding

32)What is the namespace used for creating the collection object

33)can u force the garbage collector

34)can u use try without catch

35)how to create disconnected recordset in asp

36)what is the process flow of asp.net page

37)what is the problem of using server.transer

280 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

1)What is a stored procedure?

2) what are the advantages of stored procedure over normal queries?

3)How to improve the performanace on database layer?

4)What is a join?what is the difference between inner joins and outer joins?

ASP

281 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

1)what are the objects in ASP?

2)What is the use of ObjectContext object?

3)How to handle errors in ASP pages?

4)what are the ways on which we can access a COM component in an asp page?

COM/DCOM/COM+/MTS

282 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

1)What is COM? Explain the concepts of COM?

2)Waht is interface and iunknown in COM?

3) How does a client application interact with a COM component?

4)Waht is DCOM?How DCOM works?

5)Waht is COM+

6)Waht is MTS?How it handles components?

283 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

XML/Schema/XSL

1)what is xml/schema/xsl?

2)What is the use of XSL?

3)How is a variable declared in XSL?

.NET

1)what is an assembly?

2)What is the difference betweemn VB and VB.net?

284 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3)What is RCW and CCW?

4)What are the steps to be taken for porting a VB application to a VB.NET application?

1.

Draw .NET framework architecture?

2.

What CLR does?

3.

What is CTS?

4.

What is CLR?

5.

What are the presently available compilers of .NET (I know only JIT)

6.

What is Name Space?

8.

What is an Assembly?

285 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

9.

What is GAC?

10.

Tell me sequence of steps(commands) to put an assembly into GAC?

11.

What is storongly named assembly?

12.

Why should we make an assembly strong named?

13.

How can we maintain .dll files with the same name in same folder?

14.

What is resource file?

15.

I have a private assembly, cant I use outside my application?

16. I dont want to put an assembly in GAC. I put it in directory D:. How can I use it in multiple applications?

17.

What is metadata, what it consists?

18.

What is a delegate? way to implemente a functional pointer

19.

What is call back procedure?

286 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

20.

What is Interface?(set of abstract class)

21. What is difference between Interface & Delegate?(With out any hesitance, I told him...that these two are not at all comparable. Two are different concepts. He argued with me. I think I was right)

22.

Tell me about ASPX page life cycle.

23.

How do we maintain caches?

24.

Have you ever used validator controls?

25.

Tell me few validator controls?

26.

Explain how to use Custom validator control?

27.

What is an User Control?

28.

What is extension for user control in aspx? (answer: ASCX )

29. I have three different web applications. In all three I want to use same user control. Do I need to put .ASCX file in all applications? If no, where should I put?

30.

What is Custom control?

287 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

31. Is your own control in ASPX visible in Tool Box of Editor? (Answer: Yes, If we make custom control it will be visible by adding reference to it)

32.

What do you know about Web.Config file?

33.

What are types of Authentications?

34.

What other options we can set in web.Config file?

35. I have more than one application. All applications have same settings. So Do you want me to write WEB.Config file for each application? If NO, where do I need to put my WEB.COnfig file?

36. I dont want to place my WEB.Config in application path. I'll put it in some directory. Can I do this?

37. Explain how do you do Forms authentication? (I explained him all the code and Implementation)

38.

Do u know Passport authentication?

39.

What are types of securities we can provide through IIS.

40.

What is Global.asax file?

41.

What are the events present in the Global.asx file.

288 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

42.

Can I place Global.asax out side the application directory?

43. Can I write Code behind file for the WEb.Config?( Ready with Machine.Config and Security.Config files also. He may ask them. Because I explained them even he is not asked.)

44.

What is reflection?

45.

What is Web service?

46.

What is SOAP protocol?

47.

What is Serialization?

48.

What are types of serializations?

49.

Draw a diagram to tell how WEB service works?

50. Are U comfortable with XML?(I said yes. He not asked me any further regarding XML. Anyway prepare basics.)

51.

Draw ADO.NET architecture?

52.

What is the other name space we use connect to other databases? (Oledb)

289 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

53. Write Connection string for SQLConnection object.(remember --> Dont write Provider in the conn string)

54.

What do you know about remoting?

55.

What is the role of Web Service in remoting?

56. U worked for 3 years on MS Tech. How confident u r in MTS? ( I said , I Used it but I dont have theoritcal knowledge. I used it in ASP applications to register a DLL)

57. Study about Interface, Inheritance, OverLoad and OverRide. He asked different simple q uestions on these.

58. What types of sessions we have in ASP.NET? (I dont know. Look at Cookie sessions, Cokkieless sessions).

59.

Tell me the sequence of events occur in aspx page?

60.

What is an Application Domain? ( I Just told defintion. He left this topic)

Questionnaire for Dev Lead Profile - MSBUIT

290 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

First Interview by Marcus

One important point which I noticed was that, he was asking me whether I was sure about the answer very often to find that I am not bookish.

Q. Brief about yourself and about the roles and responsibilities for the past 1-2 years.

A. I explained him about my last project and the technologies involved and what was I doing off late (pre-sales activities like estimation etc., involved in the design of a Biztalk to SAP adapter project, have formed a team to do research on Tablet-PC to present a paper in Tech forum)

Q. What is the difference between Value types and Object types?

A. Value types are built-in data types in any .Net compliant language and they are stored on the application stack, whereas the Object types are user-defined types and are by default reference types and will be stored in the managed heap.

291 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Note: A thread of discussion started here to know the depth of my understanding about the stack and heap implementation in .NET. This discussion went on for more than 12 minutes. Basically he wanted to know memory is managed in .NET by the CLR or runtime.

Q. When is a value type used over an object type?

A. Value types are used for temporary storage. They are valid only in the scope of the function or the execution block in which they are declared. Whereas the reference types are used for user-defined types which need to retain the state across function calls and have a lifetime which is defined by the usage.

Note: I also explained him about the Garbage collection mechanism here and how GC works: Application roots, marking for removal, Compaction and Finalization etc.

Q. What are different keywords used related to inheritance in C#?

A. Virtual, override, new, sealed and abstract.

292 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Q. Given an unsigned 16 bit integer, what is the max value it can hold?

A. 65535

Q. What happens if I store more than max value in the previous scenario?

A. In .Net this scenario can be addressed in two ways: If the same is done in a checked context, the runtime will throw an OverflowException, whereas if run in unchecked context, the MSB is truncated and rest of the value is stored in the variable and the execution continues

Note: He asked whether I was sure about this and I said, yes. But he said Check this out to-night and you will be surprised to see the result. Which in fact I did and didnt find any surprise. May be theres some undocumented feature of .NET here.

Q. What does the new keyword do w.r.t inheritance?

A. It hides the base classs implementation.

293 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Q. Rate yourself in OOAD and UML on a scale of 10?

A. 7-8.

Q. What is the difference between Inheritance and Composition?

A. Inheritance is a generalization relationship, used for code reuse. I cited an example of Shape as the base class and Circle, Rectangle as the derived classes. Explained him about generalization to specialization.

Composition is a strong form of containment, where the parts lifetime is dependent on the whole. Cited and example.

Q. What is polymorphism?

A. Compile time polymorphism (Function/operator overloading examples).

Runtime polymorphism (Late binding, Virtual/Overridden functions examples).

294 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Q. Given a base class reference to a derived class can you access the derived class methods?

A. Object Polymorphism in other words: Cited the same shape ?Circle example and explained the behavior.

Q. What all database components are available in .NET?

A. ADO.NET components. Connection, Command, DataReader, DataSet and DataView. Explained each.

Q. What is the advantage of using the OLE DB drivers directly?

A. Certainly the performance will improve as the abstraction layers are removed.

Q. What is the difference between a clustered index and non-clustered index?

295 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

A. In a clustered-index, the data page and the index page are same whereas in a non-clustered index, the data pages and the index page is separate.

Q. How do you implement an index?

A. I havent done in the past.

Q. Explain a Left outer join and a right outer join?

A. Left outer join will also involve the fields of the table on the left of the join query that are not specified in the SQL query.

Right outer join will also involve the fields of the table on the right of the join query that are not specified in the SQL query.

Q. Do you know about execution plan?

A. Execution plans are formed by the database engine to find the optimized way of executing a

296 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

query. I will use the most appropriate query plan as needed.

Q. Do you have any comments?

A. What is the project all about? What stage it is in right now? What will be my role in the project?

Second Round of Interview Questions from Redmond

He upfront informed me that he had a question before the interview starts and asked me whether I had VB knowledge. Since I didn't have any VB experience, I informed him about the same and briefed him about my skillset (VC++, C++, C#, COM etc.,). He was in a opinion that there was a miscommunication regarding job description and there is no point in continuing the interview

01.

What is GAC?

297 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

02.

Why GAC?

03.

What are the types of Assemblies?

04.

What is a shared assembly?

05.

What are the requirements for a shared assembly?

06.

Types assemblies?

07.

What is satellite assembly?

08.

What is a manifest? And Metadata? And why?

09.

What is MSIL? What is the significance of MSIL?

10.

Boxing and Unboxing questions

11.

How many boxing and unboxing operations happen in the below code

int32 i;

298 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

object o=i;

Console.WriteLine(i + , + int32(o));

12.

How many no. of bytes it takes for a int32 datatype?

13.

What is Connection Pooling?

14. If there are two similar connection strings with different passwords, how many connection pools will be there?

15.

What is object pooling (COM+)

16.

What is a web service?

17.

How do u maintain Transactions in Web Services?

18.

What is a clustered Index?

19.

What are the XML features supported by SQL Server?

20.

What is type safe language? How would you enforce type safety in .NET?

21.

Have you worked on Winforms and Unmanaged code? (P/Invoke)

299 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

22.

How did u worked with tlbimp?

23.

What does the ItemTemplateColumn denote for a datagrid?

24. A datasource is connected to DGrid. Do we need to rebind the datagrid if the datasource changes?

Analytical Question

1. We got 3 sealed boxes one with Red other with Blue and the other with Green balls. Each box has a label denoting the color of the balls that it contains. But the labels for all the boxes r pasted wrongly. Now how many boxes should u open to find the color of balls in all the 3 boxes?

Ans: 1

1)what is xmldatadocument and xmldocument

2)what is response.buffer

300 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3)can i have multiple web.config files in the application

4)can i use javascript in the webservercontrols

5)how to access server variables inside javascript

6)what is the difff between htmlservercontrols and webservercontrols

7)how to configure smtp server for sending mails

8)can i use variable in the include file

9)what is the diff between server.transfer and response.redirect

10)how is the version is maintained in the assembly

11)how can i refer to an assembly with a different version

12)can i use action="a.exe" inside the form tag

13)can i use server.createobject(a.exe)

14)can i pass querystring in server.transfer

301 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

15)diff between server.transfer and server.execute

16)what is the step to be done before making an instance of excel file using server.createobject

17)what are type datasets

18)what is the difference between manifest and metadata

Database:

What are normalisation rules?

Types of joins and examples Join sql select statement.

Difference between types of joins

What is a cursor.

302 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

What is clustering

What is indexing

Types of indexes

Given a problem and asked for database design

ASP:

Types of objects

Types of authentication

303 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

C#:

CLR features

CLS and CTS definitions

Assembley and dll differences

Private and shared assemblies differences

what are static constructors

Memory management

Remoting concept

Typrs of proxies in remoting

Type of protocols and channels and difference

304 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Webservices concept

Difference between webservices and remoting

Assembly loading, signing, generating keys

Java:

Diffrence between awt and swing

RMI concepts

What are EJB's

What are the feature's of application server

Multithreading concepts

Secutiry concepts, signing applets

305 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Oops:

Difference between abstract classes and interfaces

(Descriptive answer with example)

Why interfaces are required

What is polymorphism

Different keywords and thier access types static variables and static methos.

306 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Patterns:

Types of Patterns

Singlton Pattern implementation

Observer Pattern implementation

MVC Pattern implementation

UML:

Usecase and class diagram concepts

xMLXSL:

307 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

What is sort?

sysntax of if,while and for loops in xsl

what is DTD?

what is xpath?

Advantages of oops?

what is inheritance,polymorphism?

advantages of asp.net over asp?

.net features?

what is normalisation?

advantages of normalisation?

308 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

what are design patterns?

what are attributes in .net?

ado.net architecture?

1)How to maintain transaction in asp and asp.net

2)how caching is done in asp and asp.net

3)what is the diff between disconnected recordset and

dataset

4)what are the diff types of inheritance

5)name few of the abstract class in .net

6)how to maintain state in asp and asp.net

7)what is the best form of validation (server side and

309 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

client side)

8)GAC what are the advantages and disadvantages

9)what is join like += and *=

10)what is the diff between sql 2000 and sql 7.0 in terms of

triggers

11)what is magic table and temp table

12)Can u deploy .net assemblies I

1)What is usercontrols?

2)Can we have dynamic usercontrols and can we pass values from the usercontrols to the aspx pages?

3)What is the diff between abstract class and interface

310 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

4)Can u use javascript in aspx

5)what is the diff between windows dll and com dll

6)Diff between asp and asp.net

7)Diff between having and where clause

8)Can i have mulitple global.asa files

9)Diff between machine.config and web.config

10)what is web.config

11)Types of parameters passed in c# methods

12)byref and byval

13)diff between repeater,datalist and datagrid

14)threading

15)can i have a connected dataset

311 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

16)why u need dataadpater

17)diff between servercontrols and htmlcontrols

18)what is response.end,response.clear and response.flush

19)what is diff between asp caching and asp.net caching

20)what is global assembly cache.how to put the components in the GAC and is there any steps before that

21)CLR,CTS and CLS

22)what are strongnames

23)what all u can pass in byval and byref

24)what is assembly

25)what is namespace and can we have nested namespace in a dll and where exactly the namespace is stored

26)what is the version control in .net

312 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

27)what is the disadvantage of using static

28)Apart from DOM how can u retreive records in XML

29)how to use com in .net and vice versa

30)oops,operator overloading(What happend when the return type is different and the signature is the same)

31)What is the difference between operator overloading and

overiding

32)What is the namespace used for creating the collection

object

33)can u force the garbage collector

34)can u use try without catch

35)how to create disconnected recordset in asp

313 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

36)what is the process flow of asp.net page

37)what is the problem of using server.transer

1)What is a stored procedure?

2) what are the advantages of stored procedure over normal queries?

3)How to improve the performanace on database layer?

4)What is a join?what is the difference between inner joins

and outer joins?

314 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ASP

1)what are the objects in ASP?

2)What is the use of ObjectContext object?

3)How to handle errors in ASP pages?

4)what are the ways on which we can access a COM component in an asp page?

315 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

COM/DCOM/COM+/MTS

1)What is COM? Explain the concepts of COM?

2)Waht is interface and iunknown in COM?

3) How does a client application interact with a COM component?

4)Waht is DCOM?How DCOM works?

5)Waht is COM+

316 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

6)Waht is MTS?How it handles components?

XML/Schema/XSL

1)what is xml/schema/xsl?

2)What is the use of XSL?

3)How is a variable declared in XSL?

.NET

1)what is an assembly?

317 / 318

COMPLETE DOTNET COURSE MATERIAL AND FAQ

2)What is the difference betweemn VB and VB.net?

3)What is RCW and CCW?

4)What are the steps to be taken for porting a VB application to a VB.NET application?

318 / 318

Das könnte Ihnen auch gefallen