Complete Dotnet Course Material

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

description

feature enlisting dot net sol

Transcript of Complete Dotnet Course Material

Page 1: Complete Dotnet Course Material

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

Page 2: Complete Dotnet Course Material

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 ofan 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 andemailtext. How will you normalize the table?

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

2 / 318

Page 3: Complete Dotnet Course Material

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 likeC++

3 / 318

Page 4: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3. What r the advantages comparatively, Value types are derived from which namespaceand 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

Page 5: Complete Dotnet Course Material

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. If you have to replicate a set of controls(UI) across a number of web pages, what will youdo?

5 / 318

Page 6: Complete Dotnet Course Material

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 inASP.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

Page 7: Complete Dotnet Course Material

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

Page 8: Complete Dotnet Course Material

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

Page 9: Complete Dotnet Course Material

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

Page 10: Complete Dotnet Course Material

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

Page 11: Complete Dotnet Course Material

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

Page 12: Complete Dotnet Course Material

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

Page 13: Complete Dotnet Course Material

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

Page 14: Complete Dotnet Course Material

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

Page 15: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

10. OLE

11. ActiveX.exe example.

ASP

1. Ways to Instantiate a Object

15 / 318

Page 16: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

2. Modeling languages.

3. ASP built-in objects

4. HTML and DHTML

16 / 318

Page 17: Complete Dotnet Course Material

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

Page 18: Complete Dotnet Course Material

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

Page 19: Complete Dotnet Course Material

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

Page 20: Complete Dotnet Course Material

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 andemailtext. How will you normalize the table.

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

19. Desing a db for a school database?

20. What is SQL Trace?

20 / 318

Page 21: Complete Dotnet Course Material

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

Page 22: Complete Dotnet Course Material

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

Page 23: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

23 / 318

Page 24: Complete Dotnet Course Material

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

Page 25: Complete Dotnet Course Material

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 torestrict unauthorized users from using the application.

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

25 / 318

Page 26: Complete Dotnet Course Material

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 designthis 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

Page 27: Complete Dotnet Course Material

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 yourecommend 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

Page 28: Complete Dotnet Course Material

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

Page 29: Complete Dotnet Course Material

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

Page 30: Complete Dotnet Course Material

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 inASP.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

Page 31: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

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 ofinheritance?

31 / 318

Page 32: Complete Dotnet Course Material

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 completedin 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

Page 33: Complete Dotnet Course Material

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

Page 34: Complete Dotnet Course Material

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

Page 35: Complete Dotnet Course Material

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 classC. 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

Page 36: Complete Dotnet Course Material

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. What’s 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

Page 37: Complete Dotnet Course Material

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

Page 38: Complete Dotnet Course Material

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

Page 39: Complete Dotnet Course Material

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

Page 40: Complete Dotnet Course Material

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 isoptimistic?

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 theaddresses 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 databaseserver from Application, I use connection string. So, it passes through network I think definininglike “server=xx;databse=pubs;uid=pqr;pwd=abc” is insecure. Is there any methodology to makesafe while pass through network.

78. What is Distributed database?

40 / 318

Page 41: Complete Dotnet Course Material

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

Page 42: Complete Dotnet Course Material

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 thereany other alternative to run it?

97. Name few functions used in SQL server?

98. What is difference between PatIndex and CharIndex?

99. My table doesn’t have key. So many duplicate rows exists in the table. I want to eliminateall the duplicate rows and keep only one unique row. Can u accomplish this task in a singlequery? 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

Page 43: Complete Dotnet Course Material

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 notmaintaining transaction. Some how I got error while running a Delete statement. Does Updatestatement execute? Does earlier(Insert) statement committed?

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

43 / 318

Page 44: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

113. What is execution plan?

114. What do you observe in Execution Plan to know the performance of thequery/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

Page 45: Complete Dotnet Course Material

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

Page 46: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Programmable Controls

ASP .NET contains a large set of HTML controls. Almost all HTML elements on a pagecan 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 listboxes, validation controls.

A new data grid control supports sorting, data paging, and everything you expect from adataset control.

Event Driven Programming

46 / 318

Page 47: Complete Dotnet Course Material

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 muchbetter organized.

XML Based Components

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

47 / 318

Page 48: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

User Authentication, with Accounts and Roles

ASP .NET supports forms-based user authentication, including cookie management andautomatic 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) accessto different server code and executables.

Higher Scalability

48 / 318

Page 49: Complete Dotnet Course Material

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 scalean application over several servers. One example of this is the ability to run XML parsers, XSLtransformations 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 codeand keep a cached copy in memory. The result of this is greatly increased performance.

49 / 318

Page 50: Complete Dotnet Course Material

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 needto restart the server. No more metabase or registry puzzle.

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

50 / 318

Page 51: Complete Dotnet Course Material

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 thefile by simply calling controlname.postedFile.saveAs(filename)

51 / 318

Page 52: Complete Dotnet Course Material

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 elementsthat they render.

• Web server controls Controls with more built-in features than HTML server controls. Webserver controls include not only form-type controls such as buttons and text boxes, but alsospecial-purpose controls such as a calendar. Web server controls are more abstract than HTMLserver 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. Youattach 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

Page 53: Complete Dotnet Course Material

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 WebForms 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

Page 54: Complete Dotnet Course Material

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

Page 55: Complete Dotnet Course Material

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

Page 56: Complete Dotnet Course Material

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 theclasses 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 weneed to prefix complete namespace to the class that we are going to use.

For example

56 / 318

Page 57: Complete Dotnet Course Material

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

Page 58: Complete Dotnet Course Material

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 codecache called the global assembly cache. The global assembly cache stores assembliesspecifically designated to be shared by several applications on the computer.

You should share assemblies by installing them into the global assembly cache only when youneed 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 preferredoption 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

Page 59: Complete Dotnet Course Material

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

Page 60: Complete Dotnet Course Material

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

Page 61: Complete Dotnet Course Material

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

Page 62: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

We create read only property (that returns the value which u want to access across pages) inthe 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

Page 63: Complete Dotnet Course Material

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 topof the page, with the Page attribute set to the source Web Forms page (the Web Forms pagethat 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 WebForms page sending the information.

[Visual Basic]

<script runat="server">

63 / 318

Page 64: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Dim fp As FirstPageClass

</script>

Assigns the IHttpHandler implemented object for the current HTTP request to the variabledeclared 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 theHTTP request. Because the IHttpHandler implemented object is not the same type of object asthe variable declared in the previous step, it must be converted to the class encapsulating theinformation 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

Page 65: Complete Dotnet Course Material

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 encapsulatingthe information from the previous Web Forms page.

<%=fp.FirstName%>

65 / 318

Page 66: Complete Dotnet Course Material

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

Page 67: Complete Dotnet Course Material

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 relationaldata.

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

Page 68: Complete Dotnet Course Material

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

Page 69: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

In-memory representation of data is the recordset In-memory representation of data is thedataset

Number of Tables

A recordset looks like a single table. If a recordset is to contain data from multiple databasetables, it must use a JOIN query, which assembles the data from the various database tablesinto a single result table.

A dataset is a collection of one or more tables. The tables within a dataset are called datatables; specifically, they are DataTable objects. If a dataset contains data from multipledatabase tables, it will typically contain multiple DataTable objects. That is, each DataTableobject typically corresponds to a single database table or view. In this way, a dataset can mimicthe structure of the underlying database. A dataset usually also contains relationships.Because the dataset can hold multiple, separate tables and maintain information aboutrelationships between them, it can hold much richer data structures than a recordset, includingself-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 MoveNextmethod In ADO.NET, rows are represented as collections, so you can loop through a table asyou 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

Page 70: Complete Dotnet Course Material

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 forconnected 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 withoutstaying connected to the data source.

Sharing Data Between Applications

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

70 / 318

Page 71: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Transmitting an ADO.NET dataset between applications is much easier than transmittingan 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 norestriction on data types. Thus, the components sharing the dataset can use whatever rich set

71 / 318

Page 72: Complete Dotnet Course Material

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 networkresources; as the amount of data grows, the stress placed on the network also rises. Both ADOand ADO.NET let you minimize which data is transmitted. But ADO.NET offers anotherperformance advantage, in that ADO.NET does not require data-type conversions. ADO, whichrequires COM marshalling to transmit records sets among components, does require that ADOdata types be converted to COM data types.

72 / 318

Page 73: Complete Dotnet Course Material

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 preventsystem-level requests (such as COM marshalling) from passing.

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

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

73 / 318

Page 74: Complete Dotnet Course Material

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

Page 75: Complete Dotnet Course Material

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

Page 76: Complete Dotnet Course Material

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

Page 77: Complete Dotnet Course Material

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 disconnectedone.

Datareader is forward, read only.

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

77 / 318

Page 78: Complete Dotnet Course Material

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

Page 79: Complete Dotnet Course Material

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

Page 80: Complete Dotnet Course Material

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

Page 81: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

objTran.Commit()

or

objTran.Rollback()

81 / 318

Page 82: Complete Dotnet Course Material

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

Page 83: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Basic concepts

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

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

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

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

83 / 318

Page 84: Complete Dotnet Course Material

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. Thisis either stored on the machine itself, or on a domain controller elsewhere. The list is managedthrough computer management tool or active directory users and computers tool on a domaincontroller.

Authentication in IIS

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

IP Address and Domain Restriction

84 / 318

Page 85: Complete Dotnet Course Material

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 ordomain is unrestricted. This uses IUSR_MachineName account to access the resource.

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

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

85 / 318

Page 86: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

proxy/firewalls.

Integrated Windows Authentication : This also know as NTLM authentication or challengeResponse 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 workwith most proxy/ firewalls. This is also very secure way. Finally IIS checks with the accounts inwindows, and will only allow the user to access the resource if the account is valid and hasappropriate 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

Page 87: Complete Dotnet Course Material

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, directorybrowsing.

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

ASP.net impersonation

87 / 318

Page 88: Complete Dotnet Course Material

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

Page 89: Complete Dotnet Course Material

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

Page 90: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

In the forms based authentication, we can use credentials or use xml file that hasusername/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

Page 91: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

</authorization>

</system.web>

</configuaration>

ASP.NET

91 / 318

Page 92: Complete Dotnet Course Material

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 memoryaddress of the object. You usually store this address in a variable. This is called a referencetype variable because the variable does not actually contain the object's bits; instead, thevariable refers to the object's bits

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

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

92 / 318

Page 93: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

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

Error! Unknown switch argument.Value type objects have two representations: an unboxed formand 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 typeimplemented by this value type. Boxing a value of a value allocates an object instance andcopies the value into the new object.

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

93 / 318

Page 94: Complete Dotnet Course Material

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 ofADO.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 usedto manage data local to the application. The DataSet contains a collection of one or moreDataTable 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

Page 95: Complete Dotnet Course Material

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

Page 96: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Command: Executes a command against a data source. Exposes Parameters and can executewithin 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 torelational data sources, XML and Appln data.

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

iii. Improved integration with XML

96 / 318

Page 97: Complete Dotnet Course Material

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 objectmodel simple)

vii. vii. ADO .NET has object viz; DataReader (forward only readonly), DataSet (in memoryrelational 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 thecommunication happens thro DataAdapter which in turn makes calls to OLE DB providers orAPIs provided

xi. Using ADO .NET it is possible to transmit data betwn applns where as in ADO u need touse disconnected recordsets to pass recordsets betwn components and u need to use COMmarshalling (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 asin 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

Page 98: Complete Dotnet Course Material

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” toprovide access to functionality via internet using standard protocols such as HTTP. Webservices are based upon an application of XML called SOAP

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

6. How is a Web Service qualified or defined.

7. what is format of WSDL?

98 / 318

Page 99: Complete Dotnet Course Material

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. Itspecifies the location of the service and the operations (or methods) the service exposes.

Universal Description, Discovery and Integration (UDDI) is a directory service where businessescan register and search for Web services. It is a directory for storing web services andcommunicated 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 webapplication or for the duration of a user’s 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 tomaintain data for a limited duration of time, for a particular user and isolate that data from theother users.

99 / 318

Page 100: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Application State ? Application state is controlled through the application object. Applicationallows us to maintain data for a given ASP.NET application. Setting should be done to accessthe 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 cacheobject. 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 theclasses are created and these are available through out the application in more efficient waythan the Application.

100 / 318

Page 101: Complete Dotnet Course Material

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 inASP.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

Page 102: Complete Dotnet Course Material

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 transfermethod 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

Page 103: Complete Dotnet Course Material

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 theHTTP request from the handler property of the Context object which in turn is converted in to aninstance of the class which contains the passed information. After conversion the passed valuescan 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 codeassociated with the Web Forms page. In the code-behind file for the Web Forms page sendingthe information, first create a property with a get accessor, in the class, for each value you wantto share. The get accessor should return the value you want to pass, such as the value of a textbox. To send the information, transfer control of the application to a different Web Forms pageby using the Transfer method of the Server object.

On the receiving Web Forms page, reference the class declared in the sending page by addingan @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 theHandler property of the Context object.

103 / 318

Page 104: Complete Dotnet Course Material

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 thecontent using codebehind concept.

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

d. Validation of form controls

e. Asp is browser compatibility not a device compatability whereas in ASP.net can becompatability 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

Page 105: Complete Dotnet Course Material

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. If you have to replicate a set of controls(UI) across a number of web pages, what will youdo?

Using custom controls.—NEED TO DISCUSS

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

HTMLServerControls

Web Controls

List controls

105 / 318

Page 106: Complete Dotnet Course Material

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 servercontrol and display a custom message when validation fails .These controls are available atsystem.web.UI.WebControls

Types of validation control are

i. RequiredFieldValidator Checks if the input control has any value.

106 / 318

Page 107: Complete Dotnet Course Material

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 orcompared to the content of another control.

iv. RangeValidator Checks if the input control’s 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

Page 108: Complete Dotnet Course Material

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

Page 109: Complete Dotnet Course Material

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 asa Select or Update. You can read rows into a dataset and then work with them without stayingconnected to the data source. In ADO the recordset can provide disconnected access, but ADOis designed primarily for connected access.

There is one significant difference between disconnected processing in ADO and ADO.NET. InADO you communicate with the database by making calls to an OLE DB provider. In ADO.NETyou communicate with the database through a data adapter (an OleDbDataAdapter,SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to anOLE DB provider or the APIs provided by the underlying data source. The important differenceis that in ADO.NET the data adapter allows you to control how the changes to the dataset aretransmitted to the database — by optimizing for performance, performing data validationchecks, 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 databasetables, it must use a JOIN query, which assembles the data from the various database tablesinto a single result table.

In contrast, a dataset is a collection of one or more tables. The tables within a dataset are calleddata tables; specifically, they are DataTable objects. If a dataset contains data from multipledatabase tables, it will typically contain multiple DataTable objects. That is, each DataTableobject typically corresponds to a single database table or view. In this way, a dataset can mimicthe structure of the underlying database.

109 / 318

Page 110: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

A dataset usually also contains relationships. A relationship within a dataset is analogous to aforeign-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 eachinvestor's stock purchases, it could also contain a relationship connecting each row of theinvestor 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

Page 111: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ANS: The import directive specifies another IDL, ODL, or header file containing definitions youwish 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 declarethem?

111 / 318

Page 112: Complete Dotnet Course Material

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

Page 113: Complete Dotnet Course Material

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, andintegrating 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

Page 114: Complete Dotnet Course Material

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 namespaceand reference types as well.

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

114 / 318

Page 115: Complete Dotnet Course Material

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 ofinheritance?

27. Does .NET support multiple inheritance?

115 / 318

Page 116: Complete Dotnet Course Material

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

Page 117: Complete Dotnet Course Material

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-typeobjects.

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

117 / 318

Page 118: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

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

The last point is very important – due to the complexities of automatic garbage collection, youcan’t 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 thememory belonging to an orphaned object will always be released, even though its destructormay never be called.

The other effect of adding it to the Controls collection is that the .NET framework willdeterministically call a method called Dispose on all of its members the instant they’re no longerneeded. And in this Dispose method, the control can release its Windows handle, as well asdropping the textbox off the screen.

118 / 318

Page 119: Complete Dotnet Course Material

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 inorder to release resources other than memory. There are two waysthis happens:

- manually (by calling Dispose explicitly)

- automatically: by adding the object to a .NET container, such as a Form, Panel, TabPage orUserControl. The container will ensure that when it’s Disposed, so are all of its members. Ofcourse, 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 hencerely 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 witha type so fundamental as Size or Point

119 / 318

Page 120: Complete Dotnet Course Material

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

Page 121: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

ADO .NET similar to ADO + several new concepts in design + better interoperability andscalable 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 modelsimple)

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

ADO .NET has command obj that su

121 / 318

Page 122: Complete Dotnet Course Material

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 thecommunication happens thro DataAdapter which in turn makes calls to OLE DB providers orAPIs provided

Using ADO .NET it is possible to transmit data betwn applns where as in ADO u need to usedisconnected recordsets to pass recordsets betwn components and u need to use COMmarshalling (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 inADO .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

Page 123: Complete Dotnet Course Material

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 (unlikeclass). It can hold reference only to method that matches its signature. Thereforedelegate is a type safe function pointer.

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

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

123 / 318

Page 124: Complete Dotnet Course Material

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 restrictunauthiorised users from using the application.

6. Write the code snippet for fetching data from a table and populating in a list box control of anasp 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 andemailtext. How will you normalize the table.

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

10. How state is maintained in ASP.Net.

124 / 318

Page 125: Complete Dotnet Course Material

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 theobject 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 gettwo independent var

When passing a value by ref to a function the local obj (of a function) even if set to null does noteffect the actual obj.. but the changes made to the obj properties remain .. as both the variablespoint 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 thelocal var of func makes nullifies original obj .. as this time we deal with the original reference varand not a copy

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

125 / 318

Page 126: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Mem allocated for value type freed when out of scope where as for ref type they r freed whenthey 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 willcreate a copy the entire obj consuming additional mem

Boxing is converting value type to reference type and unboxing is converting reference type tovalue 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

Page 127: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Boxing allocates memory for the value being boxed on heap, copies the value into this memoryand 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, intin this case, it gets boxed into an object. Using this object a method ToString( ) is called, whichreturns the string equivalent of the value stored in a variable. WriteLine( ) then displays thisstring.

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

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

127 / 318

Page 128: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Reference types actually hold the value of a memory address occupied by the object theyreference. Consider the following piece of code, in which two variables are given a reference tothe same object (for the sake of the example, this object is taken to contain the numericproperty '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 isreflected 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 ofs1 is changed, for instance with

128 / 318

Page 129: Complete Dotnet Course Material

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 pieceof code, s1 equals "goodbye", whereas s2 still equals "hello".

The reason for this behaviour is that string objects are 'immutable'. That is, the properties ofthese 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 bypassing it to the IsReference method on the Information class in the Microsoft.VisualBasicnamespace. Microsoft.VisualBasic.Information.IsReference returns True if the content of theObject variable represents a reference type.

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

129 / 318

Page 130: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

3. What r the advantages comparatively, Value types are derived from which namespaceand 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 exceptionelse… the data gets truncated.

C# allows use of XML Documentation (can be translated to HTML using XSLT/ create web siteusing 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

Page 131: Complete Dotnet Course Material

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. If you have to replicate a set of controls(UI) across a number of web pages, what will youdo?

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 inASP.net?

131 / 318

Page 132: Complete Dotnet Course Material

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

Page 133: Complete Dotnet Course Material

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

Page 134: Complete Dotnet Course Material

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

Page 135: Complete Dotnet Course Material

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

Page 136: Complete Dotnet Course Material

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 theQueryInterface method, and manage the existence of the object through the IUnknown::AddRefand 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 forevery interface.

136 / 318

Page 137: Complete Dotnet Course Material

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 applicationsthat support automation

137 / 318

Page 138: Complete Dotnet Course Material

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 integerDISPIDs.

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 Machintoshsystem.

138 / 318

Page 139: Complete Dotnet Course Material

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

Page 140: Complete Dotnet Course Material

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 anotherapplication.

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

140 / 318

Page 141: Complete Dotnet Course Material

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) youwould 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 wantto manipulate. In the VB Editor of any Office application, or in VB itself, you do this by selectingTools + References, and selecting the application you want from the list (e.g. “Microsoft Excel8.0 Object Library”).

To create a new instance of Excel using early binding:

Dim oXL As Excel.Application

141 / 318

Page 142: Complete Dotnet Course Material

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 thatreturns 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 latebinding, the code relating to an application you declared as an object has to, in effect, becompiled 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 hadyou used late binding.

142 / 318

Page 143: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

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

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

Dim objWord As Word.Application

Set objWord = New Word.Application

With objWord

143 / 318

Page 144: Complete Dotnet Course Material

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 theconstant “wdWindowStateMaximize” happens to be 1.

144 / 318

Page 145: Complete Dotnet Course Material

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 beversion-independent

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

But as they famously say, YMMV. Problems have been found in certain circumstances. Forinstance, if you run a Word 97 project containing a reference to the Excel 8.0 object library on amachine with Office 2000 installed, it will run OK, but you may get the occasional “cannot openmacro 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 createseparate Word 97 and Word 2000 versions of your addins, despite the maintenance overhead.

145 / 318

Page 146: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

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

Summary

Personally, as someone who finds programming difficult at the best of times, I would neverdream of using late binding – why make life harder for yourself than it has to be? But someprogramming geniuses prefer to use late binding, because of the peace of mind it gives themregarding 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 latebinding, all I can say is: Look on the bright side – you could have ended up as an Assemblylanguage programmer ...

146 / 318

Page 147: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

You can author new controls by combining existing controls using class composition. Acomposite control renders a user interface that reuses the functionality of existing controls. Acomposite control can synthesize properties from the properties of its child controls and handleevents 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. UsingVTBL binding is similar to programming the speed dialer on your phone. You look up thenumber once and program it into the phone. Once you verify that it's valid, a single button dialsthe number. All the work of looking up the phone number is handled long before you use the

147 / 318

Page 148: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

Early Binding: VTBL Binding

A VTBL is a data structure containing the addresses (pointers) for the methods and propertiesof each object in an Automation server. Using the VTBL is generally known as early binding inVBA. 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 runtime, this type of binding is faster, as the entry points for the Automation server are alreadyknown 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 knowingthe exact location of their entries in the VTBL. An IDispatch implementation is frequentlyreferred to as late binding. With IDispatch, VBA has no preexisting information about the serverit will be calling. It assumes during its compile phase that the code is correct. It then attempts atrun time to execute the code and trap for run-time errors. This is much less elegant andrepresents a step backward from the familiar syntax and type checking we have come to expect

148 / 318

Page 149: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

from VBA. An IDispatch call also requires both the client and the server to marshal theirarguments into a consistent form that is understood by both. In most cases, this means thatarguments are copied into and out of variants. This not only slows down IDispatch, but it alsolimits the data types that can be passed using this technique. In all future discussions VTBLbinding 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 earlybind 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 latebinding, 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 inwhich late binding is preferred. If you are implementing polymorphic code (one call canrepresent multiple different objects), then late binding is required. For example, you can createthree classes — widgets, gidgets, and gadgets — all with a Create method. By defining yourvariable as an object, you can call the Create method for any of the three classes based onrun-time conditions.

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

Binding in VBA

149 / 318

Page 150: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

What does early binding versus late binding look like in VBA? The main difference is in how youdeclare your variables. The following code snippet declares an object variable that refers to aninstance of Microsoft Word. This example represents late binding, since we have used thegeneric Object data type. VBA doesn't know what type of object it is and will use late binding atrun 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 asWord.Application. This can be done only after we have referenced the Microsoft Word typelibrary using Tools/References. Since VBA knows about the type of this object, it attempts touse 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 orlate bound. How you create the object has no bearing on the type of binding VBA does, but itdoes have some performance implications.

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

150 / 318

Page 151: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

CreateObject method is typically used when you don't know the Program ID (ProgID) of theobject 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 classname (for example, Application.Class). To arrive at the ProgID for a particular object, use thismethod and then look at HKEY_CLASSES_ROOT in the registry to verify that you are correct. Ifyou are correct, the ProgID should show up in this hive as a key. It's often assumed that if youuse CreateObject you are using late binding, but this is not always the case. The declaration ofthe object variable is the overriding factor. CreateObject does have a slight performancedisadvantage when compared to New. CreateObject assumes there is no reference to theobject it is trying to instantiate and loads all the type information from the registry. This processis slower than using the type information available in a type library.

The New keyword has two syntaxes. The following example declares and instantiates the objectin 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 todeclare 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 toworry about checking to see if wrd has been initialized yet. But there is a minor penalty for this,

151 / 318

Page 152: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

CreateObject can also be used, and it retrieves the type information for Word.Application fromthe referenced type library. The results of the following are identical with but slightly slower thanusing 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'stype 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 selectthe implementation at run-time.

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

In-Process vs. Cross-Process

152 / 318

Page 153: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

OLE Automation objects are instantiated in two different manners: in-process andcross-process. An in-process Automation object is loaded as a DLL into the process space (thememory of the application) of the controller. This has a distinct performance advantage, sincethe controller and object are in the same process space and direct function calls may be madebetween them. However, there are some drawbacks. When loading servers in-process, eachcontroller must load its own copy of the object. There is no sharing of objects betweenprocesses. When an object is in-process, a bug in the object can bring down both the controllerand the object. Despite the pitfalls, in-process object communication is fastest and is typicallythe 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 asa 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 bymultiple controllers.

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

153 / 318

Page 154: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

1) Initial. The software process is characterized as ad hoc, and occasionally even chaotic. Fewprocesses 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 onprojects with similar applications.

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

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

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

154 / 318

Page 155: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Except for Level 1, each maturity level is decomposed into several key process areas thatindicate 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 toestablishing basic project management controls. They are Requirements Management,Software Project Planning, Software Project Tracking and Oversight, Software SubcontractManagement, Software Quality Assurance, and Software Configuration Management.

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

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

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

155 / 318

Page 156: Complete Dotnet Course Material

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/implementingaspsecurity.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 inASP.net?

156 / 318

Page 157: Complete Dotnet Course Material

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. Itrequires 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 fileuploading and not on other uploading possibilities. Remember, when you upload a file, you canalso upload (post) any other inputs, such as the input file, input checkbox, input password, andinput image, etc. And you can check their value just as if you were posting an ordinary form. Sowhen you upload a file you are really posting a form's content to the browser by using a differentencoding type (enctype) in your form. That encoding is specified asenctype="multipart/form-data" as an attribute of your form.

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

157 / 318

Page 158: Complete Dotnet Course Material

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

Page 159: Complete Dotnet Course Material

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 goodstarting point;

• If you don’t 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

Page 160: Complete Dotnet Course Material

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 propertiesof each object in an Automation server. Using the VTBL is generally known as early binding inVBA. 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 runtime, this type of binding is faster, as the entry points for the Automation server are alreadyknown and the data types and syntax have already been verified.

Late Binding: The IDispatch Interface

160 / 318

Page 161: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Using the IDispatch interface is a way to call member functions within an object without knowingthe exact location of their entries in the VTBL. An IDispatch implementation is frequentlyreferred to as late binding. With IDispatch, VBA has no preexisting information about the serverit will be calling. It assumes during its compile phase that the code is correct. It then attempts atrun time to execute the code and trap for run-time errors. This is much less elegant andrepresents a step backward from the familiar syntax and type checking we have come to expectfrom VBA. An IDispatch call also requires both the client and the server to marshal theirarguments into a consistent form that is understood by both. In most cases, this means thatarguments are copied into and out of variants. This not only slows down IDispatch, but it alsolimits the data types that can be passed using this technique. In all future discussions VTBLbinding 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 atcompile-time. If you can't early bind you must use late binding, which is slower and doesn't allowyou to catch simple errors (such as type mismatches) until run time.

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

161 / 318

Page 162: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

When testing this type of late-bound strategy, it's generally best to test a single object, earlybind to get the syntax and type checking, and then switch to late binding after you've testedeach 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

Page 163: Complete Dotnet Course Material

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. TheCreateObject method is typically used when you don't know the Program ID (ProgID) of theobject 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 classname (for example, Application.Class). To arrive at the ProgID for a particular object, use thismethod and then look at HKEY_CLASSES_ROOT in the registry to verify that you are correct. Ifyou are correct, the ProgID should show up in this hive as a key. It's often assumed that if youuse CreateObject you are using late binding, but this is not always the case. The declaration of

163 / 318

Page 164: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

The New keyword has two syntaxes. The following example declares and instantiates the objectin 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 todeclare 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 toworry 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 istransparent to you, but your compiled code will be slightly larger compared with the previoussyntax.

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

164 / 318

Page 165: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

the referenced type library. The results of the following are identical with but slightly slower thanusing 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'stype library.

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

Apartment Threading model.

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

165 / 318

Page 166: Complete Dotnet Course Material

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 moreefficient to only create the object once and that this has the advantage of persisting not onlydata but also ‘business logic’ as well. Whilst it is true that the creation of an object can be timeconsuming and the idea of persisted ‘business logic’ is tempting, placing the VB object insession scope has a peculiar side effect – it can seriously impair the performance of theapplication.

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

166 / 318

Page 167: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

objects

application scope is even worse as it will pin all requests for your application to one singleworker 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 olderversions of the ActiveX Components generated from the project.

The ActiveX Components you create contain a default interface (for example, CName_D whereCName is the ClassName for the ActiveX Component) that contains all of the methods andproperties you have created. If your Class raises events, you also have an additional interfacecalled IConnectionPointContainer. When you build an ActiveX Control or Server, theseInterfaces are given a unique identifier. If you modify your control or server, these interfacesmay 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 theappropriate Compatibility setting.

167 / 318

Page 168: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

Visual Basic has three different compatibility settings for Projects:

• No compatibility.

• Project compatibility.

• Binary compatibility.

168 / 318

Page 169: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

No Compatibility

With this setting, no compatibility is enforced. Visual Basic creates new Interface IDs and ClassIDs every time you build or compile your project. Each version built can only be used withapplications 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. Whilenew type library information is generated, the type library identifier is maintained so that testprojects can still refer to the component project. This setting is for maintaining compatibilityduring testing. Therefore, once the component is released, it behaves the same as the NoCompatibility setting.

Binary Compatibility

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

50. What is the necessity for Resume Next?

169 / 318

Page 170: Complete Dotnet Course Material

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

Page 171: Complete Dotnet Course Material

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 componentis an .exe file that runs in its own process, with its own thread of execution. Communicationbetween a client and an out-of-process component is therefore called cross-process orout-of-process communication.

An in-process component, such as a .dll or .ocx file, runs in the same process as the client. Itprovides the fastest way of accessing objects, because property and method calls don’t have tobe marshaled across process boundaries. However, an in-process component must use theclient’s thread of execution.

In-process components execute in the process space of the calling application; out-of-processcomponents 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 getsits own memory address space that's inaccessible to other processes. When an applicationinstantiates an object from an in-process component (DLL, OLE custom control—OCX), codeexecutes in the calling application. This calling application is called the client. The in-process

171 / 318

Page 172: Complete Dotnet Course Material

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 whatrole that content plays (for example, content in a section heading has a different meaning from

172 / 318

Page 173: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

content in a footnote, which means something different than content in a figure caption orcontent 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 specificationdefines 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 forHTML.

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, althoughXML demands that the user pay attention to the little details. Next I will explain some of thenew rules that XML uses that make its use slightly different from that of HTML.

173 / 318

Page 174: Complete Dotnet Course Material

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 thatdescribes how to display an XML document of a given type. XSL shares the functionality and iscompatible with CSS2 (although it uses a different syntax). It also adds:

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

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

174 / 318

Page 175: Complete Dotnet Course Material

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 theinformation stored in XML documents using any programming language (and a parser for thatlanguage). However, both of them take very different approaches to giving you access to yourinformation: DOM creates a tree of nodes (based on the structure and information in your XMLdocument) and you can access your information by interacting with this tree of nodes. DOMgives you access to the information stored in your XML document as a hierarchical objectmodel. 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 ofa stream of parsing events. Application then processes those events to act on data. SAX is veryuseful when the document is large.

175 / 318

Page 176: Complete Dotnet Course Material

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

Page 177: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

• Response

• Server

• Session

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

COLLECTION PROPERTIES

Contents Object

177 / 318

Page 178: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

StaticObjects Object

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

METHODS

178 / 318

Page 179: Complete Dotnet Course Material

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 inorder to make changes.

179 / 318

Page 180: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

EVENTS

OnEnd Event

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

OnStart Event

180 / 318

Page 181: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

• ASPError

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

PROPERTIES

181 / 318

Page 182: Complete Dotnet Course Material

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 erroras compared to the short description returned by the Description property. (Not available for allerrors.)

Category Property

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

Column Property

182 / 318

Page 183: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

Description Property

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

File Property

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

Line Property

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

183 / 318

Page 184: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Number Property

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

Source Property

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

ObjectContext object

The ObjectContext object is used to control Active Server Pages transactions which aremanaged by the Microsoft Transaction Server (MTS). You may either complete (commit) orabort 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 completetionunless an abort occurs.

184 / 318

Page 185: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

METHODS

SetAbort Method

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

SetComplete Method

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

185 / 318

Page 186: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

EVENTS

OnTransactionAbort Event

The OnTransactionAbort event occurs when a transaction has been aborted for some kind ofprocessing 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 thebrowser to the server. This information is stored among five types of Request collections. Acollection is similar to a data structure or array. Individual items in the collection are accessedvia a unique key assigned to that item.

186 / 318

Page 187: Complete Dotnet Course Material

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 HTTPrequest.

187 / 318

Page 188: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

COLLECTION PROPERTIES

ClientCertificate Collection Property

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

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 formusing the POST method.

188 / 318

Page 189: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

QueryString Collection Property

The QueryString collection property contains the values of the variables in the HTTP querystring, 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 partof a POST request, and returns the number of bytes read.

189 / 318

Page 190: Complete Dotnet Course Material

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

Page 191: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

CacheControl Property

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

Charset Property

The Charset property appends the name of the character set being used to the content-typeheader 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 browserexpires.

191 / 318

Page 192: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

ExpiresAbsolute Property

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

IsClientConnected Property Modified in version 3.0

The IsClientConnected property indicates whether the browser has disconnected from theserver 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

Page 193: Complete Dotnet Course Material

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 thecookie.

METHODS

AddHeader Name, Value Method

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

193 / 318

Page 194: Complete Dotnet Course Material

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 thisrequest.

BinaryWrite (Data) Method

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

Clear Method

The Clear method clears (erases) any buffered HTML outpu

End Method

194 / 318

Page 195: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The End method causes the web server to stop processing the script and to return the currentresults 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

Page 196: Complete Dotnet Course Material

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

Page 197: Complete Dotnet Course Material

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 thecalled ASP page completes its tasks, you are then returned to the calling ASP page.

GetLastError Method Implemented in version 3.0

197 / 318

Page 198: Complete Dotnet Course Material

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-inobjects from one ASP page to another. Unlike the Execute method, when the ASP page thatyou have transferred to is finished, you do not return the original ASP page.

198 / 318

Page 199: Complete Dotnet Course Material

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 informationconcerning the user session. By default, the Session object is destroyed after a session hasbeen idle for twenty minutes.

PROPERTIES

CodePage Property

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

199 / 318

Page 200: Complete Dotnet Course Material

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

Page 201: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Contents Collection Property

The Contents collection property contains all of the items that have been created and added tothe 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 fileusing 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 currentSession object, and releases its resources.

201 / 318

Page 202: Complete Dotnet Course Material

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 handlerscript in the Global.asa file, if the script exists.

OnStart Event

202 / 318

Page 203: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The OnStart event occurs before the start of any new Session by a user. The signal of thisevent 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 typethat can contain different kinds of information, depending on how it's used. Because Variant isthe only data type in VBScript, it's also the data type returned by all functions in VBScript.

203 / 318

Page 204: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

At its simplest, a Variant can contain either numeric or string information. A Variant behaves asa number when you're using it in a numeric context and as a string when you use it in a stringcontext. That is, if you're working with data that looks like numbers, VBScript assumes that it isnumbers and does the thing that is most appropriate for numbers. Of course, you can alwaysmake numbers behave as strings, by enclosing them in quotation marks. Similarly, if you'reworking 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 distinctionsabout the specific nature of numeric information. For example, you can have numericinformation that represents a date or a time. When used with other date or time data, the resultis always expressed as a date or a time. Of course, you can also have a rich variety of numericinformation ranging in size from Boolean values to huge floating-point numbers. These differentcategories of information that can be contained in a Variant are called subtypes. Most of thetime, you can just put the kind of data you want in a Variant and it behaves in a way that is mostappropriate for the data it contains.

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

204 / 318

Page 205: Complete Dotnet Course Material

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

Page 206: Complete Dotnet Course Material

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 December31, 9999.

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

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 functionsyou can use. In addition, the VarType function returns information about how your data is storedwithin a Variant.

206 / 318

Page 207: Complete Dotnet Course Material

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 constraintviolations. 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 typeconstraint violations. If no checking is done, it is weakly typed.

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

5. A language is strongly typed if conversions between different types must be indicatedexplicitly. 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 typesystem. 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 compoundtypes. If it has only a few types, or only scalar types, it is weakly typed.

207 / 318

Page 208: Complete Dotnet Course Material

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 overthe 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

Page 209: Complete Dotnet Course Material

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 NTSecurity. ASP files can be easily restricted to just certain users through secure Windows NTauthentication, basic Web authentication, or client-side certificates. For additional security, allclient-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 restrictunauthorized users from using the application

SSL

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

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

* HTML and DHTML

209 / 318

Page 210: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* Say you are designing a product page – the products list is constant? How will you design thispage? (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

Page 211: Complete Dotnet Course Material

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 pagescope. Storing STAs in a Session variable locks the object down to the thread that created theobject, defeating the purpose of a thread pool. Storing an STA in Application scope serializesaccess for all users.

211 / 318

Page 212: Complete Dotnet Course Material

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 yourapplication will suffer serious serialization issues . This limitation usually raises the question ofwhat 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 scriptcan improve performance. If you have hundreds of lines of ASP script in a single page, perhapsyou 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 helpyou gauge whether you are using them efficiently. When ASP processes includes, it reads theentire file into memory. Because ASP will cache the entire expanded code (your page + the

212 / 318

Page 213: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

include), not just the functions you call, you may end up with large, inefficient namespaces thatASP must search when calling methods or looking up variables. Note that this process occursfor each page that uses the include. A good guide is to create fine-grained includes, so that youcan 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 betweenserver-side and client-side code. This switching usually happens when concatenating HTMLwith 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 InternetInformation Server (IIS) 4.0.

When buffering is on, ASP will wait until processing is complete before sending down theresponse, 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

Page 214: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

particularly over slow connections.

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

Are you using Session state?

ASP Sessions are a convenient facility, but they limit scalability. Sessions limit the scalability ofa single box because they consume resources for each user. While Session size is largelydetermined 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, becauseeach Session is Web-server specific.

214 / 318

Page 215: Complete Dotnet Course Material

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 directorythrough the ISM (Internet Services Manager). Disabling Session state allows ASP to skip anextensive 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 itthreatens the scalability of your application. Determining what to cache is based on datavolatility and scope. Data that is static or used application-wide can be a good candidate forcaching. 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 applicationgoals, 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 asXML. However, if your application will be rendering the same HTML repeatedly, such as todisplay a list box of countries, you might cache the HTML string in Application scope, ratherthan just the data

Are you redimensioning arrays?

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

215 / 318

Page 216: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

spending extra processor cycles to redimension the array, but also that the process initiallyrequires twice as much memory for the copy. However, if you allocate more space than youneed initially (you need only five elements initially, but allocate space for 128), then adding moredata 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 enginesuse Thread Local Storage (TLS), so multiple threads cannot use an instance of a script engineconcurrently. Therefore, five simultaneous requests to the same page will cause ASP toinstantiate five script engines. More engines means more overhead, so you may be able to gainsome 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 byquitting methods if the client is no longer connected. Note that IIS 5.0 overcomes a limitation inIIS 4.0 (the need to send content to the browser before checking the property).

Are you using Server.MapPath unnecessarily?

216 / 318

Page 217: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

Are you parsing strings?

Use regular expressions in validation routines, in formatting functions, and instead of loopingthrough 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 ofstatements 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

Page 218: Complete Dotnet Course Material

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 manyperformance and scalability issues if those objects aren't designed to be shared across threadsor activities. Only agile components -- or, in Windows 2000, components marked Neutral -- canbe 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, useSQL Server rather than a roll-your-own solution. SQL Server provides high-performancemiddle-tier caching

Are you concatenating strings in components?

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

218 / 318

Page 219: Complete Dotnet Course Material

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 whethermethods actually need transactions. For example, if you're grabbing a recordset to hand off to abrowser client for reading data, you don't need a transaction. By factoring out operations thatread data into separate components from operations that perform updates, you have moreflexibility 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 liveoutside the scope of its transaction. In Windows 2000, COM+ provides the setting 'Automaticallydeactivate this object when this method returns,' which performs the equivalent code. You canenable this setting on a per-method basis in the Component Services console.

Are you crossing processes effectively?

219 / 318

Page 220: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Minimizing marshaling overhead and reducing network calls are keys to improving performanceof distributed applications. Use early binding in your components to minimize expensive networkround trips by eliminating the extra call to GetIdsOfNames that late binding incurs. You canfurther 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, passByVal 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 slowyour application to a crawl, while good indexes will help optimize your application'sperformance.

Are you calling stored procedures rather than dynamic SQL?

Using stored procedures prevents your database from having to recompile your SQL statementsrepeatedly. 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 andonly the necessary rows. If you have queries that can potentially return a lot of records, considerpaging through your recordsets.

220 / 318

Page 221: Complete Dotnet Course Material

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. Createconnection at page scope or within the functions that need them, and set the connections tonothing 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 isdiscouraged). 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 objectvariables.

Are you reusing Recordset and Command variables?

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

Are you disconnecting the recordsets?

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

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

221 / 318

Page 222: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

Are you using DSN-less connections?

In general, DSN-less connections are faster than System DSNs (data source names), which arefaster 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 threadof execution

Are you using SSL?

Secure Sockets Layer (SSL) is expensive in terms of bandwidth and CPU usage. If you're usingSSL, 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

Page 223: Complete Dotnet Course Material

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

Page 224: Complete Dotnet Course Material

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 anotherapplication.

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

224 / 318

Page 225: Complete Dotnet Course Material

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) youwould 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 wantto manipulate. In the VB Editor of any Office application, or in VB itself, you do this by selectingTools + References, and selecting the application you want from the list (e.g. “Microsoft Excel8.0 Object Library”).

To create a new instance of Excel using early binding:

Dim oXL As Excel.Application

225 / 318

Page 226: Complete Dotnet Course Material

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 thatreturns 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 recommendand why?

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

226 / 318

Page 227: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Visual Basic’s implementation of apartment-model threading eliminates conflicts in accessingglobal 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 manyperformance and scalability issues if those objects aren't designed to be shared across threadsor activities. Only agile components -- or, in Windows 2000, components marked Neutral -- canbe referenced in Session or Application variables with direct access by client threads

* Compatibility settings in vb?

227 / 318

Page 228: Complete Dotnet Course Material

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 ID’s, new interface ID’s and a new type library ID will be generatedby VB each time the ActiveX component project is compiled. This will cause any compiled clientcomponents to fail (with error 429!) and report a missing reference to the 'VB ActiveX TestComponent' 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

Page 229: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

With this setting, VB will generate new interface ID’s for classes whose interfaces havechanged, but will not change the class ID’s or the type library ID. This will still cause anycompiled 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 ofclient components will restore them to working order again.

TIP: Use this setting during the initial development and testing of a component within the IDEand 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 andproperties etc. and yet still retain binary compatibility. It can do this, because it silently creates anew interface ID for the extended interface and adds registration code to register the originalinterface ID but with a new Forward key containing the value of this new interface ID. COM willthen substitute calls having the old ID with the new ID and hence applications built against theold interface will continue to work (assuming the inner workings of the component remainbackward compatible!).

229 / 318

Page 230: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

With this setting, VB will not change any of the existing class, interface or type library ID’s,however in order that it can do so, VB requires the project to specify an existing compiledversion 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 cleanbreak. 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. Takingthis approach ensures that existing applications can continue to work with the old componentwhile new versions can use the new component.

230 / 318

Page 231: Complete Dotnet Course Material

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 shouldbe selected thereby causing new class, interface and type library ID’s to be generated. (Onlyuse 'Project Compatibility' during the initial development of a component within the IDE andbefore 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

Page 232: Complete Dotnet Course Material

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 cannotchange.

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

232 / 318

Page 233: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

allow different versions to be correctly distinguished. You should also update the compatibleimage in the 'Compat' folder with the latest compiled component binary once the component hasbeen successfully tested and released to other developers. It is a good habit to do this evenwhen 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. Theline 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

Page 234: Complete Dotnet Course Material

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 followingthe statement where the error occurred where execution continues. Use this form rather thanOn 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

Page 235: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* What is the necessity for Resume Next?

On Error Resume Next causes execution to continue with the statement immediatelyfollowing the statement that caused the run-time error, or with the statement immediatelyfollowing the most recent call out of the procedure containing the On Error Resume Nextstatement. This statement allows execution to continue despite a run-time error. You can placethe error-handling routine where the error would occur, rather than transferring control toanother location within the procedure. An On Error Resume Next statement becomes inactivewhen another procedure is called, so you should execute an On Error Resume Next statementin 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 sameprocess.

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

be destroyed, automatically.

235 / 318

Page 236: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

* ActiveX.exe example.

Winword.exe, Dllhost.exe

* what is COMInterop?

236 / 318

Page 237: Complete Dotnet Course Material

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 stillmake late-bound calls to your components using Server.CreateObject.

While late binding to components is still supported, early binding is a better choice forperformance 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 toequivalent .NET Framework assemblies by building managed wrappers around thecomponents. The converted components can be early-bound to managed code for greatlyincreased performance

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

<%@Import Namespace="MyNewNamespace"%>

237 / 318

Page 238: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

When using single-threaded (STA) COM components, such as components developed usingVisual Basic, from an ASP.NET page, you must include the compatibility attributeaspcompat=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 anexception if the compatibility tag is omitted and an STA component is referenced on the page. Ifyou convert the STA component to an assembly using TlbImp, the runtime does not detect thatthe component uses the STA model and does not throw an exception, but your application cansuffer from poor performance and possible deadlocks. STA components cannot be used from.NET Framework code modules (compiled .NET assemblies); they can be used only fromASP.NET pages.

238 / 318

Page 239: Complete Dotnet Course Material

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 allobjects that follow this modle.

DCOM is just Distributed COM . It is really just a COM object that may be located on anothermachine 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 fromanother location and still use it.

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

239 / 318

Page 240: Complete Dotnet Course Material

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 theQueryInterface method, and manage the existence of the object through the IUnknown::AddRefand 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 forevery interface.

240 / 318

Page 241: Complete Dotnet Course Material

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

Page 242: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

* What is IDispatch?

Interface that exposes objects, methods and properties to programming tools and applicationsthat 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

Page 243: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

GetIDsOfNames

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

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/0598/newnav.htm

Interruptible Async tasks:

243 / 318

Page 244: Complete Dotnet Course Material

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

Page 245: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Changes in VB.Net

ASP.NET does not support Visual Basic Scripting Edition (VBScript), but it does support VisualBasic .NET, which is very similar to VBScript. However, most existing ASP pages that containVBScript 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 includechanges 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 toexisting Visual Basic or VBScript applications.

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

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

245 / 318

Page 246: Complete Dotnet Course Material

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 ofVisual Basic. If you want to pass arguments by reference, you must use the ByRef keyword infront 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 assignmentoperation:

Object1 = Object2

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

246 / 318

Page 247: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

example:

Object1.Name = Object2.Name

• Most objects no longer have default properties. All nonindexed properties must beexplicitly referenced. In previous versions of Visual Basic, if you wanted to access the defaultproperty of an object, specifying the name of the property was optional. For example, if youwanted 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 whenretrieving 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 collectionproperty of the Recordset, does not have to be explicitly referenced because it is an indexedproperty and the argument provides sufficient information to the compiler to evaluate theexpression. The preceding line of code is functionally equivalent to the following line:

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

247 / 318

Page 248: Complete Dotnet Course Material

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 ANDexpression evaluates to False, evaluation of the expression terminates and the entireexpression 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 castnumerical 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, inVisual 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 kas 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

Page 249: Complete Dotnet Course Material

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 toavoid a syntax error.

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

• If x Then

• y

End if

249 / 318

Page 250: Complete Dotnet Course Material

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 compilersproduce 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 resultingassembly is called an interop assembly.

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

Generating Metadata

250 / 318

Page 251: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

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

Option Description

Visual Studio .NET

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

251 / 318

Page 252: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Type Library Importer

Provides command-line switches to adjust metadata in the resulting interop file, imports typesfrom 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 libraryinformation to metadata.

Custom Wrappers

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

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

252 / 318

Page 253: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Visual Studio .NET

Visual Studio .NET generates an interop assembly containing metadata when you add areference 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 performsthe 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 andinterfaces contained in a COM type library to metadata. This tool creates an interop assemblyand 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 cannotgenerate type information for a subset of the types defined in a type library.

253 / 318

Page 254: Complete Dotnet Course Material

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 Loanlibnamespace.

c:>tlbimp Loanlib.dll

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

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

TypeLibConverter Class

254 / 318

Page 255: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

The TypeLibConverter Class (in the System.Runtime.InteropServices namespace) providesmethods 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, theTypeLibConverter 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 ofthe class or interface in managed source code. You then compile the source code with acompiler 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 Frameworkclass definitions.

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

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

255 / 318

Page 256: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

What is operator overloading?

Operator overloading enables developers to define new struct types that behave much like thepredefined value types. For instance, a Digit struct can support the same mathematicaloperations as the predefined integral types, and can define conversions between Digit andpredefined 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 classfor which the operator overloading is defined.

256 / 318

Page 257: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

5. When an arithmetic operator is overloaded it implicitly overloads the correspondingassignment 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

Page 258: Complete Dotnet Course Material

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 aclass. Destructors cannot have parameters, cannot have accessibility modifiers, and cannot becalled 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 aninstance of a class.

What is a Static Constructor?

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

258 / 318

Page 259: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

A static constructor is only called once throughout the application's lifetime. The staticconstructor method is called when any of the defining class' members are first accessed. Theconstructor 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 somepoint before they are used, but after this initialization there is nothing to stop a client fromchanging them. Such a modification could cause unpredictable errors in other programs thatuse Color and assume that the values do not change. Readonly fields can be used to preventsuch problems.

259 / 318

Page 260: Complete Dotnet Course Material

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

Page 261: Complete Dotnet Course Material

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

Page 262: Complete Dotnet Course Material

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 asthere are no circular dependencies.

The rules governing constant expressions are defined in constant expression

The example

262 / 318

Page 263: Complete Dotnet Course Material

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 requiresnor 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

Page 264: Complete Dotnet Course Material

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 byan 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 ofthe class.

264 / 318

Page 265: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

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

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

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

What is a Property ?

265 / 318

Page 266: Complete Dotnet Course Material

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 andproperties is the same. However, unlike fields, properties do not denote storage locations.

Instead, properties have accessors that specify the statements to be executed when theirvalues 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) equivalentof a function pointer.

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

266 / 318

Page 267: Complete Dotnet Course Material

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 tointerested 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 theObserver pattern.

Delegates are registered with specific events at run time.

When the event is raised, all registered delegates are invoked so that they receive notificationof 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

Page 268: Complete Dotnet Course Material

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

Page 269: Complete Dotnet Course Material

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

Page 270: Complete Dotnet Course Material

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

Page 271: Complete Dotnet Course Material

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

Page 272: Complete Dotnet Course Material

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

Page 273: Complete Dotnet Course Material

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

Page 274: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Patterns:

Types of Patterns

Singlton Pattern implementation

Observer Pattern implementation

MVC Pattern implementation

UML:

274 / 318

Page 275: Complete Dotnet Course Material

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

Page 276: Complete Dotnet Course Material

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

Page 277: Complete Dotnet Course Material

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 aspxpages?

3)What is the diff between abstract class and interface

4)Can u use javascript in aspx

277 / 318

Page 278: Complete Dotnet Course Material

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

Page 279: Complete Dotnet Course Material

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 stepsbefore 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 thenamespace is stored

26)what is the version control in .net

279 / 318

Page 280: Complete Dotnet Course Material

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 signatureis 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

Page 281: Complete Dotnet Course Material

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

Page 282: Complete Dotnet Course Material

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

Page 283: Complete Dotnet Course Material

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

Page 284: Complete Dotnet Course Material

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

Page 285: Complete Dotnet Course Material

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

Page 286: Complete Dotnet Course Material

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 multipleapplications?

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

Page 287: Complete Dotnet Course Material

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 toldhim...that these two are not at all comparable. Two are different concepts. He argued with me. Ithink 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 Ineed to put .ASCX file in all applications? If no, where should I put?

30. What is Custom control?

287 / 318

Page 288: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

31. Is your own control in ASPX visible in Tool Box of Editor? (Answer: Yes, If we makecustom 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 wantme to write WEB.Config file for each application? If NO, where do I need to put my WEB.COnfigfile?

36. I dont want to place my WEB.Config in application path. I'll put it in some directory. Can Ido this?

37. Explain how do you do Forms authentication? (I explained him all the code andImplementation)

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

Page 289: Complete Dotnet Course Material

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 andSecurity.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

Page 290: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

53. Write Connection string for SQLConnection object.(remember --> Dont write Provider inthe 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 donthave theoritcal knowledge. I used it in ASP applications to register a DLL)

57. Study about Interface, Inheritance, OverLoad and OverRide. He asked different simple questions on these.

58. What types of sessions we have in ASP.NET? (I don’t 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

Page 291: Complete Dotnet Course Material

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 theanswer 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 offlate (pre-sales activities like estimation etc., involved in the design of a Biztalk to SAP adapterproject, 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 theapplication stack, whereas the Object types are user-defined types and are by default referencetypes and will be stored in the managed heap.

291 / 318

Page 292: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

Note: A thread of discussion started here to know the depth of my understanding about thestack 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 functionor the execution block in which they are declared. Whereas the reference types are used foruser-defined types which need to retain the state across function calls and have a lifetime whichis 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

Page 293: Complete Dotnet Course Material

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 istruncated 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 outto-night and you will be surprised to see the result”. Which in fact I did and didn’t find anysurprise. May be there’s some undocumented feature of .NET here.

Q. What does the new keyword do w.r.t inheritance?

A. It hides the base class’s implementation.

293 / 318

Page 294: Complete Dotnet Course Material

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 Shapeas the base class and Circle, Rectangle as the derived classes. Explained him aboutgeneralization to specialization.

Composition is a strong form of containment, where the part’s lifetime is dependent on thewhole. 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

Page 295: Complete Dotnet Course Material

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 explainedthe 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

Page 296: Complete Dotnet Course Material

COMPLETE DOTNET COURSE MATERIAL AND FAQ

A. In a clustered-index, the data page and the index page are same whereas in a non-clusteredindex, the data pages and the index page is separate.

Q. How do you implement an index?

A. I haven’t 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 notspecified in the SQL query.

Right outer join will also involve the fields of the table on the right of the join query that are notspecified 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

Page 297: Complete Dotnet Course Material

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 theproject?

Second Round of Interview Questions from Redmond

He upfront informed me that he had a question before the interview starts and asked mewhether I had VB knowledge. Since I didn't have any VB experience, I informed him about thesame and briefed him about my skillset (VC++, C++, C#, COM etc.,). He was in a opinion thatthere was a miscommunication regarding job description and there is no point in continuing theinterview

01. What is GAC?

297 / 318

Page 298: Complete Dotnet Course Material

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

Page 299: Complete Dotnet Course Material

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 connectionpools 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

Page 300: Complete Dotnet Course Material

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 datasourcechanges?

Analytical Question

1. We got 3 sealed boxes one with Red other with Blue and the other with Green balls. Eachbox has a label denoting the color of the balls that it contains. But the labels for all the boxes rpasted wrongly. Now how many boxes should u open to find the color of balls in all the 3boxes?

Ans: 1

1)what is xmldatadocument and xmldocument

2)what is response.buffer

300 / 318

Page 301: Complete Dotnet Course Material

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

Page 302: Complete Dotnet Course Material

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

Page 303: Complete Dotnet Course Material

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

Page 304: Complete Dotnet Course Material

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

Page 305: Complete Dotnet Course Material

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

Page 306: Complete Dotnet Course Material

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

Page 307: Complete Dotnet Course Material

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

Page 308: Complete Dotnet Course Material

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

Page 309: Complete Dotnet Course Material

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

Page 310: Complete Dotnet Course Material

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 aspxpages?

3)What is the diff between abstract class and interface

310 / 318

Page 311: Complete Dotnet Course Material

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

Page 312: Complete Dotnet Course Material

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 stepsbefore 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 thenamespace is stored

26)what is the version control in .net

312 / 318

Page 313: Complete Dotnet Course Material

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 signatureis 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

Page 314: Complete Dotnet Course Material

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

Page 315: Complete Dotnet Course Material

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

Page 316: Complete Dotnet Course Material

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

Page 317: Complete Dotnet Course Material

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

Page 318: Complete Dotnet Course Material

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