ALL QUESTIONS
Explain difference between .Net framework and .Net Compact Framework ?
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.
What is Pull and Push Model in ado.net ?
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
How to Add a Assembly in GAC ?
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
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
5.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 take help of session through different web pages also.
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 event is 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.
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 side core 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.
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 necessary information 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.
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 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.
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.
3.Isolated - no transaction sees the intermediate results of the current transaction).
4.Durable - the values persist if the data had been committed even if the system crashes right
after.
Connection String ?
ODBC
Standard Security:"Driver={SQL Server};Server=UrServerName;Database=pubs;Uid=myUsername;Pwd=myPassword;"
Trusted connection:"Driver={SQL Server};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;"
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".
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:
1. You would need to code for the browser compatibility
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.
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.
What is Cursor?
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis, instead of the typical SQL commands that operate on all the rows in the set at one time. For example, you can use cursor to include a list of all user databases and make multiple operations against each database by passing each database name as a variable
Some javasciprt good option?
(1) How to disable right click option
body oncontextmenu="return false;"
(2)How to use Ltrim In Javascirpt?
var strTemp = " Left padded string";
alert(strTemp);
strTemp = LTrim(strTemp);
alert(strTemp);
(3)How to get A ASCII Value of ANy character ?
alert(Asc("a"));
alert(Asc("B"));
(4)Get Back Character to ASCII
alert(Chr(80));
alert(Chr(82));
(5)Use of CBool funation in javascrip
var StringOne = "No";
if(CBool(StringOne))
{
alert("StringOne evaluates to true");
}
else
{
alert("StringOne evaluates to false");
}
(6)How to Add to integer in JAVSCRIPT ?
var One = CInt("17");
var two = CInt("35");
alert(One + Two);
(7)Concat two string
var One = CStr(1267);
var Two = CStr(3456);
alert(One + Two);
(8)How to add long Value in Javscript ?
var One = CSng("1267.45");
var Two = CSng("3456.67");
alert(One + Two);
(9)Get format acording to exponnet
var tal = 34.5562
alert(FormatCurrency(tal));
alert(FormatCurrency(1000));
(10)Number in the Format of Percent ?
var TheNumber = .15
alert(FormatPercent(TheNumber));
(11)How to get date in specific format ?
var date = "23/07/1983";
alert(date);
date = FormatDate(date,"mmmm/dd/yyyy")
alert(date);
(12)how to get Date ClientSide
var Date = GetDate("dd/mmmm/yyyy");
alert(Date);
(13)How to get Specific String in specific String
var StringOne = "here u can do this due to error Gitesh said ";
if(InStr(StringOne,"gitesh") > -1)
{
alert("Gites found in string");
alert("Term appears at character " + InStr(StringOne,"Gitesh"));
}
(14)How to check value is null or not ?
var EmptyVariable;
if(IsNull(EmptyVariable))
{
alert("Null value detected");
}
(15)How to check numeric value ?
var myVariable = "www.Dotnetquestion.info";
if(IsNumeric(myVariable))
{
alert("Numeric Value detected");
}
(16)how to join Array ?
var var = "dot,net ,question ";
var arr = Var.split(",");
var strTemp = Join(arr," - ");
alert(strTemp);
(17)Convert String in to Lower case ?
var strTemp = LCase("DOTNETQUESTION");
alert(strTemp);
(18)How to get first three Character of string ?
var str = "Dot Net Question";
Leftstr = Left(str,3);
alert(Leftstr);
(19)How to get a length of string ?
var i = Len("www.Dotnetquestion.info");
alert(i);
(20)How to get a substring from string ?
var Temp = "dot net programmer in dotnetquestion.info";
Temp = Mid(Temp,3,3);
alert(Temp);
(21)How to Get string in Proper Case ?
var temp = "gitesh chawla";
temp = PCase(temp);
alert(temp);
(22)Replace a string with another ?
var str = "www.dotnetquestion.com";
str = Replace(str,"com", "info");
alert(str);
(23)How to get string from right of string ?
var strTemp = "Here is javascript in dotnetquestion site";
strTemp = Right(strTemp,4);
alert(strTemp);
(24)Math function
var root = 4;
root = Sqr(root);
alert(root);
(25)How to match two string ?
var str1 = "dot net question"
var str2 = "DOT NET QUESTION"
if(strComp(str1,str2,1))
{
alert("Strings Match");
}
(26)Use of Intellisense Title Case ?
var str1 = "all about the dot net question";
str1 = TitleCase(str1);
alert(str1);
(27)How to get Number of Element in array ?
var strTemp = "dot ,net,question";
var arrTemp = strTemp.split(",");
alert("Array contains " + UBound(arrTemp) + " elements");
(28)How to get string in Upper Case ?
var str = "dot net question";
str = UCase(str);
alert(str);
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
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.
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.
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.
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.
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.
Diffrence between function and StoreProcedure ?
Both functions and stored procedures can be custom defined and part of any application.Functions, on the other hand, are designed to send their output to a query or T-SQL statement. For example, User Defined Functions (UDFs) can run an executable file from SQL SELECT or an action query,while Stored Procedures (SPROC) use EXECUTE or EXEC to run. Both are instantiated using CREATE FUNCTION.stored procedures are designed to return its output to the application. A UDF returns table variables, while SPROC can't return a table variable although it can create a table. Another significant difference between them is that UDFs can't change server environment or your operating system environment, while a SPROC can. Operationally, when T-SQL encounters an error the function stops, while T-SQL will ignore an
error in a SPROC and proceed to the next statement in your code (provided you've included error handling support). You'll also find that although a SPROC can be used in an XML FOR clause, a UDF cannot be.
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 collector
this 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
How can we load multiple tables in to Dataset?
Write the select queries required in fill statement.
e.g.
Adp.Fill("Select * from Table1;Select * from Table2;Select * from Table3",DS)
This statement wil generate Dataset with 3 datatables.
How many records can take clustured index in sql ?
A clustered index is a special type of index that reorders the way the records in the table are physically stored . therefore the table can have only one clustered index.
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 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
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.
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.
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.
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();
}
}
To set the culture and UI culture for an ASP.NET Web page declaratively
To 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" %>
What is a join and List different types of joins.
Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table. Types of joins: INNER JOINs,OUTER JOINs,CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.
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
What is serialization in .NET? What are the ways to control serialization?
Serialization is the process of converting an object into a stream of bytes. Deserialization is the
opposite process of creating an object from a stream of bytes. Serialization/Deserialization is
mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or
database)Serialization can be defined as the process of storing the state of an object to a storage
medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created. Binary serialization preserves type fidelity, which is useful for
preserving the state of an object between different invocations of an application. For example,
you can share an object between different applications by serializing it to the clipboard. You can
serialize an object to a stream,disk,memory,over the network,and so forth.Remoting uses serializatn. to pass objects "by value" from one computer or application domain to another. XML serialization serializes only public properties and fields and does not preserve type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data. Because XML is an open standard,it is an attractive choice for sharing data across the Web. SOAP is an open standard,which makes it an attractive choice. There are two separate mechanisms provided by the .NET class library-XmlSerializer and SoapFormatter/BinaryFormatter.Microsoft uses XmlSerializer
for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use
in your own code.
Write a SQL Query to find first Week Day of month?
SELECT DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1, GETDATE())) AS FirstDay
How to find 6th highest salary from Employee table?
SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM employee ORDER BY salary DESC) a ORDER BY salary
How to get number of column in table?
select * from information_schema.columns where table_name='table_name'
sp_columns 'table_name'
Delete duplicate row from table?
INSERT INTO #temp SELECT DISTINCT * FROM yourtable
select * into #temp select distinct * from yourtable
truncate table yourtable
insert into yourtable select * from #temp
Display all undeleted rows?
SELECT * FROM Table WHERE isnull(Is_deleted,0) = 0
How to Select top 3 salry from tables?
SELECT TOP 3 emp_id, emp_name, salary , dept_id FROM employee WHERE dept_id = training dept ORDER BY salary DESC
How to know how many tables contains empno as a column in a database?
SELECT COUNT(*) AS Counter FROM syscolumns WHERE (name = 'empno')
Write a query to round up the values of a number. For example even if the user enters 7.1 it should be rounded up to 8?
SELECT CEILING (7.1)
Write a query to convert all the letters in a word to upper case?
SELECT UPPER('test')
How to get duplicate row in a table?
select name from emp group by name having count(name)>1
How to rename a table from query?
exec sp_rename 'oldTableName' , 'newTableName'
How to determine the service pack currently installed on SQL Server?
The global variable @@Version stores the build number of the sqlservr.exe, which is used to determine the service pack installed. eg: Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 3)
What is a LiveLock?
A livelock is one, where a request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely.
What is DTC?
The Microsoft Distributed Transaction Coordinator (MS DTC) is a transaction manager that allows client applications to include several different sources of data in one transaction. MS DTC coordinates committing the distributed transaction across all the servers enlisted in the transaction.
What is Isolation Level?
An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. A lower isolation level increases concurrency, but at the expense of data correctness. Conversely, a higher isolation level ensures that data is correct, but can affect concurrency negatively. The isolation level required by an application determines the locking behavior SQL Server uses. SQL-92 defines the following isolation levels, all of which are supported by SQL Server:
Read uncommitted (the lowest level where transactions are isolated only enough to ensure that physically corrupt data is not read).
Read committed (SQL Server default level).
Repeatable read.
Serializable (the highest level, where transactions are completely isolated from one another).
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.
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.
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.
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.
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)
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.
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);
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.
BLOB Datatype
BLOB data type is used to store any data that a program can generate: graphic images, satellite images, video clips, audio clips, or formatted documents saved by any word processor or spreadsheet. The database server permits any kind of data of any length in a BLOB column.
Like CLOB objects, BLOB objects are stored in whole disk pages in separate disk areas from normal row data.
The advantage of the BLOB data type, as opposed to CLOB, is that it accepts any data. Otherwise, the advantages
and disadvantages of the BLOB data type are the same as for the CLOB data type.
What’s the difference between a primary key and a unique key?
Both primary key and unique enforce uniqueness of the column on which they are defined.
But by default primary key creates a clustered index on the column, where are unique
creates a nonclustered index by default. Another major difference is that, primary key
doesn’t allow NULLs, but unique key allows one NULL only.
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.
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)
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.
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
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.
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 betweenmethod 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.
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 handlde 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.
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.
What is datacube technology?
A multi-dimensional structure called the data cube. it is a data abstraction that allows one to view aggregated data from a number of perspectives.Conceptually,the cube consists of a core or base cuboid, surrounded by a collection of sub-cubes/cuboids that represent the aggregation of base cuboid along one or more dimensions. We refer to the dimension to be aggregated as the measure attribute, while the remaining dimensions are known as the feature attributes.
What is data modeling and data mining ?
Data modeling is the process of designing a data base model. In this data model data will be stored in two types of table fact table and dimention table.fact table contains the transaction data and dimention table contains the master data.
Data mining is process of finding the hidden trends is called the data mining.
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
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}
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;
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();
}
}
What r the Acces Modifiers?
Access modifies of C# are :
1) Private
2) Protected
3) Internal
4) Protected Internal
5) Public
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.
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.
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 .
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
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.
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.
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
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 );
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.
How to Compare two time ?
Dim t1 As String = DateTime.Parse("3:30 PM").ToString("t")
Dim t2 As String = DateTime.Now.ToString("t")
If DateTime.Compare(DateTime.Parse(t1), DateTime.Parse(t2)) < style="font-weight: bold;">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);
How to detect the User's culture ?
string sLang ; sLang = Request.UserLanguages[0];
Response.Write (sLang);
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.
Difference between DELETE TABLE and TRUNCATE TABLE commands ?
DELETE TABLE is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow. TRUNCATE TABLE also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the deallocation of the data pages of the table, which makes it faster. Of course, TRUNCATE TABLE can be rolled back.
Define candidate key, alternate key, composite key?
candidate key is one that can have row of a table unique. Generally a candidate key is primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys.A key formed by combining at least two or more columns is called composite key.
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.
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.
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.
What is an extended stored procedure ?
Extended stored procedure is a function within a DLL (written in a language like C, C++ using
Open Data Services (ODS) API) that can be called from T-SQL, just the way we call normal stored procedures using the EXEC statement. See books online to learn how to create extended stored procedures and how to add them to SQL Server.
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.
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.
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.
How To work with TimeSpan Class ?
DateTime date1 = DateTime.Parse("11/24/2003");
DateTime date2 = DateTime.Parse("06/28/2003");
TimeSpan ts = new TimeSpan (date1.Ticks - date2.Ticks);
Response.Write(ts.TotalDays.ToString () + "
");
Response.Write(ts.TotalHours.ToString() + ":" + ts.TotalMinutes.ToString() + ":" + ts.TotalSeconds.ToString() + ":" + ts.TotalMilliseconds. ToString() );
How to change the Page Title dynamically ?
//Declare
protected System.Web.UI.HtmlControls.HtmlGenericControl Title1 ;
//In Page_Load
Title1.InnerText ="Page 1" ;
Difference between Triggers and Storedprocedures ?
Triggers are basically used to implement business rules.Triggers is also similar to stored
procedures.The difference is that it can be activated when data is added or edited or
deleted from a table in a database.Triggers are special kind of stored procedures that get
executed automatically when an INSERT,UPDATE or DELETE operation takes place on a table.
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.
Isolation levels in SQL SERVER?
Isolation level get the condition to which data is isolated for use by one process and secured against interference from other processes. Read Committed - SQL Server applied a share lock while reading a row into a cursor but frees the lock immediately after reading the row.
Because a shared lock request is blocked by an exclusive lock, a cursor is prevented from reading a row that another task has updated but not yet committed. Read committed is the default isolation level setting for both SQL Server and ODBC. Read Uncommitted - When no locks while reading a row into a cursor and honors no exclusive locks. Cursors can be populated with values that have already been updated but not yet committed. The user is bypassing all of SQL Server’s locking transaction control mechanisms. Repeatable Read or Serializable -
SQL Server requests a shared lock on each row as it is read into the cursor as in READ COMMITTED, but if the cursor is opened within a transaction, the shared locks are held until the end of the transaction instead of being freed after the row is read. This has the same effect as specifying HOLDLOCK on a SELECT statement.
What is Collate in SQL SERVER-2000 ?
The COLLATE clause can be applied only for the char, varchar, text, nchar, nvarchar, and ntext data types. The physical storage of character strings in Microsoft® SQL Server™ 2000 is controlled by collations. A collation specifies the bit patterns to represent each character and the rules by which characters are sorted and compared with another character.
Why we use Unicode In Sql server ?
Unicode data is stored using the nchar, nvarchar,and ntext data types in SQL Server. Use these data types for columns that store characters from more than one character set. The SQL Server Unicode data types are based on the National Character data types in the SQL-92 standard.
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.
<>
<>
<>
< assembly="System.Data, Version=1.0.2411.0,Culture=neutral,PublicKeyToken=b77a5c561934e089">
< /assemblies >
< /compilation >
< /configuration >
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
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.
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.
What is Store Procedure ?
A stored procedure is a set of structured query language statements that you assign a name and store it in to the database in a compiled form so that it can share between no of programs.
Some advantage of Store Procedure.
they allow faster execution
they can reduce network traffic
What are Indexes in SQL SERVER?
Microsoft SQL Server index helps in creating the structure of table that helps in speeds retrieval of the rows in the table.
An index create a keys from one or more columns in the table. These keys are stored in a structure that allows SQL Server to find the row or rows created with the key values quickly and efficiently.If a table doest not containeated indexes,the data rows are not stored in any specific order.This structure is stored on heap. There are two types of SQL Server indexes:
(1)Clustered:-
Clustered indexes helps in sorting and storeing the data rows in the table take key values as base. Because the data rows are stored in sorted order on the clustered index key, clustered indexes more efficient for finding rows. There is only one clustered index per table. The data rows themselves form the lowest level of the clustered index. The only time the data rows in a table are stored in sorted order is when table contains a clustered index. If a table has no clustered index, its data rows are stored in a heap.
(2)Nonclustered:-
Nonclustered indexes having structure that is diffrent from the data rows . The lowest rows of a nonclustered index have the nonclustered index key values and each key value entry has pointers to the data rows containing the key value. The data rows are not stored in order based on the nonclustered key. The pointer from an index row in a nonclustered index to a data row
is called a row locator. The structure of the row locator depends on whether the data pages are stored in a heap or are clustered. In heap,a row locator is a pointer that point to the row. For a table with a clustered index, the row locator is the clustered index key.
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 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
Gave an idea about NameSpace and Assembly ?
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.
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 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.
Explain difference between .Net framework and .Net Compact Framework ?
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.
What is Pull and Push Model in ado.net ?
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
How to Add a Assembly in GAC ?
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
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
5.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 take help of session through different web pages also.
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 event is 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.
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 side core 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.
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 necessary information 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.
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 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.
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.
3.Isolated - no transaction sees the intermediate results of the current transaction).
4.Durable - the values persist if the data had been committed even if the system crashes right
after.
Connection String ?
ODBC
Standard Security:"Driver={SQL Server};Server=UrServerName;Database=pubs;Uid=myUsername;Pwd=myPassword;"
Trusted connection:"Driver={SQL Server};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;"
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".
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:
1. You would need to code for the browser compatibility
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.
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.
What is Cursor?
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis, instead of the typical SQL commands that operate on all the rows in the set at one time. For example, you can use cursor to include a list of all user databases and make multiple operations against each database by passing each database name as a variable
Some javasciprt good option?
(1) How to disable right click option
body oncontextmenu="return false;"
(2)How to use Ltrim In Javascirpt?
var strTemp = " Left padded string";
alert(strTemp);
strTemp = LTrim(strTemp);
alert(strTemp);
(3)How to get A ASCII Value of ANy character ?
alert(Asc("a"));
alert(Asc("B"));
(4)Get Back Character to ASCII
alert(Chr(80));
alert(Chr(82));
(5)Use of CBool funation in javascrip
var StringOne = "No";
if(CBool(StringOne))
{
alert("StringOne evaluates to true");
}
else
{
alert("StringOne evaluates to false");
}
(6)How to Add to integer in JAVSCRIPT ?
var One = CInt("17");
var two = CInt("35");
alert(One + Two);
(7)Concat two string
var One = CStr(1267);
var Two = CStr(3456);
alert(One + Two);
(8)How to add long Value in Javscript ?
var One = CSng("1267.45");
var Two = CSng("3456.67");
alert(One + Two);
(9)Get format acording to exponnet
var tal = 34.5562
alert(FormatCurrency(tal));
alert(FormatCurrency(1000));
(10)Number in the Format of Percent ?
var TheNumber = .15
alert(FormatPercent(TheNumber));
(11)How to get date in specific format ?
var date = "23/07/1983";
alert(date);
date = FormatDate(date,"mmmm/dd/yyyy")
alert(date);
(12)how to get Date ClientSide
var Date = GetDate("dd/mmmm/yyyy");
alert(Date);
(13)How to get Specific String in specific String
var StringOne = "here u can do this due to error Gitesh said ";
if(InStr(StringOne,"gitesh") > -1)
{
alert("Gites found in string");
alert("Term appears at character " + InStr(StringOne,"Gitesh"));
}
(14)How to check value is null or not ?
var EmptyVariable;
if(IsNull(EmptyVariable))
{
alert("Null value detected");
}
(15)How to check numeric value ?
var myVariable = "www.Dotnetquestion.info";
if(IsNumeric(myVariable))
{
alert("Numeric Value detected");
}
(16)how to join Array ?
var var = "dot,net ,question ";
var arr = Var.split(",");
var strTemp = Join(arr," - ");
alert(strTemp);
(17)Convert String in to Lower case ?
var strTemp = LCase("DOTNETQUESTION");
alert(strTemp);
(18)How to get first three Character of string ?
var str = "Dot Net Question";
Leftstr = Left(str,3);
alert(Leftstr);
(19)How to get a length of string ?
var i = Len("www.Dotnetquestion.info");
alert(i);
(20)How to get a substring from string ?
var Temp = "dot net programmer in dotnetquestion.info";
Temp = Mid(Temp,3,3);
alert(Temp);
(21)How to Get string in Proper Case ?
var temp = "gitesh chawla";
temp = PCase(temp);
alert(temp);
(22)Replace a string with another ?
var str = "www.dotnetquestion.com";
str = Replace(str,"com", "info");
alert(str);
(23)How to get string from right of string ?
var strTemp = "Here is javascript in dotnetquestion site";
strTemp = Right(strTemp,4);
alert(strTemp);
(24)Math function
var root = 4;
root = Sqr(root);
alert(root);
(25)How to match two string ?
var str1 = "dot net question"
var str2 = "DOT NET QUESTION"
if(strComp(str1,str2,1))
{
alert("Strings Match");
}
(26)Use of Intellisense Title Case ?
var str1 = "all about the dot net question";
str1 = TitleCase(str1);
alert(str1);
(27)How to get Number of Element in array ?
var strTemp = "dot ,net,question";
var arrTemp = strTemp.split(",");
alert("Array contains " + UBound(arrTemp) + " elements");
(28)How to get string in Upper Case ?
var str = "dot net question";
str = UCase(str);
alert(str);
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
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
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.
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.
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.
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.
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.
Diffrence between function and StoreProcedure ?
Both functions and stored procedures can be custom defined and part of any application.Functions, on the other hand, are designed to send their output to a query or T-SQL statement. For example, User Defined Functions (UDFs) can run an executable file from SQL SELECT or an action query,while Stored Procedures (SPROC) use EXECUTE or EXEC to run. Both are instantiated using CREATE FUNCTION.stored procedures are designed to return its output to the application. A UDF returns table variables, while SPROC can't return a table variable although it can create a table. Another significant difference between them is that UDFs can't change server environment or your operating system environment, while a SPROC can. Operationally, when T-SQL encounters an error the function stops, while T-SQL will ignore an
error in a SPROC and proceed to the next statement in your code (provided you've included error handling support). You'll also find that although a SPROC can be used in an XML FOR clause, a UDF cannot be.
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 collector
this 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
How can we load multiple tables in to Dataset?
Write the select queries required in fill statement.
e.g.
Adp.Fill("Select * from Table1;Select * from Table2;Select * from Table3",DS)
This statement wil generate Dataset with 3 datatables.
How many records can take clustured index in sql ?
A clustered index is a special type of index that reorders the way the records in the table are physically stored . therefore the table can have only one clustered index.
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 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
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.
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.
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.
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();
}
}
To set the culture and UI culture for an ASP.NET Web page declaratively
To 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" %>
What is a join and List different types of joins.
Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table. Types of joins: INNER JOINs,OUTER JOINs,CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.
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
What is serialization in .NET? What are the ways to control serialization?
Serialization is the process of converting an object into a stream of bytes. Deserialization is the
opposite process of creating an object from a stream of bytes. Serialization/Deserialization is
mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or
database)Serialization can be defined as the process of storing the state of an object to a storage
medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created. Binary serialization preserves type fidelity, which is useful for
preserving the state of an object between different invocations of an application. For example,
you can share an object between different applications by serializing it to the clipboard. You can
serialize an object to a stream,disk,memory,over the network,and so forth.Remoting uses serializatn. to pass objects "by value" from one computer or application domain to another. XML serialization serializes only public properties and fields and does not preserve type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data. Because XML is an open standard,it is an attractive choice for sharing data across the Web. SOAP is an open standard,which makes it an attractive choice. There are two separate mechanisms provided by the .NET class library-XmlSerializer and SoapFormatter/BinaryFormatter.Microsoft uses XmlSerializer
for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use
in your own code.
Write a SQL Query to find first Week Day of month?
SELECT DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1, GETDATE())) AS FirstDay
How to find 6th highest salary from Employee table?
SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM employee ORDER BY salary DESC) a ORDER BY salary
How to get number of column in table?
select * from information_schema.columns where table_name='table_name'
sp_columns 'table_name'
Delete duplicate row from table?
INSERT INTO #temp SELECT DISTINCT * FROM yourtable
select * into #temp select distinct * from yourtable
truncate table yourtable
insert into yourtable select * from #temp
Display all undeleted rows?
SELECT * FROM Table WHERE isnull(Is_deleted,0) = 0
How to Select top 3 salry from tables?
SELECT TOP 3 emp_id, emp_name, salary , dept_id FROM employee WHERE dept_id = training dept ORDER BY salary DESC
How to know how many tables contains empno as a column in a database?
SELECT COUNT(*) AS Counter FROM syscolumns WHERE (name = 'empno')
Write a query to round up the values of a number. For example even if the user enters 7.1 it should be rounded up to 8?
SELECT CEILING (7.1)
Write a query to convert all the letters in a word to upper case?
SELECT UPPER('test')
How to get duplicate row in a table?
select name from emp group by name having count(name)>1
How to rename a table from query?
exec sp_rename 'oldTableName' , 'newTableName'
How to determine the service pack currently installed on SQL Server?
The global variable @@Version stores the build number of the sqlservr.exe, which is used to determine the service pack installed. eg: Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 3)
What is a LiveLock?
A livelock is one, where a request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely.
What is DTC?
The Microsoft Distributed Transaction Coordinator (MS DTC) is a transaction manager that allows client applications to include several different sources of data in one transaction. MS DTC coordinates committing the distributed transaction across all the servers enlisted in the transaction.
What is Isolation Level?
An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. A lower isolation level increases concurrency, but at the expense of data correctness. Conversely, a higher isolation level ensures that data is correct, but can affect concurrency negatively. The isolation level required by an application determines the locking behavior SQL Server uses. SQL-92 defines the following isolation levels, all of which are supported by SQL Server:
Read uncommitted (the lowest level where transactions are isolated only enough to ensure that physically corrupt data is not read).
Read committed (SQL Server default level).
Repeatable read.
Serializable (the highest level, where transactions are completely isolated from one another).
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.
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.
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.
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.
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)
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.
Form Authentication in ASP.NET
The web.config file
timeout="30" path="/" />
Chjeck if user is Authenticate
FormsAuthentication.RedirectFromLoginPage(MyLogin.UserId, false);
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.
BLOB Datatype
BLOB data type is used to store any data that a program can generate: graphic images, satellite images, video clips, audio clips, or formatted documents saved by any word processor or spreadsheet. The database server permits any kind of data of any length in a BLOB column.
Like CLOB objects, BLOB objects are stored in whole disk pages in separate disk areas from normal row data.
The advantage of the BLOB data type, as opposed to CLOB, is that it accepts any data. Otherwise, the advantages
and disadvantages of the BLOB data type are the same as for the CLOB data type.
What’s the difference between a primary key and a unique key?
Both primary key and unique enforce uniqueness of the column on which they are defined.
But by default primary key creates a clustered index on the column, where are unique
creates a nonclustered index by default. Another major difference is that, primary key
doesn’t allow NULLs, but unique key allows one NULL only.
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.
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)
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.
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
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.
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 betweenmethod 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.
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 handlde 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.
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.
What is datacube technology?
A multi-dimensional structure called the data cube. it is a data abstraction that allows one to view aggregated data from a number of perspectives.Conceptually,the cube consists of a core or base cuboid, surrounded by a collection of sub-cubes/cuboids that represent the aggregation of base cuboid along one or more dimensions. We refer to the dimension to be aggregated as the measure attribute, while the remaining dimensions are known as the feature attributes.
What is data modeling and data mining ?
Data modeling is the process of designing a data base model. In this data model data will be stored in two types of table fact table and dimention table.fact table contains the transaction data and dimention table contains the master data.
Data mining is process of finding the hidden trends is called the data mining.
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
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}
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;
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();
}
}
What r the Acces Modifiers?
Access modifies of C# are :
1) Private
2) Protected
3) Internal
4) Protected Internal
5) Public
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.
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.
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 .
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
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.
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.
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
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 );
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.
How to Compare two time ?
Dim t1 As String = DateTime.Parse("3:30 PM").ToString("t")
Dim t2 As String = DateTime.Now.ToString("t")
If DateTime.Compare(DateTime.Parse(t1), DateTime.Parse(t2)) < style="font-weight: bold;">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);
How to detect the User's culture ?
string sLang ; sLang = Request.UserLanguages[0];
Response.Write (sLang);
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.
Difference between DELETE TABLE and TRUNCATE TABLE commands ?
DELETE TABLE is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow. TRUNCATE TABLE also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the deallocation of the data pages of the table, which makes it faster. Of course, TRUNCATE TABLE can be rolled back.
Define candidate key, alternate key, composite key?
candidate key is one that can have row of a table unique. Generally a candidate key is primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys.A key formed by combining at least two or more columns is called composite key.
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.
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.
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.
What is an extended stored procedure ?
Extended stored procedure is a function within a DLL (written in a language like C, C++ using
Open Data Services (ODS) API) that can be called from T-SQL, just the way we call normal stored procedures using the EXEC statement. See books online to learn how to create extended stored procedures and how to add them to SQL Server.
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.
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.
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.
How To work with TimeSpan Class ?
DateTime date1 = DateTime.Parse("11/24/2003");
DateTime date2 = DateTime.Parse("06/28/2003");
TimeSpan ts = new TimeSpan (date1.Ticks - date2.Ticks);
Response.Write(ts.TotalDays.ToString () + "
");
Response.Write(ts.TotalHours.ToString() + ":" + ts.TotalMinutes.ToString() + ":" + ts.TotalSeconds.ToString() + ":" + ts.TotalMilliseconds. ToString() );
How to change the Page Title dynamically ?
//Declare
protected System.Web.UI.HtmlControls.HtmlGenericControl Title1 ;
//In Page_Load
Title1.InnerText ="Page 1" ;
Difference between Triggers and Storedprocedures ?
Triggers are basically used to implement business rules.Triggers is also similar to stored
procedures.The difference is that it can be activated when data is added or edited or
deleted from a table in a database.Triggers are special kind of stored procedures that get
executed automatically when an INSERT,UPDATE or DELETE operation takes place on a table.
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.
Isolation levels in SQL SERVER?
Isolation level get the condition to which data is isolated for use by one process and secured against interference from other processes. Read Committed - SQL Server applied a share lock while reading a row into a cursor but frees the lock immediately after reading the row.
Because a shared lock request is blocked by an exclusive lock, a cursor is prevented from reading a row that another task has updated but not yet committed. Read committed is the default isolation level setting for both SQL Server and ODBC. Read Uncommitted - When no locks while reading a row into a cursor and honors no exclusive locks. Cursors can be populated with values that have already been updated but not yet committed. The user is bypassing all of SQL Server’s locking transaction control mechanisms. Repeatable Read or Serializable -
SQL Server requests a shared lock on each row as it is read into the cursor as in READ COMMITTED, but if the cursor is opened within a transaction, the shared locks are held until the end of the transaction instead of being freed after the row is read. This has the same effect as specifying HOLDLOCK on a SELECT statement.
What is Collate in SQL SERVER-2000 ?
The COLLATE clause can be applied only for the char, varchar, text, nchar, nvarchar, and ntext data types. The physical storage of character strings in Microsoft® SQL Server™ 2000 is controlled by collations. A collation specifies the bit patterns to represent each character and the rules by which characters are sorted and compared with another character.
Why we use Unicode In Sql server ?
Unicode data is stored using the nchar, nvarchar,and ntext data types in SQL Server. Use these data types for columns that store characters from more than one character set. The SQL Server Unicode data types are based on the National Character data types in the SQL-92 standard.
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.
<>
<>
<>
< assembly="System.Data, Version=1.0.2411.0,Culture=neutral,PublicKeyToken=b77a5c561934e089">
< /assemblies >
< /compilation >
< /configuration >
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
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.
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.
What is Store Procedure ?
A stored procedure is a set of structured query language statements that you assign a name and store it in to the database in a compiled form so that it can share between no of programs.
Some advantage of Store Procedure.
they allow faster execution
they can reduce network traffic
What are Indexes in SQL SERVER?
Microsoft SQL Server index helps in creating the structure of table that helps in speeds retrieval of the rows in the table.
An index create a keys from one or more columns in the table. These keys are stored in a structure that allows SQL Server to find the row or rows created with the key values quickly and efficiently.If a table doest not containeated indexes,the data rows are not stored in any specific order.This structure is stored on heap. There are two types of SQL Server indexes:
(1)Clustered:-
Clustered indexes helps in sorting and storeing the data rows in the table take key values as base. Because the data rows are stored in sorted order on the clustered index key, clustered indexes more efficient for finding rows. There is only one clustered index per table. The data rows themselves form the lowest level of the clustered index. The only time the data rows in a table are stored in sorted order is when table contains a clustered index. If a table has no clustered index, its data rows are stored in a heap.
(2)Nonclustered:-
Nonclustered indexes having structure that is diffrent from the data rows . The lowest rows of a nonclustered index have the nonclustered index key values and each key value entry has pointers to the data rows containing the key value. The data rows are not stored in order based on the nonclustered key. The pointer from an index row in a nonclustered index to a data row
is called a row locator. The structure of the row locator depends on whether the data pages are stored in a heap or are clustered. In heap,a row locator is a pointer that point to the row. For a table with a clustered index, the row locator is the clustered index key.
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 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
Gave an idea about NameSpace and Assembly ?
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.
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 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.
0 comments:
Post a Comment