Monday, February 23, 2009

dotnet faqs -II

What is Code Refactoring?
Its a feature of Visual Web Express & Visual Studio 2005. Code Refactoring Code Refactoring enables you to easily and systematically make changes to your code. Code Refactoring is supported everywhere that you can write code including both code-behind and single-file ASP.NET pages. For example, you can use Code Refactoring to automatically promote a public field to a full property.

What is Property ?
A property is a thing that describes the features of an object. A property is a piece of data contained within class that has an exposed interface for reading/writing. Looking at that definition, you might think you could declare a public variable in a class and call it a property. While this assumption is somewhat valid, the true technical term for a public variable in a class is a field. The key difference between a field and a propertyis in the inclusion of an interface. We make use of Get and Set keywords while working with properties. We prefix the variables used within this code block with an underscore. Value is a keyword, that holds the value which is being retrieved or set.
Private _Color As String
Public Property Color()
Get
Return _Color
End Get
Set(ByVal Value)
_Color = Value
End Set
End Property

What does the term immutable mean?
It means to create a view of data that is not modifiable and is temporary of data that is modifiable.

Immutable means you can't change the currrent data,but if you perform some operation on that data, a new copy is created. The operation doesn't change the data itself. Like let's say you have a string object having "hello" value. Now if yousay temp = temp + "new value" a new object is created, and values is saved in that. The temp object is immutable, and can't be changed.

An object qualifies as being called immutable if its value cannot be modified once it has been created. For example, methods that appear to modify a String actually return a new String containing the modification. Developers are modifyingstrings all the time in their code.

This may appear to the developer as mutable - but it is not. What actually happens is your string variable/object has been changed to reference a new string value containing the results of your new string value. For this very reason .NET has the System.Text.StringBuilder class. If you find it necessary to modify the actual contents of a string-like object heavily, such as in a for or foreach loop, use the System.Text.StringBuilder class.

What is Class ?
A class is an organized store-house in object-oriented programming that gives coherent functional abilities to a group of related code. It is the definition of an object, made up of software code. Using classes, we may wrap data and behaviour together (Encapsulation).We may define classes in terms of classes (Inheritance).We can also override the behaviour of a class using an alternate behaviour (Polymorphism).

Web.config file in ASP.NET?
Web.config file, as it sounds like is a configuration file for the Asp .net web application. An Asp .net application has one web.config file which keeps the configurations required for the corresponding application. Web.config file is written in XML with specific tags having specific meanings. We have Machine.config file also. As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.

How to Create Virtual Directory?
1. Click “Startàsettingsàcontrol Panel àAdministrative Toolsàinternet information services”
2. Expand Internet Information Server.
3. Expand the server name.
4. In the left pane, right-click Default Web Site, point to New, and then click Virtual Directory.
5. In the first screen of the New Virtual Directory Wizard, type an alias, or name, for the virtual directory (SiteName), and then click Next.
6. In the second screen, click Browse. Locate the content folder that you created to hold the Web content. Click Next.
7. In the third screen, click to select Read and Run scripts (such as ASP). Make sure that the other check boxes are cleared. Click Finish to complete the wizard.

Diffrence between Abstract and Interface?
1.We can't create instances for both
2.Single inheritance in abstract class, multible inheritance in interface
3.We can have concrete method in abstact class but not in the interface.
4.Any class that needs to use abstract must extent
5.Any class that needs to use interface must implement
6.Interface all the variables are static and final.

Diffrence between Viewstate and Session?
View State are valid mainly during postbacks and information is stored in client only. Viewstate are valid for serializable data only. Moreover Viewstate are not secured as data is exposed to client. although we can configure page directive and machine key to make view state encrypted.

Where in case of session this is user specific data that is stored in server memory . Session state is valid for any type of objects. We can takehelp of session through different web pages also.

ASP.NET in Linux ?
Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Sponsored by Novell, the Mono open source project has an active and enthusiastic contributing community and is positioned to become the leading choice for development of Linux applications.

ArrayList in asp.net?
(1)Its capacity is increased if required as objects are added to it. So it frees programmer from the worries of array overflow.
(2)Provides methods to perform common operations -- append, insert, remove, replace etc.
(3)There is no restriction on the type of objects which can be added to an arraylist. First object could be a (4)string, second a double, third a user defined object and so on.
(5)ArrayList can be made read only after adding elements to prevent unintentional modifications.
(6)It provides an overloaded method to perform binary search on its objects.

Something about Session or Session Management & Application? sessions can stored in cookies . cookieless session is also available.for cookie less session it wil create unique session id for each session. it wil be automatically retrieved in URL.

state management can be like, user sessions can be stored in 3 ways .

Inproc - stored in asp.net worker process,
stateserver- stored in window service .
sqlserver- user sessions can be stored in sqlserver also.

Application Start This Event is fired when the server which holding application starts whereas Session Start eventis fired when any User has access that page or Session has been created. Suppose we want to track that how many users have accessed our sites today then Application Start is the best place to do so or we want to give some personalised view to User than Session is the best place.

How to Write to XML File ?
XmlTextWriter textWriter=new XmlTextWriter("filename.xml");
//WriteStartDocument and WriteEndDocument methods open and close a document for writing
textWriter.WriteStartDocument()
//write comment
textWriter.WriteComment("this is my first xml file.")
textWriter.WriteComment("i'm lovin it")
textWriter.WriteStartElement("studentDB")//write first element textWriter.WriteStartElement("student")
textWriter.WriteStartElement("name","");
textWriter.WriteString("sourabh");
textWriter.WriteEndElement();
textWriter.WriterEndElement();
textWriter.WriteEndDocument();
textWriter.Close();
}

What is Boxing & Unboxing ?
Value Types are stored on the stack and Reference types are stored on the heap. The conversion of value type to reference type is known as Boxing. Converting reference type back to value type is known as Unboxing.

Value Types - Value types are primitive types that are mapped directly to the FCL. Like Int32 maps to System.Int32, double maps to System.double.All value types are stored on stack and all the value types are derived from System.ValueType. All structures and enumerated types that are derived from System.ValueType are created on stack, hence known as ValueType.

Reference Types - Reference Types are different from value types in such way that memory is allocated to them from the heap. All the classes are of reference type. C# new operator returns the memory address of the object.

Define three test cases you should go through in unit testing?
1)Positive test cases (correct data, correct output).
2)Negative test cases (broken or missing data,proper handling).
3)Exception test cases (exceptions are thrown and caught properly).

What debugging tools come with the .NET SDK?
1. CorDBG – command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch.
2. DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR.

What does assert() method do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

What is DiffGram?
A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessaryinformation to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.

Diffrence Between ServerSide and ClientSideCode?
server side code is responsible to execute and provide the executed code to the browser at the client side. The executed code may be either in XML or Plain HTML. the executed code only have the values or the results that are executed on the server. The clients browser executes the HTML code and displays the result. where as the client side code executes at client side and displays the result in its browser. it the client sidecore consist of certain functions that are to be executed on server then it places request to the server and the server responses as the result in form of HTML.

Something about Session ?
Sessions can be managed by two ways in case of webfarms:
1. Using SQL server or any other database for storing sessions regarding current logged in user.
2. Using State Server, as one dedicated server for managing sessions. State Server will run as service on web server having dotnet installed.In ASP.NET there is three ways to manage session objects. one support the in-proc mechanism and other two's support the out-proc machanism.

1) In-Proc (By Default)
2) SQL-Server (Out-proc)
3) State-Server (Out-Proc)

What is Server.Transfer and Response.Redirect ?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url.

Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

What is EnabledViewState?
"EnableViewState" property - holds the state of the web control. View state holds the proprty details as a group of a particular web control. And can be sent via HTTPEnable view state must eb enableed for transfering throught he HTTP requests.If, the webserver control is using the database request, then it is advisable to make the Enable viewState = false, to improve the processor performance, cause the database will overide the state.

Server Control and User Control ?
An ASP.NET control (sometimes called a server control) is a server-side component that is shipped with .NET Framework.A server control is a compiled DLL file and cannot be edited. It can, however, be manipulated through its public properties at design-time or runtime. It is possible to build a custom server control (sometimes called a custom control or composite control). (We will build these in part 2 of this article). In contrast, a user control will consist of previously built server controls (called constituent controls when used within a user control). It has an interface that can be completely edited and changed. It can be manipulated at design-time and runtime via properties that you are responsible for creating. While there will be a multitude ofcontrols for every possible function built by third-party vendors for ASP.NET, they will exist in the form of compiled server controls, as mentioned above. Custom server controls may be the .NET answer to ActiveX Web controls.

Diffrence Between ASP ASp.NET ?
The points of difference are as follows:ASP.Net web forms have a code behind file which contains all event handling code. ASP does not have such facility to separate programming logic from design. ASP.Net web forms inherit the class written in code behind. ASP does not have the concept of inheritance.ASP.Net web forms use full fledged programming language, while ASP pages use scripting language.ASP.Net web applications are configurable (web.config) while ASP applications are not.ASP.Net webforms can use custom controls through the @register directive, which is not available with ASP.ASP.Net web forms have ADO.Net which supports XML integration and integration of data from two or more data sources, while ASP has ADO which is a simple COM object with limited facilities.

ACID in transactions.
A transaction must be:
1.Atomic - it is one unit of work and does not dependent on previous and following transactions.
2.Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.

What is Code Refactoring?
Its a feature of Visual Web Express & Visual Studio 2005. Code Refactoring Code Refactoring enables you to easily and systematically make changes to your code. Code Refactoring is supported everywhere that you can write code including both code-behind and single-file ASP.NET pages. For example, you can use Code Refactoring to
automatically promote a public field to a full property.

Question:-What is Property ?
A property is a thing that describes the features of an object. A property is a piece of data contained within class that has an exposed interface for reading/writing. Looking at that definition, you might think you could declare a public variable in a class and call it a property. While this assumption is somewhat valid, the true technical term for a public variable in a class is a field. The key difference between a field and a property
is in the inclusion of an interface.

We make use of Get and Set keywords while working with properties. We prefix the variables used within this code block with an underscore. Value is a keyword, that holds the value which is being retrieved or set.

Private _Color As String
Public Property Color()
Get
Return _Color
End Get
Set(ByVal Value)
_Color = Value
End Set
End Property

Question:-What does the term immutable mean?
Ans.It means to create a view of data that is not modifiable and is temporary of data that is modifiable. Immutable means you can't change the currrent data,but if you perform some operation on that data, a new copy is created. The operation doesn't change the data itself. Like let's say you have a string object having "hello" value. Now if you
say
temp = temp + "new value"
a new object is created, and values is saved in that. The temp object is immutable, and can't be changed. An object qualifies as being called immutable if its value cannot be modified once it has been created. For example, methods that appear to modify a String actually return a new String containing the modification.

Developers are modifying strings all the time in their code. This may appear to the developer as mutable - but it is not. What actually happens is your string variable/object has been changed to reference a new string value containing the results of your new string value. For this very reason .NET has the System.Text.StringBuilder class. If you find it necessary to modify the actual contents of a string-like object heavily, such as in a for or foreach loop, use the System.Text.StringBuilder class.

Question:-Server Control and User Control ?
An ASP.NET control (sometimes called a server control) is a server-side component that is shipped with .NET Framework.
A server control is a compiled DLL file and cannot be edited. It can, however, be manipulated through its public properties at design-time or runtime. It is possible to build a custom server control (sometimes called a custom control or composite control). (We will build these in part 2 of this article).

In contrast, a user control will consist of previously built server controls (called constituent controls when used within a user control). It has an interface that can be completely edited and changed. It can be manipulated at design-time and runtime via properties that you are responsible for creating. While there will be a multitude of
controls for every possible function built by third-party vendors for ASP.NET, they will exist in the form of compiled server controls, as mentioned above. Custom server controls may be the .NET answer to ActiveX Web controls.

Question:-Diffrence Between ASP ASp.NET ?
The points of difference are as follows:
ASP.Net web forms have a code behind file which contains all event handling code. ASP does not have such facility to separate programming logic from design.
ASP.Net web forms inherit the class written in code behind. ASP does not have the concept of inheritance.
ASP.Net web forms use full fledged programming language, while ASP pages use scripting language.
ASP.Net web applications are configurable (web.config) while ASP applications are not.
ASP.Net webforms can use custom controls through the @register directive, which is not available with ASP.
ASP.Net web forms have ADO.Net which supports XML integration and integration of data from two or more data sources, while ASP has ADO which is a simple COM object with limited facilities.

Question:-Connection String ?
ODBC
Standard Security:"Driver={SQLServer};Server=UrServerName;Database=pubs;Uid=myUsername;Pwd=myPassword;"

Trusted connection:"Driver={SQLServer};Server=UrServerName;Database=pubs;Trusted_Connection=yes;"

Prompt for username and password:oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};Server=UrServerName;DataBase=pubs;"


OLE DB, OleDbConnection (.NET)

Standard Security:"Provider=sqloledb;Data Source=UrServerName;Initial Catalog=pubs;User Id=myUsername; Password=myPassword;"

Trusted Connection:"Provider=sqloledb;Data Source=UrServerName;Initial Catalog=pubs;Integrated Security=SSPI;"

(use serverName\instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)

Prompt for username and password:
oConn.Provider = "sqloledb" oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Data Source=UrServerName; Initial Catalog=pubs;"

Connect via an IP address:"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;
Initial Catalog=pubs;User ID=myUsername;Password=myPassword;"
(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))

SqlConnection (.NET)

Standard Security:"Data Source=UrServerName;Initial Catalog=pubs;User Id=myUsername;Password=myPassword;"

OR
"Server=UrServerName;Database=pubs;UserID=myUsername;Password=myPassword;
Trusted_Connection=False
(both connection strings produces the same result)

Trusted Connection:"Data Source=UrServerName;Initial Catalog=pubs;Integrated Security=SSPI;"

OR
"Server=UrServerName;Database=pubs;Trusted_Connection=True;"
(both connection strings produces the same result)
(use serverName\instanceName as Data Source to use an specific SQLServer instance, only SQLServer2000)

Connect via an IP address:
"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=myUsername; Password=myPassword;"

(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the
Data Source is the port to use (1433 is the default))

Data Shape
MS Data Shape "Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=UrServerName;Initial Catalog=pubs;
User ID=myUsername;Password=myPassword;"


Question:-Connection string Parameter?
Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\Northwind.mdbParameters in a Connection String - The parameters depends on which data provider is being used.

Server - The name of the SQL Server we wish to access. This is usually the name of the computer that is running SQL server. We may use "local" or "localhost" for local computer. If we are using named instances of SQL server, then the parameter would contain the computer name, followed by a backslash, followed by the named instance of the SQL server.

Database - The name of the database we want to connect to.

User ID - A user ID configured in the SQL Server by the SQL Server administrator.

Password - The password associated with the user ID used.

Note that connection string can also contain the Windows NT account security settings. This is done very simple, by passing the paramater "integrated security=true".

Question:-Diffrence between HTML control and Server Control ?
ASP.NET Server Controls
Advantages:
1. ASP .NET Server Controls can however detect the target browser's capabilities and render themselves accordingly. No issues for compatibility issues of Browsers i.e page that might be used by both HTML 3.2 and HTML 4.0 browsers code to be written by you.
2. Newer set of controls that can be used in the same manner as any HTMl control like Calender controls. (No need of Activex Control for doing this which would then bring up issues of Browser compatibility).
3. Processing would be done at the server side. In built functionality to check for few values(with Validation controls) so no need to choose between scripting language which would be incompatible with few browsers.
4. ASP .NET Server Controls have an object model different from the traditional HTML and even provide a set of properties and methods that can change the outlook and behavior of the controls.
5. ASP .NET Server Controls have higher level of abstraction. An output of an ASP .NET server control can be the result of many HTML tags that combine together to produce that control and its events.

Disadvantages:
1. The control of the code is inbuilt with the web server controls so you have no much of direct control on these controls
2. Migration of ASP to any ASP.NET application is difficult. Its equivalent to rewriting your new application

HTML Server Controls
Advantages:
1. The HTML Server Controls follow the HTML-centric object model. Model similar to HTML
2. Here the controls can be made to interact with Client side scripting. Processing would be done at client as well as server depending on your code.
3. Migration of the ASP project thought not very easy can be done by giving each intrinsic HTML control a runat = server to make it HTML Server side control.
4. The HTML Server Controls have no mechanism of identifying the capabilities of the client browser accessing the current page.
5. A HTML Server Control has similar abstraction with its corresponding HTML tag and offers no abstraction.

Disadvantages:
1. You would need to code for the browser compatibility.

HTML Intrinsic Controls
Advantages:
1. Model similar to HTML
2. Here the controls can be made to interact with Client side scripting

Disadvantages:
You would need to code for the browser compatibility

Question:-What is correlated sub-query ?
A correlated sub-query is dependent upon the outer query. The outer query and the sub-query are related typically through a WHERE statement located in the sub-query. The way a correlated sub-query works is when a reference to the outer query is found in the sub-query, the outer query will be executed and the results returned to the sub-query.The sub-query is executed for every row that is selected by the outer query.

Question:- What is PostBack & Callback?
One technique that current ASP.NET 1.0/1.1 developers use to overcome this postback problem is to use the Microsoft XMLHTTP ActiveX object to send requests to server-side methods from client-side JavaScript. In ASP.NET 2.0, this process has been simplified and encapsulated within the function known as the Callback Manager.

The ASP.NET 2.0 Callback Manager uses XMLHTTP behind the scenes to encapsulate the complexities in sending data to and from the servers and clients. And so, in order for the Callback Manager to work, you need a web browser that supports XMLHTTP. Microsoft Internet Explorer is, obviously, one of them.

Question:-Types of Directive?
Directives in ASP.NET control the settings and properties of page and user control compilers. They can be included anywhere on a page, although it is standard to place them at the beginning. Directives are used in both .aspx files (ASP.NET pages) and .ascx files (user control pages). ASP.NET pages actually support eight different directives.
@ Page
@ Control
@ Import
@ Implements
@ Register
@ Assembly
@ OutputCache
@ Reference

Question:- What is AUTOEVENTWIREUP?
AutoEventWireup is a Boolean attribute that indicates whether the ASP.NET pages events are auto-wired.
Note: In the above case, ASP.NET compiles the code-behind page on the fly. We have to note that this compilation step only occurs when the code-behind file is updated. Whether the file has been updated or not, well this is detected through a timestamp change.

The AutoEventWireup attribute may have a value of true or false. When an ASP.NET Web Application is created by using Microsoft Visual Studio .NET, the value of the AutoEventWireup attribute is set as false.
We can specify the default value of the AutoEventWireup attribute in the following locations:

The Machine.config file.
The Web.config file.
Individual Web Forms (.aspx files).
Web User Controls (.ascx files)

The value of the AutoEventWireup attribute can be declared in the section in the Machine.config file or the Web.config file.
We must not set the value of the AutoEventWireup attribute to true if performance is key consideration.

If we set the value of the AutoEventWireup attribute to true, the ASP.NET page framework must make a call to the CreateDelegate method for every Web Form (.aspx page), and instead of relying on the automatic hookup, manually override the events from the page.

Question:what is ado.net ?
ADO.NET is the primary relational data access model for Microsoft .NET-based applications.
It may be used to access data sources for which there is a specific .NET Provider,or, via
a.NET Bridge Provider, for which there is a specific OLE DB Provider, ODBC Driver, or JDBC Driver.

Question:Diffrence between Code Directory and Bin Directory
With the introduction of this new Code directory, you might be wondering when to use which directory . If you have an assembly that you want to use in your Web site, create a Bin subdirectory and then copy the . dll to that subdirectory. If you are creating reusable components that you want to use from your ASP.NET pages, all you need to do is to create those components under the Code directory. Whenever a change occurs in the Code directory,
ASP.NET will dynamically recompile the components and automatically make them available to all the pages in the Web site. Note that you should put only components into the Code subdirectory . You should not put pages, Web user controls, or other non-code files ontaining non-code elements into this subdirectory.

Question:Diffrence between DataReader and DataAdapter
DateReader is an forward only and read only cursor type if you are accessing data through DataRead it shows the data on the web form/control but you can not perform the paging feature on that record(because it's forward only type).Reader isbest fit to show the Data (where no need to work on data)
DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand), It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet. where as Dataadapter is best fit to work on data.

Question:Does SQLClient and OLEdb class share the same function ?
No they are entirely different. Each has its own functionality. With OLEDB we can connect to any Datasource while SqlClient can be used to connect to Sql Server Database Only.

Question:Does SQLClient and OLEdb class share the same function ?
No they are entirely different. Each has its own functionality. With OLEDB we can connect to any Datasource while SqlClient can be used to connect to Sql Server Database Only.

Question:what is the difference between serializable and MarshalByRefObjec
In .net Remoting if ypu want your class to be participated in remoting it has to inherit from MarshalByRefObject class so that class definition can be passed by reference Where as [seraliazable] attribute is preceded before class that is can be seralized but this is used in conjuction with MarshalByValue class. Because when we pass by value then only we require this attribute.

Display the number of users/sessions currently active your website.
Using the Session_Start and Session_End Events

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
Application("UserCount") = Application("UserCount") + 1
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Application("UserCount") = Application("UserCount") - 1
End Sub

To Display UserCount, add a Label Control to the WebForm, name it lblUserCount

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Me.lblUserCount.Text = "User(s) online " & Application("UserCount")
End Sub

Display the number of users/sessions currently active your website.
Using the Session_Start and Session_End Events


Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
Application("UserCount") = Application("UserCount") + 1
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Application("UserCount") = Application("UserCount") - 1
End Sub

To Display UserCount, add a Label Control to the WebForm, name it lblUserCount

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Me.lblUserCount.Text = "User(s) online " & Application("UserCount")
End Sub

Question:-ASP.NET Web Forms ? How is this technology different than what is available though ASP?
Web Forms are the one of best feature of ASP.NET. Web Forms are the User Interface (UI) elements that give your Web applications their look and feel. Web Forms are similar to Windows Forms in that they provide properties, methods, and events for the controls that are placed onto them.However these UI elements render themselves in the appropriate markup language required by the request, e.g. HTML. If you use Microsoft Visual Studio .NET, you will also get the familiar drag-and-drop interface used to create your UI for your Web application.

Question:-Relationship between a Process/Application Domain/Application?A process is only a instance of running application. An application is an executable on the hard drive or network.
There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.

Question:How do I make a reference type parameter as a readoly parameter?Assuming that it is, and that all the data fields are only accessible via parameters, then you can create an interface for the class that only allows access to the parameters via a get. Add this interface to the class definition, then where you need the instance of the class to be read only, access it through the interface.

Question:Differnce in ASP.NET1.1 to ASP.NET2.0
In ASP.net 1.x:
function __doPostBack(eventTarget, eventArgument)
{
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
{
theform = document.Form1;
}
else
{
theform = document.forms["Form1"];
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();

---In ASP.net 2.x:
function __doPostBack(eventTarget, eventArgument)
{
if (!theForm.onsubmit || (theForm.onsubmit() != false))
{
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}

Question:To set the culture and UI culture for an ASP.NET Web page declarativelyTo set the UI culture and culture for all pages, add a globalization section to the Web.config file, and then set
the uiculture and culture attributes, as shown in the following example:

To set the UI culture and culture for an individual page, set the Culture and UICulture attributes of the @ Page
directive, as shown in the following example:
<%@ Page UICulture="es" Culture="es-MX" %>

Question:-What is the managed and unmanaged code in .net?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution environment. Code that you develop with a language compiler that targets the runtime is called managed code; it benefits from features such as cross-language integration, cross-language exception handling,enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services

Question:-What is Global Assembly Cache (GAC) and what is the purpose of it? Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.

Question:Option statements that are supported in VB.NET?
Option Explicit:- By default, Option Explicit is on for VB.NET projects. It's a good programming practice to set Option Explicit on because it helps developers avoid implicitly declaring variables, and thus write better code.This forces developers to explicitly declare variables utilizing the Dim keyword and specifying the datatype for the variable.

Option Compare:-By default,the Option Compare is Binary;however,you can set Option Compare to Text instead.

Option Strict:- Option Strict Off is the default mode for the code in VB.NET; however, it's preferable to write code with Option Strict on. Option Strict On prevents implicit type conversions by the compiler. It's
also a safer way to develop code, which is why most developers prefer it.

What’s the difference between System.String and System.StringBuilder classes?
System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

Question:-What is Reflection in .NET?
All .NET compilers produce metadata about the types defined in the modules they produce.This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.

Question:-What are Namespaces?
The namespace keyword is used to declare a scope. This namespace scope lets you organize code and gives you a way to create globally-unique types. Even if you do not explicitly declare one, a default namespace is created.This unnamed namespace, sometimes called the global namespace, is present in every file. Any identifier in the global namespace is available for use in a named namespace. Namespaces implicitly have public access and this is not modifiable.

Question:The ASP.NET page Lifecycle ?
(1) PreInit()
In Page level event, all controls created during design time are initialized with their default values. For e.g., if you have a TextBox control with Text property = “Hello”, it would be set by now. We can create dynamic controls here.
This event occurs only for the Page class not for UserControl/MasterPage
protected override void OnPreInit(EventArgs e)

{
//custom code
base.OnPreInit(e);
}
we can set theme programaticaly in preInit.
If the page is MasterPage after the Init() event starts, you can access these controls directly from the page class. Why?
The reason being that all controls placed in the Content Page are within a ContentPlaceholder which is a child control of a MasterPage. Now Master Page is merged and treated like a control in the Content Pages. As I mentioned
earlier, all events except the Init() and Unload() are fired from outermost to the innermost control. So PreInit() in the Page is the first event to fire but User Controls or MasterPage (which is itself a Usercontrol) do not have any PreInit event . Therefore in the Page_PreInit() method, neither the MasterPage nor any user control has been initialized & only the controls inside the Page class are set to their default values.Only after the Page_PreInit() event the Init() events of other controls fire up.
(2)OnInit()
In this event, we can read the controls properties (which is set at design time). We cannot read control values changed by the user because that changed value will get loaded after LoadPostData() event fires. But we can access control values from the forms POST data as:
string selectedValue = Request.Form[controlID].ToString();
(3)LoadViewState
This will only fire if the Page has posted back.Here the runtime de-serializes the view state data from the hidden form element and loads all controls who have view state enabled.
(4)LoadPostBackData
In this event the controls which implement IPostBackDataHandler interface gets loaded by the values from the HTTP POST data. Note that a textbox control does not gets its value from the view state but from the post data in the form in this event. So even if you disable view state for a particular control, it can get its value from the HTTP POST data if it implements IPostBackDataHandler interface.
Also,an important point to note is that if we have a DropDownList control and we have dynamically added some items to it, the runtime cannot load those values unless the view state is enabled (even if the control derives from IPostBackDataHandler). The reason being that HTTP Post data has only one value per control,and the entire value collection is not maintained in the PostData but in view state.
(5)Page_Load
This method isfirst one for all beginner developers to put their code. Beginners may also think that this is the first method which fires for a Page class. This can lead to a lot of confusion which makes understanding the Page lifecycle all the more important.
Note:If the page has user control, then it's Load method will fire after the Page class's Load method. The reason as explained earlier is the fact that all method except the Init() are fired from the outermost control to the innermost. So after Page_Load(), load methods of all other controls are fired recursively.
(6)Control Event Handlers
These are basically event handlers(like Button1_Click()) which are defined for controls in the ASPX markup. Another source of confusion arises when the developer thinks that an event handler like Button_Click() should fire independently (like in windows apps) as soon as he clicks a Button on the web form, forgetting that Page_Load will
fire first before any event handlers.
(7)PreRender
This event is again recursively fired for all child controls in the Page. If we want to make any changes to control values, this is the last event we have to peform the same.
(8)SaveViewState
Here, the ViewState of the controls gets saved in the form's hidden control.
(9)Render
In this method all controls are rendered recursively (i.e. Render method of each control is called).
(10)Unload
Here you can have the page and controls perform clean-up operations. This event has no relevance besides clean up operations because the Page has already rendered.

Question:Diffrence between instance and object
instance means just creating a reference(copy) .
object :means when memory location is associated with the object( is a runtime entity of the class) by using the new operator
interface is a set of abstract methods, all of which have to be overriden by the class whichever implements the interface
abstract class is a collection of data and methods which are abstact (not all of them)

Question:ASP.NET Globalization and Localization
Globalization is the process of designing and developing applications that function for multiple cultures, and localization is the process of customizing your application for a given culture and locale. The topics in this section describe how to create ASP.NET Web applications that can be adapted to different languages and cultures.

Question:Form Authentication in ASP.NET
The web.config file




loginUrl="login.aspx" protection="All"
timeout="30" path="/" />







What you have to keep watch to is the lines with and tags. Chjeck if user is Authenticate
FormsAuthentication.RedirectFromLoginPage(MyLogin.UserId, false);

Question:What is DLL Hell ?
Dll hell problem is actualy registation and versionig probelem which is occure in vb6.0.this problem is solve in .netframework in this every project has its own dll(dynamic link library) file.and this file is not overwrite by dll file of another project when we instaling .netproject on machine where already install a .netframework project.

Question:-can you explain difference between .Net framework and .Net Compact Framework ?
Answer:-As the name suggest to us that .Net compact framework has been created with enabling managed code on devices just like PDAs,mobiles etc. These are compact devices for which a .NET compact framework is used.This is main diffrence between these two.

Question:-What is Pull and Push Model in ado.net ?
Answer:- Pull model is used to pick out the element or we can also say objects from Database tabel.
Push model is used to insert the element only at the top position in table to database with the help of object. But when we have to delete the top most record pull method is used over push.
Similar to stack operation

Question:-What is Managed Heap?
The .NET framework includes a managed heap that all .NET languages use when allocating reference type objects. Lightweight objects known as value types are always allocated on the stack, but all instances of classes and arrays are created from a pool of memory known as the managed heap.

Question:-Describe session handling in a webfarm ?
State Server is used for handling sessions in a web farm. In a web farm, make sure you have the same in all your webservers.
Also, make sure your objects are serializable. For session state to be maintained across different web servers in the web farm, the Application Path of the website (For example \LM\W3SVC\2) in the IIS Metabase should be identical in all the web
servers in the web farm

Question:-What is Delegate?
A delegate is a class that can hold a reference to a method. Unlike other classes, a delegate class has a signature, and it can hold references only to methods that match its signature. A delegate is thus equivalent to a type-safe function pointer
or a callback.

Question:-What is singlecall and singleton ?
Differneces between Single Call & Singleton. Single Call objects service one and only one request coming in. Single Callobjects are useful in scenarios where the objects are required to do afinite amount of work. Single Call objects are usually not required tostore state information, and they cannot hold state information between method calls. However, Single Call objects can be configured in aload-balanced fashion.Singleton objects are those objects that service multiple clients and henceshare data by storing state information between client invocations. Theyare useful in cases in which data needs to
be shared explicitly betweenclients and also in which the overhead of creating and maintaining objectsis substantial.

Question:-What is event bubbling?
Event Bubbling is nothing but events raised by child controls is handled by the parent control. Example: Suppose consider datagrid as parent control in which there are several child controls.There can be a column of link buttons right.Each link
button has click event.Instead of writing event routine for each link button write one routine for parent which will handled the click event of the child link button events.Parent can know which child actaully triggered the event.That thru arguments
passed to event routine.

Question:-which dll handles the request of .aspx page ?
When the Internet Information Service process (inetinfo.exe) receives an HTTP request, it uses the filename extension of the requested resource to determine which Internet Server Application Programming Interface (ISAPI) program to run to process the request. When request is for an ASP.NET page (.aspx file), IIS passes the request to the ISAPI DLL capable of handling the request for ASP.NET pages, which is aspnet_isapi.dll.

Question:-Diffrence between Java & Javascript ? Java and JavaScript are two completely different languages in both concept and design!

Java
Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++.

Javascript
JavaScript was designed to add interactivity to HTML pages
JavaScript is a scripting language (a scripting language is a lightweight programming language)
A JavaScript consists of lines of executable computer code
A JavaScript is usually embedded directly into HTML pages
JavaScript is an interpreted language (means that scripts execute without preliminary compilation)
Everyone can use JavaScript without purchasing a license

Question:-what is MSIL?
MSIL supports OO programming, so we can have a class which has public and private methods. The entry point of the program needs to be specified. In fact it doesn't really matter whether the method is called Mam or Dad. The only thing that matters
here is that .entrypoint is specified inside method. MSIL programs are compiled with ilasm compiler. Since we are writing a managed assembly code, we have to make sure that no variables are allocated in memory when the program goes out of scope.

Here is a more complicated program that, once again, does not do anything but has some dataThe sample MSIL program.method
static void main(){ .entrypoint .maxstack 1 ldstr "Hello world!" call void [mscorlib]System.Console::WriteLine(string) ret}

Question:-What is read only and its example ?
A read only member is like a constant in that it represents an unchanging value. The difference is that a readonly member can be initialized at runtime, in a constructor as well being able to be initialized as they are declared. For example
public class MyClass
{
public readonly double PI = 3.14159;
}
Because a readonly field can be initialized either at the declaration or in a constructor, readonly fields can have different values depending on the constructor used. A readonly field can also be used for runtime constants as in the following example
public static readonly uint l1 = (uint)DateTime.Now.Ticks;

Question:-How we know exe is developed in .net Compatible languages or not ?
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace checkingnetproj
{
class Program
{
static void Main(string[] args)
{
string FullPATHofFile;
FullPATHofFile = "";
try
{
AssemblyName assemblyName = AssemblyName.GetAssemblyName(FullPATHofFile);
Console.WriteLine("{0} - is a .NET assmbly. ", FullPATHofFile);
}
catch (BadImageFormatException)
{
Console.WriteLine("{0} - Not .NET assmbly. ", FullPATHofFile);
}
Console.ReadLine();
}
}

Question:-What is Sealed class ?
A class can be made sealed in c# using the sealed keyword. When you do that, it implies that the class cannot be inhereted.
You can extend this functionality to the individual methods as well. In case you want a class to be inhereted, excluding one of its methods, just make that particular method sealed.

Question:-Diffrence bteween Shadowing and Hiding ?
Shadowing :-This is VB.Net Concept by which you can provide a new implementation for base class member without overriding the member. You can shadow a base class member in the derived class by using the keyword "Shadows". The method signature,
access level and return type of the shadowed member can be completely different than the base class member.

Hiding : - This is a C# Concept by which you can provide a new implementation for the base class member without overriding the member. You can hide a base class member in the derived class by using the keyword "new". The method signature,access level and return type of the hidden member has to be same as the base class member. Comparing the three :-
1) The access level , signature and the return type can only be changed when you are shadowing with VB.NET. Hiding and overriding demands the these parameters as same.
2) The difference lies when you call derived class object with a base class variable.In class of overriding although you assign a derived class object to base class variable it will call derived class function. In case of shadowing or hiding the base class function will be called.

Question:-From where are custom exceptions derived from ?
SystemException and ApplicationException are both derrived from Exception.SystemException is the predefined base class for exceptions that originate from theSystem namespace.ApplicationException is the class intended as a base for any application specificexceptions that it is decided, need to be defined.If you want to define your own "exceptions" for your own specific applicationthen it is considered good practice to derrive your own "exception" class fromApplicationExceptionpublic class
CustomException : ApplicationException .

Question:-Why multiple Inheritance not work in C# ?
When we use the Multiple inherutance we use more than one class. Lets one condition class A and class B are base classes and class c is is multiple inherting it.And where class c is inheriting a function .It may be possible that this function with same name and same signature can present in both class A and Class B . That time how the compiler will know that which function it should take wherether from class A or class B.So Multiple inheritance show's an error.

Question:-What is SQL injection ?
SQL injection is a security vulnerability that occurs in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is in fact an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.

Question:-What is Web Application ?
Web application consists of document and code pages in various formats. The simplest kind of document is a static HTML page, which contains information that will be formatted and displayed by a Web browser. An HTML page may also contain hyperlinks to other HTML pages.A hyperlink(or just link) contains an address, or a Uniform Resource Locator (URL), specifying where the target document is located. The resulting combination of content and links is sometimes called hypertext and provides easy navigation to a vast amount of information on the World Wide Web.

Question:-Diffrence between Showding and overriding ?
1. Purpose :
Shadowing : Protecting against a subsequent base class modification introducing a member you have already defined in your derived class
Overriding : Achieving polymorphism by defining a different implementation of a procedure or property with the same calling sequence
2.Redefined element :
Shadowing : Any declared element type
Overriding : Only a procedure (Function or Sub) or property
3.Redefining element :
Shadowing : Any declared element type
Overriding : Only a procedure or property with the identical calling sequence
4.Accessibility :
Shadowing : Any accessibility
Overriding : Cannot expand the accessibility of overridden element (for example, cannot override Protected
with Public)
5.Readability and writability :
Shadowing : Any combination
Overriding : Cannot change readability or writability of overridden property
6.Keyword usage :
Shadowing : Shadows recommended in derived class;Shadows assumed neither Shadows nor Overrides specified
Overriding : Overridable required in base class; Overrides required in derived class
7.Inheritance of redefining element by classes deriving from your derived class :
Shadowing : Shadowing element inherited by further derived classes; shadowed element still hidden
Overriding : Overriding element inherited by further derived classes; overridden element still overridden

Question:-How to Get DateDiffrence ?
DateTime startTime = DateTime.Now;
DateTime endTime = DateTime.Now.AddSeconds( 75 );
TimeSpan span = endTime.Subtract ( startTime );
Console.WriteLine( "Time Difference (seconds): " + span.Seconds );
Console.WriteLine( "Time Difference (minutes): " + span.Minutes );
Console.WriteLine( "Time Difference (hours): " + span.Hours );
Console.WriteLine( "Time Difference (days): " + span.Days );

Question:-what is Cold Backup ?
Offline or cold backups are performed when the database is completely shutdown. The
disadvantage of an offline backup is that it cannot be done if the database needs
to be run 24/7. Additionally, you can only recover the database up to the point
when the last backup was made unless the database is running in ARCHIVELOG mode.

Question:-How to create a cookie in C#? HttpCookie cookie;
String UserID = "dotnetquestion";
cookie = new HttpCookie("ID");
cookie.Values.Add("ID", ID);
Response.Cookies.Add(cookie);

Question:-what is Deep Coy and Shallow copy ?
Shallow copy create a new reference to the same object. Deep copy create a new reference to a new object.

Question:-What is the different between <%# %> and <%= %> ?
The <%# %> is used for databinding where as <%= %> is used to output the result of an expression. The expression inside <%# %> will be executed only when you call the page's or control's DataBind method. The expression inside <%= %> will be executed and displayed as and when it appears in the page.

Question:-what is Early & Late Binding ?
Early binding is to know the type of an object at compile time. The compiler have all the needed element at compile time to build the call into the excutable code. late binding, the type of an object is known only at runtime. It will need extra instructions
to find out where is the method to be called before calling it.

Question:-What is exception handling ?
When an exception occurs, the system searches for the nearest catch clause that can handle the exception, as determined by the run-time type of the exception. First, the current method is searched for a lexically enclosing try statement, and the associated catch clauses of the try statement are considered in order. If that fails, the method that called the current method is searched for a lexically enclosing try statement that encloses the point of the call to the current method.This search continues until a catch clause is found that can handle the current exception, by naming an exception class that is of the same class, or a base class, of the run-time type of the exception being thrown. A catch clause that doesn't name an exception class can handle any exception.Once a matching catch clause is found, the system prepares to transfer control to the first statement of the catch clause. Before execution of the catch
clause begins, the system first executes, in order, any finally clauses that were associated with try statements more nested that than the one that caught the exception. Exceptions that occur during destructor execution are worth special mention. If an exception occurs during destructor execution, and that exception is not caught, then the execution of that destructor is terminated and the destructor of the base class (if any) is called. If there is no base class or if there is no base class destructor, then the exception is discarded.

Question:-How to get the hostname or IP address of the server ?

HttpContext.Current.Server.MachineName
HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]
The first one should return the name of the machine, the second returns the local ip address.
Note that name of the machine could be different than host, since your site could be using host headers.

Question:-What is a parser error ?
Its basically a syntax error in your ASPX page. It happens when your page is unreadable for the part of ASP.NET that transforms your code into an executable.

Question:-How to change the Page Title dynamically ?
//Declare protected System.Web.UI.HtmlControls.HtmlGenericControl Title1 ; //In Page_Load Title1.InnerText ="Page 1" ;

Question:-What is xxx(src As Object, e As EventArgs)?
xxx is an event handler
src is the object that fires the event
e is an event argument object that contains more information about the event.

Question:-How to register Assemblies in GAC ?
The assemblies are stored in the global assembly cache, which is a versioned repository of assemblies made available to all applications on the machine not like Bin and App_Code. Several assemblies in the Framework are automatically made available to ASP.NET applications. You can register additional assemblies by registration in a Web.config file in your application.
< configuration >
< compilation >
< assemblies >
< add assembly="System.Data, Version=1.0.2411.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"/ >
< /assemblies >
< /compilation >
< /configuration >

Question:-How Server control handle events ?
ASP.NET server controls can optionally expose and raise server events, which can be handled by developers.Developer may accomplish this by declaratively wiring an event to a control (where the attribute name of an event wireup indicates the event name and the attribute value indicates the name of a method to call).
Private Sub Btn_Click(Sender As Object, E As EventArgs)
Message.Text = "http://www.dotnetquestion.info"
End Sub

Question:-Can we develop web pages directly on an FTP server ?
Yes. Visual Web Developer now has built-in support for editing and updating remote web projects using the standard File Transfer Protocol (FTP). You can quickly connect to a remote Web site using FTP within the New Web Site and Open Web Site dialog box.

Question:-What is Machine.config File ?As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.

Question:- Gave an idea about NameSpace and Assembly ?
Answer:-Namespace is not related to that of an assembly. A single assembly may contain many types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convention, whereas an assembly establishes the name scope for types at run time.
Namespace:-
(1)Namespace is logical grouping unit.
(2)It is a Collection of names wherein each name is Unique.
(3)They form the logical boundary for a Group of classes.
(4)Namespace must be specified in Project-Properties.
Assembly:-
(1)Assembly is physical grouping unit.
(2)It is an Output Unit. It is a unit of Deployment & a unit of versioning. Assemblies contain MSIL code.
(3)Assemblies are Self-Describing.

Question:-What is LDAP ?

LDAP is a networking protocol for querying and modifying directory services running over TCP/IP.To explain LDAP we take a example of telephone directory, which consists of a series of names organized alphabetically, with an address and phone
number attached.To start LDAP on client it should be connect with server at TCP/IP port 389.The client can send multiple request to the server.The basic operations are:-
Start TLS - protect the connection with Transport Layer Security (TLS), to have a more secure connection
Bind - authenticate and specify LDAP protocol version
Search - search for and/or retrieve directory entries
Compare - test if a named entry contains a given attribute value
Add a new entry
Delete an entry
Modify an entry
Modify DN - move or rename an entry
Abandon - abort a previous request
Extended Operation - generic operation used to define other operations
Unbind - close the connection (not the inverse of Bind)

Question:-What is RAD ?
Rapid application development (RAD), is a software development process developed initially by James Martin in the 1980s.
The methodology involves iterative development, the construction of prototypes, and the use of Computer-aided software engineering (CASE) tools. Traditionally the rapid application development approach involves compromises in usability, features,& /or execution speed.Increased speed of development through methods including rapid prototyping,virtualization of system related routines, the use of CASE tools, and other techniques. Increased end-user utility Larger emphasis on simplicity and usability of GUI design.Reduced Scalability, and reduced features when a RAD developed application starts as prototype and evolves into a finished application Reduced features occur due to time boxing when features are pushed to later versions in order to finish a release in a short amount of time.

Question:-When we create a connection in ADO.NET a metadata is created what information it contains ?
Answer:- Metadata collections contains information about items whose schema can be retrieved. These collections are as follows:
Tables : Provides information of tables in database.
Views : Provides information of views in the database.
Columns : Provides information about column in tables.
ViewColumns : Provides information about views created for columns.
Procedures : Provides information about stored procedures in database.
ProcedureParameters : Provides information about stored procedure parameters.
Indexes : Provides information about indexes in database.
IndexColumns : Provides information about columns of the indexes in database.
DataTypes : Provides information about datatypes.
Users : Provides information about database users.

Question:-what is a jitter and how many types of jitters are there ?
Answer:-JIT is just in time complier.it categorized into three:-
1 Standard JIT : prefered in webApp-----on diamand
2 Pre JIT : only one time------only use for window App
3 Economic JIT : use in mobile App

Question:-What is the difference between Dataset.clone and Dataset.copy ?Answer:-The one and the main diffrenet between these two is clone only copy the structure but not the data on the other hand copy copies all the data and also the structure.

Question:-How to diplay alert on post back from javascript ? Answer:- string strScript = " "; if ((!Page.IsStartupScriptRegistered("clientScript"))) { Page.RegisterStartupScript("clientScript", strScript); }

Question:-How to Add a Assembly in GAC ?Answer:-There are three ways to add an assembly to the GAC:
(1)Install them with the Windows Installer 2.0
(2)Use the Gacutil.exe tool
(3)Drag and drop the assemblies to the cache with Windows Explorer

- Create a strong name using sn.exe tool
eg: sn -k keyPair.snk
- with in AssemblyInfo.cs add the generated file name
eg: [assembly: AssemblyKeyFile("dotnet.snk")]
- recompile project, then install it to GAC by either
drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)
or
gacutil -i abc.dll

Question:-What are the methods provided by command object ?
Answer:-There are the different method are provided by command objects.
(1)ExecuteNonQuery:-This methods executes the commandtext property which is passed with the connection object and this does not return any rows.It will used for UPDATE,INSERT or DELETE.Its return the integer value.
(2)ExecuteReader:-Its execute the command text.But its return reader object that is read only.
(3)ExecuteScalar:-Its execute the command text but this return only single value only the first value of first column. And any other returned column return are discarded.This is fast and efficent for singleton value .

Question:-In ADO.NET a metadata is created what information it contains ?Answer:- Metadata collections contains information about items whose schema can be retrieved. These collections are as follows:
Tables : Provides information of tables in database
Views : Provides information of views in the database
Columns : Provides information about column in tables
ViewColumns : Provides information about views created for columns
Procedures : Provides information about stored procedures in database
ProcedureParameters : Provides information about stored procedure parameters
Indexes : Provides information about indexes in database
IndexColumns : Provides information about columns of the indexes in database
DataTypes : Provides information about datatypes
Users : Provides information about database users

Question:-Why it is preferred not to use finalize for cleanup ?
Answer:-There is problem with the finalize regards to object when we use finalize to destroy the object it will take two round to remove the objects.To understand it we will take a simple example let there are three objects obj1,obj2,obj3 we use finalize for obj2.Now when garbage collector is run first time it will only clean obj1,obj3 becuase obj2 is pushes to the finalization queue. Now when garbage collector runs second time it will take if any object is pending for finalization then it will check the finalization queue if any item it will destroy that one.

Question:-Why it is preferred not to use finalize for cleanup ?
Answer:-There is problem with the finalize regards to object when we use finalize to destroy the object it will take two round to remove the objects.To understand it we will take a simple example let there are three objects obj1,obj2,obj3 we use finalize for obj2.Now when garbage collector is run first time it will only clean obj1,obj3 becuase obj2 is pushes to the finalization queue. Now when garbage collector runs second time it will take if any object is pending for finalization then it will check the finalization queue if any item it will destroy that one.

Question:-What are advantage and disadvantage of Hidden fields ?
Answer:-Some of advantage of Hidden field as follows.
-These are quite simple to implement.
-We can work with the Web-Farm because data is cached on client side.
-One other reason is all browser support hidden field.
-Server resoucres not required.
And disadvantage are as follows
-Security reason not secure
-Performance decrease if data is too large.
-These are single valued and cannot handle havvy structure.

Question:-What is Daemon threads what's its purpose ?
Answer:- When a process is executing there are some threads that's run in background one of this thread is daemon thread. The simple example of this thread is Garbadge collector its run when any of .NET code is running if not running then it is in idle condition. we can make daemon thread by
Thread.Isbackground=true

Question :-How to create Arraylist,HashTable in asp.net ?
Answer:-Creating Arraylist in VB.NET and sort that
dim mycountries=New ArrayList
mycountries.Add("India")
mycountries.Add("USA")
mycountries.Add("Pakisatn")
mycountries.Add("Italy")
mycountries.TrimToSize()
mycountries.Sort()
Creating Hashtable in VB.NET
dim mycountries=New Hashtable
mycountries.Add("N","Norway")
mycountries.Add("S","Sweden")
mycountries.Add("F","France")
mycountries.Add("I","Italy")

Question:-Diffrence between temp table and table variable ?
Answer:- (1)Temp Tables are created in the SQL Server TEMPDB database and therefore require more IO resources and locking. Table Variables and Derived Tables are created in memory.
(2)Temp Tables will generally perform better for large amounts of data that can be worked on using parallelism whereas Table Variables are best used for small amounts of data (I use a rule of thumb of 100 or less rows) where parallelism would not provide a significant performance improvement.
(3)You cannot use a stored procedure to insert data into a Table Variable or Derived Table. For example, the following will work: INSERT INTO #MyTempTable EXEC dbo.GetPolicies_sp whereas the following will generate an error: INSERT INTO @MyTableVariable EXEC dbo.GetPolicies_sp.
(4)Derived Tables can only be created from a SELECT statement but can be used within an Insert, Update, or Delete statement.
(5) In order of scope endurance, Temp Tables extend the furthest in scope, followed by Table Variables, and finally Derived Tables.

Question:- What do you mean by Late Binding ?
Answer:-In LateBinding compiler not have any knowledge about COM's methods and properties and it get at runtime. Actually program learns the addresses of methods and properties at execution time.
When those methods and properties are invoked. Late bound code typically refers client objects through generic data types like 'object' and relies heavily on runtime to dynamically locate method addresses. We do late binding in C# through reflection. Reflection is a way to determine the type or information about the classes or interfaces.

Question:-What are the valid parameter types we can pass in an Indexer ?
Answer:-IN,OUT,INOUT are the valid parameter types that we can pass in a Indexer.

Question:- How do you write the multiple class in one tag?
Answer:- Using the following way you can set two classes.

it will apply two css class named first and second.

Question:-What is the Relation in CSS and HTML?
Answer:- Html is just for creating Web page and CSS is for modify or Design, content of the page, as color, buttons, blur, shadow, highlight, fade atc.

Question:-what is Hot Backup ?
An online backup or hot backup is also referred to as ARCHIVE LOG backup. An online
backup can only be done when the database is running in ARCHIVELOG mode and the database is open. When the database is running in ARCHIVELOG mode, the archiver (ARCH) background process will make a copy of the online redo log file to archive backup location.

Question:Type of garbage collector?
There are two types of Garbage Collector managed garbage collector see we will declaring variable ,object in our programes once this kind of variable,object goes out of the scope ,they are put into the heap and they are checked for the further existence.once its beeing no longer used garbage collector wil deallcate mem for that variable and objects.
Umanaged garbage collectorthis was done mannually and u will be happen to open a connection with database,will be open the file etc. while this kind of the thing goes out of the scope we have to explicitly call the garage colector by calling the closecommand of the datbase once the connection is closed it puts this memmory ino the heep and process follws the same

Question:-How to create and removethat cookies in asp.net ?Answer:-This is the syntax for creating a cookies.

HttpCookie SiteCookies = new HttpCookie("UserInfo");
SiteCookies["UserName"] = "Pervej";
SiteCookies["sitename"] = "dotnetRed";
SiteCookies["Expire"] = "5 Days";
SiteCookies= DateTime.Now.AddDays(5);
Response.Cookies.Add(SiteCookies);

Now syntax to remove this cookie:-

HttpCookie SiteCookies= new HttpCookie("UserInfo");
SiteCookies= DateTime.Now.AddDays(-1);
Response.Cookies.AddSiteCookies

Question:-Is it possible to get vale of viewstate value on next page ?
Answer:-View state is page specific; it contains information about controls embedded
on the particular page. ASP.NET 2.0 resolves this by embedding a hidden input field
name,__POSTBACK . This field is embedded only when there is an IButtonControl on the page and its PostBackUrl property is set to a non-null value. This field contains
the view state information of the poster page. To access the view state of the poster
page, you can use the new PreviousPage property of the page:
Page poster = this.PreviousPage;
we can find any control from the previous page and read its state:
Label posterLabel = poster.findControl("myLabel");
string lbl = posterLabel.Text;
Cross-page post back feature also solves the problem of posting a Form to multiple
pages, because each control, in theory, can point to different post back URL.

No comments: