You are on page 1of 5

What is CTS, CLS and CLR ?

Answer
Common Type System CTS :A fundamental part of the .NET Framework's Common Language
Runtime (CLR), the CTS specifies no particular syntax or keywords, but instead defines a
common set of types that can be used with many different language syntaxes.
Common Language Specification (CLS):The Common Language Specification (CLS)
describes a set of features that different languages have in common.
The CLS includes a subset of the Common Type System (CTS).
CLR : this is common language runtime.the code which is in environment of clr is called managed
code.every language has runtime in case of .net there is CLR.so that that has some
responsibilites that is to tack care of the execution of codeother responsibilites garbage
collection-in that it remove the object which are not refered for long time.using Idisposable
interface with dispose method
How do you set language in web.cofig ? Answer
To set the UI culture and culture for all pages, add aglobalization section to the Web.config file,
and then setthe uiculture and culture attributes, as shown in the
following example:
<globalization uiculture="es" culture="es-MX" />
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" %>

How do you retrieve information from web.config ? Answer


generaly we store our connection string in web.config file under tag
<appsetting>
<add key=connection_string
value="data source=......"/>
</appsetting>
and for accessing the value in aspx page we writes
string const= configurationsetting.appsetting.connection_string

In web.congig you can add key and its value.And that key value u can retrive like
string connectionString = System.Configuration.ConfigurationSettings.AppSettings
["conStringWeb"].ToString()
Here conStringWeb is my key and i access its value.

Does the following statement executes successfully: Response.Write(?value of i = ? + i);


System.formatException Input string was not in a correct format.
if you would have declared and assigned some value to the variable "i" then it will execute.
What are Http handler ? Answer
An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in
response to a request made to an ASP.NET Web application. The most common handler
is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the
request is processed by the page via the page handler.
To create a custom HTTP handler, you create a class that implements the IHttpHandler interface
to create a synchronous handler or the IHttpAsyncHandler to create an asynchronous handler.
Both handler interfaces require you to implement the IsReusable property and the
ProcessRequest method. The IsReusable property specifies whether the IHttpHandlerFactory
object (the object that actually calls the appropriate handler) can place your handlers in a pool
and reuse them to increase performance, or whether it must create new instances every time the
handler is needed. The ProcessRequest method is responsible for actually processing the
individual HTTP requests.

In a page u have Web user controls . So what is the order in which the Page life Cycles
takes place? Answer
order of events are Init, page load, control load, page unload
How to write unmanaged code and how to identify whether the code is managed /
unmanaged ? Answer
you can only write unmanaged code in c# not in vb.net you can only call unmanaged code in
vb.net. calling and writing unmanaged code are different things.

To identify whether the code is managed or not open the file in ildasm in VS.Net Command
prompt.Also you can use a .Net tool called dumpbin, which can be
used to check the headers.
or open the dll in notepad and check for "V e r s i o n".
If you find that, it is managed assembly.

Types of values mode can hold session state in web.config ? Answer


1) Inproc Mode : where the values are stored in ASPNET_WP.exe process
2) StateServer : session values are stored in ASPNET_state.exe Process
3) SQL Server : session values are stored in SQL server Databases

What is Difference between Callbacks and Postback in ASP.NET? Answer


The difference between a callback and postback is that, as with a postback, a callback does not
refresh the currently viewed page (i.e. does not redraw the page). You can think of it as a quick
trip back to get some data etc. For example if there were two drop down boxes, the second
dependant on the value of the first, when a user selects a value of a the first, rather then posting
the whole page, doing some server side calculations and returning a new whole page to the
client, a callback can enable you to only go fetch the required data. Obviously from this, View
State is not updated with a callback (it's the same instance of the page just updated!!!).

How many Directives r in ASP.NET? Answer


@assembly: - Link assembly to current Page or user control directory.
@control: - Define control Specific attributes to used by ASP.Net page parser and compiler
included only in .ascx page.
@ Implement: - Indicates that a page or user control implements a specified .NET Framework
interface declaratively
@ Import: - import a namespace in Page or user control explicit.
@ Master: - Identifies a page as a master page and defines attributes used by the ASP.NET page
parser and compiler and can be included only in .master files
@ Master Type:- Defining class or virtual Path used to type master page property of page.
@Output Cache.
@Page.
@Previous Page Type.
@Reference.
@Register

WHAT ARE DEFFERENCE BETWEEN DATALIST AND DATAGRID Answer


A Datagrid, Datalist are ASP.NET data Web controls.
They have many things in common like DataSource Property , DataBind Method ItemDataBound
and ItemCreated .
When you assign the DataSource Property of a Datagrid to a DataSet then each DataRow
present in the DataRow Collection of DataTable is assigned to a corresponding DataGridItem
and this is same for the rest of the two controls also.
But The HTML code generated for a Datagrid has an HTML TABLE <ROW> element created for
the particular DataRow and its a Table form representation with Columns and Rows.
For a Datalist its an Array of Rows and based on the Template Selected and the RepeatColumn
Property value We can specify how many DataSource records should appear per HTML <table>
row.
In addition to these , Datagrid has a inbuild support for Sort,Filter and paging the Data ,which is
not possible when using a DataList and for a Repeater Control we would require to write an
explicit code to do paging.
RequiredFieldValidator--write code in javascript Answer
function validate()
{
if(document.getElementById("NameId").value == null)
alert("Please enter the name");
document.getElementById("NameId").focus();
return false;
}
in button OnClick() we hav to cal this function

Difference between stored procedure & function in sql server? Answer


1. Stored Procedure: supports differed name resolution Example while writing a stored procedure
that uses table named tabl1 and tabl2 etc. but actually not exists in database is allowed only in
during creation but runtime throws error.
Function wont support differed name resolution.
2. Stored procedure returns always integer value by default zero. where as function return
type could be scalar or table or table values(SQL Server).
3. Stored Procedure is pre compiled exuction plan where as functions are not.
4. Stored Procedure retuns more than one value at a time while funtion returns only one
value at a time.
5. We can call the functions in sql statements (select max(sal) from emp). where as sp is
not so
6. Function do not return the images, text whereas sp returns all.
7. Function and sp both can return the values. But function returns 1 value only. procedure can
return multiple values(max. 1024) we can select the fields from function. in the case of procedure
we cannot select the fields.
8. Functions are used for computations where as procedures can be used for performing
business logic
9. Functions MUST return a value, procedures need not be.
10. You can have DML(insert, update, delete) statements in a function. But, you cannot call
such a function in a SQL query..eg: suppose, if u have a function that is updating a table..
you can't call that function in any sql query. - select myFunction(field) from sometable; will throw
error.
11. Function parameters are always IN, no OUT is possible

Difference between caching objects in session objects? Answer


Session object creates for each user individually but 1 cache object for one application.

How Web Services help Us? What r the difference between Remoting and webservices
Web services are those services delivered via web and assume that ur project comprising of
timezone of u.s you need not write a code for that just call in the web method
you need for that time

Difference:-The ultimate difference between these two is When u have both client and server @
your end you can use webservices and when u have either the client or the server @ your end it
will be awesome if you opt Remoting
In remoting objects communicates thru homogineous protocols i.e.,TCP.Where as Webservices
provides funtionality thru hetrogenious protocals i.e., HTTP,SOAP.
In remoting data is passed as streams whereas webservices communicates in XML Format

If we add a textbox and give the required field validator,and i add two radio buttons 1 is
yes another one is No.And i add another one server control button ,if i click the button ,if
the radio button Yes is checked the validation control is fired ,if no the validation control is
not fired.So what you used to solve this problem. Answer
We can add the code in page_load
If Me.RadioButton1.Checked = True Then
Button1.CausesValidation = True
Else
If Me.RadioButton2.Checked = True Then
Me.Button1.CausesValidation = False
End If
End If

One Listbox showing all cities. If you select one city in list box the information related to
that particular city should be displayed in Datagrid . How do you do that? Answer
protected void ddlcity_SelectedIndexChanged(object sender,
EventArgs e)
{
sqlConnection con= new sqlConnection(" ");
string str="select * from table where city ='" +
ddlcity.SelectItem.Text ="'";
sqlDataAdapter da= new slqDataAdapter(str,con)
dataset ds = new dataset;
da.fill(ds,"City");
dgview.datasource=ds.tables["City"];
dgview.dataBind();
}

How many column in table of sql server?


We can add 1024 columns in a table in sql server 2000
what is the auto option in XML ? Answer
AUTO mode returns query results as nested XML elements

WHT IS DIFFERENCES BETWEEN HTML CONTROLS AND SERVER CONTROLS.


In server controls processing would be done at server side but in html controls would be made to
client side only.
The html controls the server is hit only on page submit.But for server controls on every user
response the server is hit. The server controls are used in places like railwayreservation.The html
control is used in places like hotelmenu card.

Write a sample code make use of xmltext writer Answer


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;

public partial class _Default : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
try
{
//creating a apth for writing xml
string xml1 = Server.MapPath("test2.xml");
//initialising xmlwriter
XmlTextWriter xt = new XmlTextWriter(xml1, System.Text.Encoding.UTF8);
xt.Formatting = System.Xml.Formatting.Indented;
//start writing it
xt.WriteStartDocument();
//element
xt.WriteStartElement("name");
// attribute
xt.WriteAttributeString("my_name", "name");
xt.WriteStartElement("phn");
xt.WriteAttributeString("my_phn", "266549560");
xt.WriteStartElement("id");
xt.WriteAttributeString("my_id", "100");
xt.WriteStartElement("city");
xt.WriteAttributeString("my_city", "city");
xt.WriteElementString ("title","gud girl");
//ending all elements
xt.WriteEndElement ();
xt.WriteEndElement();
xt.WriteEndElement();
xt.WriteEndElement();
xt.WriteEndDocument();
xt.Close ();

}
catch
{ }}}

What is an application domain? Answer


Application domain is something that isolates the application from interupting each other.
Is overloading possible in web services? yes its possible
How many webforms are possible on a single webpage? Answer
Only One & n number of pages we can...
how can i insert array values and retreive in asp.net Answer
Insert value into array
-----------------------
int[] a = new int[10];
for(int i=0;i<10;i++)
a[i] = i;

Retreive value from array


--------------------------
for (int i = 0; i < a.Length; i++)
Response.Write(a[i].ToString());

Dategrid filtering and sorting How can we sort all the fields at once? Answer
Undoubtedly u need to write a sql query for this with the order by (or) sort by.
And also call the subroutine that fills the datagrid after each insert or delete so that u can see the
changes at the runtime with the new alignment(i mean sorting)...

You might also like