Professional Documents
Culture Documents
Interview Questions
Interview Questions
NET
ASP.NET Interview Questions
This is a list of questions I have gathered and created over a period of time from my experience, many
of which I felt where incomplete or simply wrong. I have finally taken the time to go through each
question and correct them to the best of my ability. However, please feel free to post feedback to
challenge, improve, or suggest new questions. I want to thank those of you that have contributed
quality questions and corrections thus far.
There are some questions in this list that I do not consider to be good questions for an interview.
However, they do exist on other lists available on the Internet so I felt compelled to keep them here
for easy access.
1. What is ViewState?
ViewState allows the state of objects (serializable) to be stored
in a hidden field on the page. ViewState is transported to the
client and back to the server, and is not stored on the server or
any other external source. ViewState is used the retain the
state of server-side objects between postabacks.
Feedback
with prayers..........................................thomas
thomasjames_code@yahoo.co.in
pls help me
Your (excellent) example demonstrates the power of ASP in that a developer can dynamically create
HTML, XML, or even Javascript in the code-behind. As you have pointed out, this dynamically
generated code would execute on the client-side.
In short, you are correct in your assessment and appear to be able to intelligently answer this
question should you encounter it in an interview. Great question!
This is in response to Question 12, validation should occur on client side and server side both. Client
side should happen to avoid server round trip, but it's easily possible to by-pass client side validation.
Say if someone has turned of javascript in her browser or if the browser is not supporting javascript?
In that scenario client side validation will not work. Hence if the validation is also done on server than
such scenario can be avoided. The rule is whether validation occurs on client or not, but it should
always occur on server.
Excellent article
Vivek
server.transfer simply transfer execution to another page. this doesn't require any information to be
sent to the browser== it all occurs on the server without the user's knowledge.
The response.redirect method sends http information to the browser instructing it to go to another
page.
rohitkalya@yahoo.com
About question 12... the validation on client side. Yes, one should perform the validation on client
side... but as they say, *never trust your client, specially thin*.
So always perform validation on client side, try to save atleast one trip. If client is not messing with
the HTML, then he is doing a favor on himself. If he is messing, let him waste his own band width.
To check whether all the validors on a page validate into *true*, before performing business, you
better should do...
Page.IsValid
FieldValidator.IsValid.
mEEEEEEEEEEEEEEE!!!!!!!
Thank you.
Ever Loving,
R. Senthil Kumaran
My answer will be
The Response .Redirect () method can be used to redirect the browser to specified url, pointing to any
resource and may contain query strings and causes an extra roundtrip
Server.Transfer() performs server side redirection of the page avoiding extra roundtrip.
Server.Transfer() is preferred over Response.Redirect to avoid rountrip but the limitation is the aspx
page should reside on same web server.
Thank you.
Excellent questions. I will "eventually" add them to the main list above.
Thanks!
but what iritates me at intervies and tests is that there are companies that give you as test a small
project to do. This has no relevance in my point of view. instead i prefer to test the coding skill on
paper. i usualy ask the person to write me on paper a snippet of code of 5-10 lines of code.
Questions listed in the articles sounds good. I am adding more to the above mentioned list. As many
opted for some basics in .NET.
5) What are the different types of assemblies available and their purpose?
Private, Public/shared and Satellite Assemblies.
Public/shared Assemblies : Assembly which can be shared across applicaiton is known as shared
assemblies. Strong Name has to be created to create a shared assembly. This can be done using
SN.EXE. The same has to be registered using GACUtil.exe (Global Assembly Cache).
More to come....
I feel the difference between "src" and "code behind" tag can be better explained from the deployment
perspective.
When "code behind" tag is used, ASP.NET expects the precompiled dll on the server. When "src" tag is
used the code behind is converted to MSIL just in time. Then it does not expect the pre-compiled DLL.
So directly the .cs (if C# is used) can be deployed on the server.
For further details Microsift msdn help - Knowledge base can be looked.
My Email id is ramjanm@gmail.com
R J Singh
subhajit.biswas@gmail.com
My Email id is pk_manikandan@rediffmail.com
P.K.MANIKANDAN
2. How can you unload an asp.net app without touching the iis?
3. What is "delegation" in c# ?
4. in a load balancing environment, which way you choose to maintain state info, if security is
important?
5. What is the life cycle of an asp.net page? (events, from start to end)
Can u send me some more asp.net and vb.net interview questions with answers
my emailid is rathi_balu2004@yahoo.com
Thank you,
B.sharu
Can u send me some more asp.net and vb.net interview questions with answers
my emailid is prak_smile@yahoo.co.in
Thank you,
sprakash
Can anyone provide me some common questions on ASp.net which can be expected in interview.
consider me as a beginner. pls do mail me with Ans.
My email id is get2santy@yahoo.com
answer: Its not good practice because if the control is loaded in page_load by use of LoadControl() it
will not see any of its own viewstate in onload. So if there is a textbox on the ascx that the control
needs it will not be able to see the postback data.
onload
{
string temp = textbox1.text
}
temp = ""
At the end of the onload event it will sync back up with viewstate. So in any of the userfired events it
will have the correct values.
Also anything that is not named or loaded global must be loaded before it will respond to events on
the pages round trip.
If the control is named in the html portion it will have its viewstate synced already in pageload.
Thanking you,
Yours sincerely,
Jaineesh
Thanking you,
Yours sincerely,
Jaineesh
Ravi Goyal
vivek_harne@rediffmail.com
Vivek Harne
# re: Interview Questions: ASP.NET 5/19/2005 4:59 AM rojali
thanx fpr the questions.
I need the frequently asked interview questions on asp.net, C#, webservices and remoting. Please
send to my email id. subramaniam3007@hotmail.com
Thanks
Can u send me some more .net and ASP.NET interview questions with answers
my emailid is kuttumalu@gmail.com
Thank you, renju
Regards,
Harish
I need the frequently asked interview questions and answer on VB.Net, ASP.Net, C#. Please send to
my email id. ramakant_1352@rediffmail.com.
Regards,
Ramakant Singh
I need the frequently asked interview questions and answer on VB.Net, ASP.Net, C#. Please send to
my email id. santhosh_reddy8@yahoo.com.
Thanks in advance.
If somebody have asp.net and vb.net interview questions and answers, pls send it to
rskshiva@rediffmail.com.
Thanks,
Siva R
# re: Interview Questions: ASP.NET 6/1/2005 10:05 AM Raja Sekhar
Excellent Stuff. Thanks a lot.
I have a question how state management is done in a webfarm or webgarden.
I mean how a session will travel from one web server to another web server?
Thanks in advance Raja
i am new to c#.net. plz send me the frequently asked interview questions and plz guide to get through
some good company where i can explore my knowledge in .net.
i am new to c#.net. plz send me the frequently asked interview questions and plz guide to get through
some good company where i can explore my knowledge in .net.
my id is : pavan.devangam@gmail.com
i am new to ASP.net. plz send me the frequently asked interview questions and plz guide to get
through some good company where i can explore my knowledge in ASP/ASP.net.
my id is : g.c_biswas@sify.com
I am Searching for good job so please help me by giving me all the latest asp interview quiestions
my mail ID is skd_hari@yahoo.co.in
apurva2k000@yahoo.com
thx
Even if you ask an experience professional this above questions they to answer the same and I didn't
know how you can differenciate that this answer are realated to the freshers.
With Query,
Shankar
My Mail id is
Bhaveshpatel.78@gmail.com
thank you
Please send me all the faqs on vb.net , asp.net & c#.net which might help me out in my inteview
thanks
I need the frequently asked interview questions and answer on VB.Net, ASP.Net, C#. Please send to
my email id. pgseram@gmail.com.
2. How can you unload an asp.net app without touching the iis?
3. What is "delegation" in c# ?
4. in a load balancing environment, which way you choose to maintain state info, if security is
important?
5. What is the life cycle of an asp.net page? (events, from start to end)
with regards
thanQ
chandu
Thanks
manoj
to
saicharan.m@gmail.com
Chandan
Q. I want to programme in raw MSIL how can i do it can i use object orientation in it how will it
compile ultimately.
Q. when .NET has a built in garbage collector then is there any use defining a destructor in any .NET
class?
Happy programming....
RESPECTED SIR
AS I WAS BEGINEER IN .NET I NEED SOME QUESTIONS IN THE INTERVIEW POINT OF VIEW
My ID: sonia.khoja@gmail.com
This is realy great place for the Beginer attending interviews i am one of them.so is any one have
some collection of question in .Net and SQL Server please mail me at this ID mal_rajesh@sify.com
thanx.
Thanks
For example:
"What data types do the RangeValidator control support?
Integer, String, and Date. "
Suppose I know the answer. What does that really tell you? That I've worked with a Range Validator
before. Whoopee. Who cares?
If I don't now answer then it means that either I don't know it exists, haven't worked with it, or more
likely, simply don't remember which data types it supports. I can Google the question and get a
satisfactory answer in about 10 seconds.
When I interview, I want to know that the candidate understands deeper concepts than what can be
Googled in 30 seconds. Explain to me some particular OOP concepts. When would you use a
Singleton? Why? Why use an Interface? How would you implement exception handling in this case? I
want to know that they can THINK. Sure, I'll ask some basic questions that are trivial during a phone
screening, but asking what namespace some class out of the BCL belongs to is just...well, stupid. It
might make you feel superior if you know the answer, but it does nothing to help you find talented
programmers who can think intelligently.
Can someone explain when we inherit from HttpApplication to create a class for Global.asax,
Why do we NOT have to override Application_Start or any other event handler methods ??
Thanks
Sanket Vaidya
# re: Interview Questions: ASP.NET 9/19/2005 12:33 AM mithun.achar
hi,
I thank u 4 these questions this will help me in my interview today
mail me at apurva2k000@yahoo.com
My mail Id is narasimha_nandu@yahoo.com
The basic thing is nobody knows what to study [what are the important topics to focus, how to study
for the interview....[ we never know what Q would come from the interviewer] . Me too..Thats the
reason i am here.
By just going through the questions and answerers you can not win.
All you need to do is once you done reading the particular topic for eg. ADO.Net, then search for
questions and see if you could answer.
Or just don't read the answer and try to remember that. Read that topic fully and try to understand.
I got some basic questions, may seem very easy but try to answer [try to tell out loud in 3 or 4 lines]
with out googling
1. What is HTML ?
2. What is XML ?
3. What is the difference between a class and struct ?
4. What is the difference between a Get and a Post ?
5. What is a managed code ?
6. int n *=2; int x = n & 1; What is the value of x ?
7. What is a friend in C++ ?
Linked List:
? They allow a new element to be inserted or deleted at any position in a constant number of
operations (changing some references) O(1).
? Easy to delete a node (as it only has to rearrange the links to the different nodes)., O(1).
? To find the nth node, will need to recurse through the list till it finds [linked lists allow only
sequential access to elements. ], O(n)
Array
? Insertion or deletion of element at any position require a linear (O(n)) number of operations.
? Poor at deleting nodes (or elements) as it cannot remove one node without individually shifting all
the elements up the list by one., O(n)
? Poor at inserting as an array will eventually either fill up or need to be resized, an expensive
operation that may not even be possible if memory is fragmented. Similarly, an array from which
many elements are removed may become wastefully empty or need to be made smaller, O(n)
? easy to find the nth element in the array by directly referencing them by their position in the array.
[ arrays allow random access ] , O(1)
Looks like you are trying to do a good thing here; but most of your answers are very incomplete. If
you were an interviewee for a senior developer position with my company and gave some of the
answers that you have listed they would definitely warrant follow up questions, or I would consider
them wrong; and that is just at first glance.
Dave
I got Six Years of Experience in vb , asp. I Know .net and i did some projects in asp.net.
Now i am trying job in MNC comapnies. I don't know how they are asking questions can you give me
some sample questions?
Sir - I am developing one application where my front end is vb.NET. I want to make DLL library of
classes and various components that will be used again and again in the application. but as I have
studied in book for making dll library for classes we use class library. and for making library of various
components we use Window control library. In this way there will be many dll libraries.
Thus my question is - can we make one library where all classes , window control components and
web contents can reside for reusabilility purpose. If yes then how? Or is it must to make three
different libraries for these three?
chandralekha
I am a fresher and seeking about a job in a reputed company.can u send me the questions of related
type which were asked in the interviews.I have the knowledge of .net and no practical experience on
it..
My email is kvbhaskar7@yahoo.co.in
Please send me all the FAQs on vb.net , asp.net & c#.net which might help me out in my inteview
yogeshrc@gmail.com
Yogesh Choudhary
9890254775
Also, there are a lot of people asking to have things emailed to them. Just out of curiosity, are people
actually replying to those requests? I'm also studying for a job interview, but I wouldn't bother asking
for help! I go and seek out what I need. I googled to find this page, I can google to find others. I'm
just sayin...
p.s. I've been working with ASP.Net since it was in beta, and even I didn't know the answer to a lot of
these questions! In any big company, the way work and projects are divided up, you don't always
work with all aspects of web development. You do the part that's assigned to you. We used SOAP, but
I never coded for that part of it; I've coded to use other peoples' web services but never coded my
own; never used a diffgram; etc. And as far as what the methods are, type a dang dot and see what
pops up!
Questions are very good , please update the page with different Question and answers so that we can
learn more and more .
i wanted to know advanced technique is added to VS 2005 and Server SQL 2005 .
regards
Jagadish Gowda
Regards,
Arunkavin
All these questions are very much helpfull for the asp.net interviews.
i need some more frequently asked questions for the interview in asp.net c#,Ado.net,SQL Server
jdsamymsc@yahoo.com
regards
J.Duraisamy
.
manishmiet2006@gmail.com
With Regards
Manish Kumar Tiwari
I got an interview with Bosch can any body help me providing some hi level and standard interview
questions on ASP.NET,C#.net and SQL SERVER 2005.Plz I am really thankful if anybody help me out.
id psamlskranthi@yahoo.co.in
All these questions are very much helpfull for the asp.net interviews.
i need some more frequently asked questions for the interview in asp.net c#,Ado.net,SQL Server
rc@levi.com
regards
C.Ramesh
All these questions are very much helpfull for the asp.net interviews.
i need some more frequently asked questions for the interview in asp.net c#,Ado.net,SQL Server
menaka.soms@gmail.com
regards
Menaka
Nima
# re: Interview Questions: ASP.NET 2/8/2006 12:19 AM Seshu Kumar
Please send the interview questions .. so that i can prepare these questions
seshu
Really, this time I am not going to give answer of any question because I am novice in this field but
dear I will come back with lots of question along with sollutions.
Warm Regards
Deepak
these question and answers are very useful to face the technical interview purpose
The question:
Thanks,
Intekhab
I just have the list, please look around for answers. Even I need it. Best of Luck!!
Thanks,
Atul
i am new to ASP.net. plz send me the frequently asked interview questions and plz guide to get
through some good company where i can explore my knowledge in ASP/ASP.net.
my id is : sankarjosephcse@yahoo.com
With the MCSD, they ask in depth questions. Not lame repeats of stuff you can google out on google.
Ajay Kumar
Arudhran
Cheers
can anybody send some more important ASP.NET interview Q/A like typed dataset and so on.
Thanks
Iam B-Tech graduate, iam new to .net,asp.net and c# languages.I need basic questions to work on
this.Suggest me any book or send me questions on this.
Thanks
2.I want to destroy previous form when user moves from one form to another. The previous page
should not be accessable again i.e it should be Expired.
4.I want a list of availabe webservices.( I tried to find it on www.UDDI.org but couldn't find usefull
one.
I have a file called a.aspx which has some textboxes. I want to post the values to b.aspx without
using response.redirect. How can I do this.?????
Could all the people send me the question which they faced in their interviews? Or Help me with
questions that u can think can be asked.
question 3: i would answer like this "the view state is available when Load event is fired" I was little
confused with answer before and after... because this is main difference between this two events.
During Init we can not see view state.
question 10: full answer is integer, string, double, date and currency.
thanks
Satyendra
if (Context.Session != null)
{
int int_MilliSecondsTimeOut = (this.Session.Timeout * 60000) - 30000;
string str_Script = @"
<script type='text/javascript'>
function Reconnect()
{
window.open('reconnect.aspx','reconnect','width=5,height=5,top=1800,left=1800,scrollbars=no,showi
ntaskbar=no');
}
window.setInterval('Reconnect()',"+int_MilliSecondsTimeOut.ToString()+ @");
</script>";
this.Page.RegisterClientScriptBlock("Reconnect", str_Script);
}
}
Solution 2
I recently came across some code which attempted to fix this problem but that was unsuccessful
because the author had forgotten the issue of client side caching.
Add to your page the following code:
private void Page_Load(object sender, System.EventArgs e)
{
this.AddKeepAlive();
}
private void AddKeepAlive()
{
int int_MilliSecondsTimeOut = (this.Session.Timeout * 60000) - 30000;
string str_Script = @"
<script type='text/javascript'>
//Number of Reconnects
var count=0;
//Maximum reconnects setting
var max = 5;
function Reconnect()
{
count++;
if (count < max)
{
window.status = 'Link to Server Refreshed ' + count.toString()+' time(s)' ;
var img = new Image(1,1);
img.src = 'Reconnect.aspx';
}
}
window.setInterval('Reconnect()',"+ _
int_MilliSecondsTimeOut.ToString()+ @"); //Set to length required
</script>
";
this.Page.RegisterClientScriptBlock("Reconnect", str_Script);
}
This code will cause the client to request within 30 seconds of the session timeout the page
Reconnect.aspx.
My id: satyadeep_b@hotmail.com
# re: Interview Questions: ASP.NET 4/25/2006 4:00 AM K.SABARI BABU
This is very useful url for the beginners to study ..Dont miss to read it ok........All The Best ..May this
site be useful at its best.
-Regrads
-Pooja
my id is anildudam@yahoo.com
I am a fresher and seeking about a job in a reputed company.can u send me the questions of related
type which were asked in the interviews.I have the knowledge of .net and no practical experience on
it..
My email is vinomca@gmail.com
Regards,
sai
Really very nice collection Your question. If You have some more questions Please send me c# and
VB.net and Asp.net to my mail id.
My Mail id : selvaa_k@hotmail.com
Thanks and regards
K. saravana selvam
From
shailesh
e-mail id: shailesh_ek@yahoo.com
`
mail:dskarthik_tamil@yahoo.co.in
I am a corprate trainner in NIIT LIMITED.I have two year experience on .NET as corporate trainner
and i have good knowledge on .NET plateform.but now i am going to join interviews on .NET at the
level of two year experience.I want to check whattype of question can be asked in interviews.so
please send me immediatly interview question on .NET at two year experience level.I shell highly
obliged to you.
My Email Id : ap_chauhan24@yahoo.com
Thanking You
Can you please forward me the basic quesitons and the advanced questions on ASP.net.
My id is kiranmai_maddula@yahoo.co.in
Thanks in advance,
Kiran
i am new to ASP.net. plz send me the frequently asked interview questions and plz guide to get
through some good company where i can explore my knowledge in ASP/ASP.net.
my id is : beneezrch@gmail.com
Regards
Adesh Jain
# re: Interview Questions: ASP.NET 6/13/2006 11:13 PM JHANSI RANI
This site is very useful to me. Please include some more interview question and also
Conduct online exam in asp.net.
I done two project in ASP.Net and I am final year student. I am searching good job in ASP.Net please
help me to get good job in ASP.net
Friends.... if u hav any usful info on .Net plz forward them to my mail id...... here it
goes.....ramuniceguy@yahoo.com or ramsinfokit@gmail.com.
My advance thanks for those who are willing to help me........ hav a great time....
Would you pls send me some Interview questions in ASP.Net and C#?
With Regards
Anju
thanks
santosh lonkar
# re: Interview Questions: ASP.NET 6/21/2006 1:08 AM Rituparno
1.Different type of Garbage Collection?
2.How use Payment Gateway?
3.Satellite
bye
What are ASHX files? What are HttpHandlers? Where can they be configured?
What is needed to configure a new extension for use in ASP.NET? For example, what if I wanted my
system to serve ASPX files with a *.jsp extension?
What events fire when binding data to a data grid? What are they good for?
Explain how PostBacks work, on both the client-side and server-side. How do I chain my own
JavaScript into the client side without losing PostBack functionality?
What is the OO relationship between an ASPX page and its CS/VB code behind file in ASP.NET 1.1? in
2.0?
What happens from the point an HTTP request is received on a TCP/IP port up until the Page fires the
On_Load event?
How does IIS communicate at runtime with ASP.NET? Where is ASP.NET at runtime in IIS5? IIS6?
What is an assembly binding redirect? Where are the places an administrator or developer can affect
how assembly binding policy is applied?
Thanks Admin This site is very useful to me. Please include some more interview question and answer
and also Conduct online exam in asp.net. and vb.net and sql server.
Thanks
Nazar
# Interview Questions: ASP.NET 6/23/2006 12:29 AM Yogesh Nagpal
Hi to everyone,
I m a new guy on the\is site.I m working in mango it solutions pvt ltd,new delhi since jan 2005.I
want .net interview questions as now i want to change the company.Plz mail those interview questions
at yogesh_us2002@yahoo.com.
Thanks,
With regards.
Yogesh Nagpal.
DataSets are a more complex and feature-rich object than DataReaders. Whereas DataReaders simply
scuttle data back from a data store, DataSets can be thought of as in-memory databases. Just like a
database is comprised of a set of tables, a DataSet is made up of a collection of DataTable objects.
Whereas a database can have relationships among its tables, along with various data integrity
constraints on the fields of the tables, so too can a DataSet have relationships among its DataTables
and constraints on its DataTables' fields
can anybody send me all possible interview questions both for freshers as well as experienced people
for asp.net
also if possible please send me the available source codes or projects
thanking you
ashok
ashoka_4u_y2kn@yahoo.com
my email id is.....anusha_diva2004@yahoo.com
thanks in advance
The answers of the Frequently Asked Questions are extremely helpful to me for my interview
preparation.
csbhaskar_soft@yahoo.com
email : ritscoolman@yahoo.co.in
hereiam.bicky@gmail.com
thanking you,
vinay
1) EnableViewStateMac is designed to detect when the viewstate of a page has been tampered with. If
the EnableViewStateMac attribute of the page directive is set to true then the server will perform a
Machine Authentication Check on the viewstate posted back to determine if it has been tampered with
on the client.
Further, if you perform a Server.Execute() on a page it is important to disable viewstate mac on the
page you are executing else the server will report that the viewstate has been tampered with (since
the page that has been executed' ViewState will be merged with the Viewstate of the calling page and
thus wont match with what the server expects).
2) Bubbling an event is the process of passing an event upto a higher level event handler to prevent
having to write an event handler for each individual object. For example, if you had lots of buttons on
a row, rather than writing a handler for each button you could bubble the event up to an object higher
in the hierarchy to handle. The original event data should still be available.
A delegate allows you to specify the format of the function that you will be calling without having to
specify which function you wish to call - this then leaves it upto the function called to determine how
to implement the action.
As a practical example: say you wish to design a sort method but are unsure how the sort should be
implemented, you can define a sort delegate which, when called can notify any subscribers with the
correct signature that the data needs to be sorted - these functions have therefore been "delegated"
or assigned with the requirement to sort data without the original caller having to worry about the
implementation -- as long as the signature (return type and parameters) match the delegate then the
responsibility of performing a sort can be off-loaded to another function.
By seperating the algorithm it allows the code to be written in a more general way.
Think of it like a button you add to a form: onclick you want to notify the application that a click has
occured but you want to offload the responsibility of handling the action to something else as you dont
know how it needs to be implemented.
Regards,
Paul
I have One year experience on .NET as Asst. Programmer and i have good knowledge on .NET
plateform.but now i am going to join interviews on .NET at the level of One year experience.I want to
check what type of question can be asked in interviews.so please send me immediatly interview
question on .NET at one year experience level.I shell highly obliged to you.
but i am sorry to say that few answers are wrong in my point of view.
for example:
EnableClientScript,Enabled
the above two properties are commonly used in all validation control.
for ex: ValidationSummary control dont have any text and controltovalidate property but it
has Enableclientscript,enabled property.
sir onething i want to tell u frankly,many of the software concerns in india who are all giving ur
questions.so i couldnt say my answer is correct.
with regards
s.jagadeesan
(INDIA)
# problem faced with Tool Box in asp.net 8/12/2006 9:34 AM Bharat Agrawal
hi .
I m using visual studio web devloper 2005 express edition ..it was runnung very fine but now I dont
know what changes I hve made in toolbox setting from which I m not able to use all toolbox
controls ...only Html controls are highlighted to be used ..I can see all the controls but they r not
highlighted ...initially all of them were working very fine ...plzzz help me out .
from
gaurav goel
mail id gauravhctm@yahoo.co.in
These questions are useful for me.Can you plz send me frequently asked interview questions on
asp.net, C#, webservices and remoting.
Thanks
Swetha
Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do
you add an event handler?
Add an OnMouseOver attribute to the button. Example:
btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
This wouldn't execute an ASP.NET function, it would execute a client-side javascript function. In order
to execute an ASP.NET function, someClientCodeHere() would have to invoke __doPostBack (or
another function that would do the same) to post back the form to the server, or else it would have to
use AJAX/ATLAS to make an XMLHTTPRequest to the server to invoke an ASP.NET function.
As to the example given, if I ever see a web page that does an auto post back on mouseover of a
button, I'll personally strangle the developer with his own mouse cord.
From roopa
Email : roopa3_10@yahoo.co.in
From roopa
Email : roopa3_10@yahoo.co.in
# Interview Questions: ASP.NET 8/31/2006 4:58 AM SM. MANIKANDAN
I have two year experience on .NET as Asst. Programmer and i have good knowledge on .NET
plateform.but now i am going to join interviews on .NET at the level of two year experience.I want to
check what type of question can be asked in interviews.so please send me immediatly interview
question on .NET at two year experience level (ASP.NET, C#).I shell highly obliged to you.
M.MANIKANDAN
raturi.kamal@gmail.com
mail me at :
msc.2003@gmail.com , gannarammohan@yahoo.com
mail me at :
msc.2003@gmail.com , gannarammohan@yahoo.com
# re: Interview Questions: ASP.NET 9/17/2006 8:05 PM sunil patil
hellow sir ,
my self sunil patil ,
a interview question on .net is very standard
&i like thah question
my mail account is spatil512@gmail.com
I have one plus experience in VB.Net ..I thought of attending interviews with this experience..However
I dont have any idea of how the interview questions would be?.. Pls send me frequently asked
Interview questions in Vb.Net (both web and windows programming related..)..
itsmenmk@gmail.com,
hiitsmenmk@yahoo.co.in
I am 2 years exp in .NET. I need some of the interview questions which might be frequently asked
during the interview for a 2+ exp candidate. Plz send to my mail id m_svasu@rediffmail.com
Thanks
Maggie
my id is ashwin_ala20@yahoo.co.in
3). What is code for placing the text box in the datagird
please give me some URL or the code of the last answer you can email me on annivaul@hotmail.com
HELP WILL BE APPERIACATED
All the information is really useful. Keep it up and keep helping others
BEST OF LUCK
CheersL:-)
Please send me all the interview questions necessary while applying to positions for 2 years
experience
Also kindly send me some source code of a real time projects along with their description
please
Please send me all the interview questions necessary while applying to positions for 3+ years
experience
Also kindly send me some source code of a real time projects along with their description
Could you please provides some more questions on Data Access Layer (related to dataset, datareader)
and crystal report
Mail me at gr_rama1@yahoo.com
mail me @ : sudhir.kumar.ch@gmail.com
BYE
SEKAR.V
BYE
SEKAR.V
My mail id is rajan2304@yahoo.co.in
Thanks
My mail id is debasis123@hotmail.com
Thanks
My mail id is debasis123@hotmail.com
Thanks
My mail id is debasis123@hotmail.com
Thanks
My mail id is : manojkuswain@yahoo.co.in
Thanks
Manoj
By default C# passes parameters by value. To make it pass by reference, keywords ref and out can be
used. Difference between them is that ref parameter needs to be initialised, as below
2) What does the virtual and override keywords mean and how are they used?
When a method, property or event is declared with Virtual keyword, the derived class can modify and
override the method, property or event.
Override keyword is used when a derived class wants to change the functionality of a method from its
actual definitionin the base class.
3) What is MVC?
MVC is a Design method where the Business logic in the application is completely decoupled from
presentation layer logic. this way, it is eaasy to program and also maintain high profile applications.
MVC = Model View Control
Regards
nagendra
nagendrareddy_g@yahoo.co.in
My Id Is : sudarshan_268@yahoo.co.in
I would also like to know how can we transfer the data from one page to another in case of
server.transfer and response.redirect.
Are both server.transfer and response.redirect behaves like form.submit.
Could anybody tell me what is the difference between Server DataGrid and Windows DataGrid.
Thank you,
Bobby
Mail me at nishi.srivastava@sify.com
mp_hegn@yahoo.com
id : nilesh.co.hot.comp.28.28.5.9@gmail.com
swarna. a
swarna. a
swarna. a
swarna. a
Thanks,
Akshay
i would like to have some more on c# and sql server 2000. mail me at rcgirotra1@yahoo.com.....
Thanks.
Tahn'Q'
the question are really good i have one year of experience in winforms and asp.net please send me
some more question as per 1 year of experience level.
my mail address is vikastiwari99@rediffmail.com.
this is ramji from Bangalore, thanks to all every have done a great job so iam also sending some faq s
regarding .net
ThanQ
9.Explain constructor
Ans. Constructor is a method in the class which has the same name as the class (in VB.Net its New()).
It initialises the member attributes whenever an instance of the class is created.
12.How can you clean up objects holding resources from within the
code?
Ands Call the dispose method from code for clean up of objects
Page Load - If it was a postback request then the data gets loaded
in the control from the ViewState and control property are set.
Validation - If any control validation present, they are performed
and IsValid property is SET for each control.
PostBack Event Handling - If it was a postback request then any
event handlers are called.
Page Rendering - Before this the viewstate is saved from the page
and RENDER method of each page is called.
Page Unload - Page is fully rendered and sent to the client(Browser)
and is discarded. Page property RESPONSE and REQUEST are unloaded.
div id=”banner”
p class=”alert”
43. When inserting strings into a SQL table in ASP what is the risk and
how can you prevent it?
Ans. SQL Injection, to prevent you probably need to use Stored Procedures
instead of inline/incode SQL
variables, count1 and count2. Further suppose that count1 contains the value 5 and that count2 is
assigned the value of count1.
count1 = 5;
count2 = count1;
Both count1 and count2 now contain their own copies of the data, in this case, the value 5. They are
independent. If count1 is now assigned the value 6, count2 will still contain the value 5. This type of
copy is referred to as a deep copy. The value itself is copied.
If count1 is now assigned the value 6, count2 will still contain the value 5. This type of copy is referred
to as a deep copy.
For reference types copies work differently. Remember that a reference type consists of two parts: the
data on the heap and the address of the data stored in the reference variable itself on the stack. When
one reference variable is assigned to another, the address stored in the first is copied to the second.
They both then refer to the same data content on the heap. This is referred to as a shallow copy.
Can anyone give me Questions & Answers of Vb.Net/C# and ASP.Net beneficial for interview
Regards,
Gaurav Arora
i have experience of 2 & 1/2 yrs in ASP,VB ITP ,MATLAB and have done MCP in .Net.now i want to go
for .net. plz send me the frequently asked interview questions on ASP.net,VB.net,C#,etc and plz guide
to get through some good company where i can explore my knowledge in .net.
my id is : kshuchi.15@gmail.com
venkat_chalapathik@yahoo.com
I will be really thankfull to you.
my id: dilipbari1@indiatimes.com
Prameet Sharma
I am looking for a VB.NET, ASP.NET interview qns. can you please send me some interview questions
related to VB.NET, ASP.NET?send it to my mail id.
thanks,
Raghu
I am a fresher and seeking about a job in a reputed company.can u send me the questions of related
type which were asked in the interviews.I have the knowledge of .net and no practical experience on
it..
My email id is lj.prasanth@gmail.com
Thanks
Thanks in advance.
.NET Interoperability
Threading
What is Multi-tasking ?
What is Multi-threading ?
What is a Thread ?
Did VB6 support multi-threading ?
Can we have multiple threads in one App domain ?
Which namespace has threading ?
Can you explain in brief how can we implement threading ?
How can we change priority and what the levels of priority are provided by .NET ?
What does Addressof operator do in background ?
How can you reference current thread of the method ?
What's Thread.Sleep() in threading ?
How can we make a thread sleep for infinite period ?
What is Suspend and Resume in Threading ?
What the way to stop a long running thread ?
How do i debug thread ?
What's Thread.Join() in threading ?
What are Daemon thread's and how can a thread be created as Daemon?
When working with shared data in threading how do you implement synchronization ?
Can we use events with threading ?
How can we know a state of a thread?
What is a monitor object?
What are wait handles ?
Twist :- What is a mutex object ?
what is ManualResetEvent and AutoResetEvent ?
What is ReaderWriter Locks ?
How can you avoid deadlock in threading ?
What’s difference between thread and process?
Caching Concepts
ASP.NET
.NET Architecture
What is the namespace in which .NET has the data functionality classes ?
Can you give a overview of ADO.NET architecture ?
What are the two fundamental objects in ADO.NET ?
What is difference between dataset and datareader ?
What are major difference between classic ADO and ADO.NET ?
What is the use of connection object ?
What is the use of command objects and what are the methods provided by the command
object ?
What is the use of dataadapter ?
What are basic methods of Dataadapter ?
What is Dataset object?
What are the various objects in Dataset ?
How can we connect to Microsoft Access , Foxpro , Oracle etc ?
How do we connect to SQL SERVER , which namespace do we use ?
How do we use stored procedure in ADO.NET and how do we provide parameters to
the stored procedures?
How can we force the connection object to close after my datareader is closed ?
I want to force the datareader to return only schema of the datastore rather than data ?
How can we fine tune the command object when we are expecting a single row or a single
value ?
Which is the best place to store connectionstring in .NET projects ?
What are steps involved to fill a dataset ?
Twist :- How can we use dataadapter to fill a dataset ?
What are the various methods provided by the dataset object to generate XML?
How can we save all data from dataset ?
How can we check that some changes have been made to dataset since it was loaded ?
Twist :- How can we cancel all changes done in dataset ? , How do we get values which
are changed in a dataset ?
How can we add/remove row’s in “DataTable” object of “DataSet” ?
What’s basic use of “DataView” ?
What’s difference between “DataSet” and “DataReader” ?
Twist :- Why is DataSet slower than DataReader ?
How can we load multiple tables in a DataSet ?
How can we add relation’s between table in a DataSet ?
What’s the use of CommandBuilder ?
What’s difference between “Optimistic” and “Pessimistic” locking ?
How many way’s are there to implement locking in ADO.NET ?
How can we perform transactions in .NET?
What’s difference between Dataset. clone and Dataset. copy ?
Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Explain in detail the fundamental of connection pooling?
What is Maximum Pool Size in ADO.NET Connection String?
How to enable and disable connection pooling?
soorajkkhere@gmail.com
Thanks in advnace
The questions are same from many days,it will be grateful if u add some more questions .
Thank You
Rahul.
# re: JIT (as the response for Saini) 5/25/2007 2:55 AM Selva
A Microsoft.NET application can be run only after the MSIL code is translated into native machine
code. In .NET Framework,
the intermediate language is complied "just in time" (JIT) into native code when the application or
component is run instead of
compiling the application at development time. The Microsoft.NET runtime consists of two JIT
compilers. They are standard JIT
compiler and the EconoJIT compiler. The EconoJIT compiler compiles faster than the standard JIT
compiler, but the code it produces is not
as optimized as the code obtained from the standard JIT compiler.
My Email Id :saggurthi_sri@yahoo.com
The .Net Framework (version 2.0) includes 18,619 types; 12,909 classes; 401,759 public methods;
93,105 public properties and 30,546 public events.
It includes a new feature called Control State. Control state is similar to view state except that is used
to preserve only critical information. For example the gridview control uses control state to store the
selected row. Even if you disable the viewstate, the gridview control remembers which row is selected.
We can precompile an entire ASP.Net application by using the aspnet_compiler.exe command line tool.
If you precompile an application, users do not experience the compilation delay resulting from the first
page request.
The entire contents of an ASP.NET page, including all script and HTML content, are compiled into a
.net class. If we request a page that does not exist ASP.NET automatically compiles the page into a
new class and stores the compiled class (the assembly) in the temporary ASP.NET files folder located
in the following path
The next time when anyone request for the same page the page is not compiled again the previous
one is executed even if you request the page after three years.
When the class is added to the Temporary ASP.NET files folder, a file dependency created between the
class and the original ASP.NET page. If the ASP.NET page is modified in any way, the corresponding
.net class is automatically deleted. The next time when someone request the page, the Framework
automatically compiles the modified page source into a new .net class. This process is called Dynamic
compilation. Dynamic compilation enables ASP.Net application o support thousands of simultaneous
users.
Note:-
We can disable dynamic compilation for a single page, the pages in folder, or an entire website with
the CompilationMode attribute.
Disabling the compilation is useful when thousands of pages in a website and you do not want to load
an assembly into memory for every page. When the compilation attribute is said to the value Never,
the page is never compiled and an assembly is never generated for the page. The page is interpreted
at runtime. We cannot disable the compilation code that includes server side code.
Literal Control:-
We can use literal control to display text or HTML content in a browser. It does not render its content
inside a <span> tag.
It does not support CSS class or Back color properties. However it supports the mode property that is
not supported by the label control.
Mater Pages:-
You can nest content place holder controls in a master page. If you do this, then you have the option
of overriding greater or smaller areas of content in master page.
You cannot work with nested master pages in visual web developer while in design view. If you need
to nest master pages, then you need to stick to source view.
Relative URLs used by ASP.NET controls in master page are automatically reinterpreted relative to
master page. This process of reinterpretation is called rebasing. Only ASP.NET control properties
decorated with URL property attribute are rebased.
You will receive null reference exception if you use the Page.Header property when the master page
does not contain a server-side <head> tag.
Themes:-
The contents of a theme folder are automatically compiled in the background into a new class. So you
want to be careful not to name a theme with a class name that conflicts with an existing class name in
your project.
The textbox control includes a Runat=”server” attribute, but it does not include an ID attribute. You
must always include a Runat attribute, but you can never include the ID attribute when declaring a
control in a skin.
We can not create a skin that applies to the properties of a user control. However, you can skin the
controls contained in a user control.
AJAX (Asynchronous JavaScript and XML) enables you to update content in a page without posting
back to the server. In the ASP.NET Framework, AJAX is referred to as ‘client callbacks’. To add AJAX
support to a user control, you must implement the ICallBackEventHandler interface and add the
necessary JavaScript scripts to process the results of the AJAX call.
? Create a client script for invoking the AJAX call. You can get this script with the
Page.ClientScript.GetCallbackEventReference () method.
? Create a sever methods named RaiseCallbackEvent() and GetCallbackResult(), which returns a string
value from the server.
? Create a client method that receives the value from the server RaiseCallbackEvent() method and
does something with the value.
With Regards,
Raj Chaithanya
anyway Thanks!
manishmukati@yahoo.com
Thanx
wating for reply
ram_kvrm04@yahoo.com
ASP 3.0
ASP .NET
• An ASP.NET user control is a group of one or more server controls or static HTML elements that
encapsulate a piece of functionality. A user control could simply be an extension of the functionality of
an existing server control(s) (such as an image control that can be rotated or a calendar control that
stores the date in a text box). Or, it could consist of several elements that work and interact together
to get a job done (such as several controls grouped together that gather information about a user's
previous work experience).
Source: 15seconds.com
Required entry RequiredFieldValidator Ensures that the user does not skip an entry.
Comparison to a value CompareValidator Compares a user's entry against a constant value, or against
a property value of another control, using a comparison operator (less than, equal, greater than, and
so on).
Range checking RangeValidator Checks that a user's entry is between specified lower and upper
boundaries. You can check ranges within pairs of numbers, alphabetic characters, and dates.
Pattern matching RegularExpressionValidator Checks that the entry matches a pattern defined by a
regular expression. This type of validation allows you to check for predictable sequences of characters,
such as those in social security numbers, e-mail addresses, telephone numbers, postal codes, and so
on.
User-defined CustomValidator Checks the user's entry using validation logic that you write yourself.
This type of validation allows you to check for values derived at run time.
Source: MSDN
5. How will you upload a file to IIS in Asp and how will you do the same in ASP.net?
First of all, we need a HTML server control to allow the user to select the file. This is nothing but the
same old <input tag, with the type set to File, such as <input type=file id=”myFile” runat=server />.
This will give you the textbox and a browse button. Once you have this, the user can select any file
from their computer (or even from a network). Then, in the Server side, we need the following line to
save the file to the Web Server.
myFile.PostedFile.SaveAs ("DestinationPath")
Attributes are a mechanism for adding metadata, such as compiler instructions and other data about
your data, methods, and classes, to the program itself. Attributes are inserted into the metadata and
are visible through ILDasm and other metadata-reading tools. Attributes can be used to identify or use
the data at runtime execution using .NET Reflection.
Source: OnDotNet.com
8. What is the difference between server side and client side code?
Server code is executed on the web server where as the client code is executed on the browser
machine.
9. Why would you use “EnableViewState” property? What are the disadvantages?
EnableViewState allows me to retain the values of the controls properties across the requests in the
same session. It hampers the performance of the application.
10. What is the difference between Server. Transfer and Response. Redirect?
The Transfer method allows you to transfer from inside one ASP page to another ASP page. All of the
state information that has been created for the first (calling) ASP page will be transferred to the
second (called) ASP page. This transferred information includes all objects and variables that have
been given a value in an Application or Session scope, and all items in the Request collections. For
example, the second ASP page will have the same SessionID as the first ASP page.
When the second (called) ASP page completes its tasks, you do not return to the first (calling) ASP
page. All these happen on the server side browser is not aware of this.
The redirect message issue HTTP 304 to the browser and causes browser to got the specified page.
Hence there is round trip between client and server. Unlike transfer, redirect doesn’t pass context
information to the called page.
Application_start gets fired when an application receive the very first request.
Session_start gets fired for each of the user session.
The concept of child class inheriting the behavior of the parent is called inheritance.
If there are many classes in an application that have some part of their behavior common among all ,
inheritance would be used.
1. Init
2. Load
3. Cached post back events
4. Prerender
5. Unload
No
15. Which template you must provide to display data in a repeater control?
Item Template
16. How can you provide an alternating color scheme in a Data Grid?
Yes
18. What method I should call to bind data to control?
Bind Data ()
21. Which is the common property among all the validation controls?
ControlToValidate
False
26. To test a Web Service I must create either web application or windows application. True or false?
False
Any number
29. Is it possible to share session information among ASP and ASPX page?
No, it is not possible as both of these are running under different processes.
1. Window.
2. Form.
3. Passport.
4. None.
Open connection
Initialize Adapter passing SQL and connection as parameter
Initialize Dataset
Call Fill method of the adapter passes dataset as the parameter
Close connection.
33. Can I have data from two different sources into a single dataset?
Yes, it is possible.
No.
35. Is it possible to have tables in the dataset that are not bound to any data source?
Yes, we can create table object in code and add it to the dataset.
The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries
to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class
is registered, any COM client can use it as though the class were a COM class. The class is registered
only once, when the assembly is installed. Instances of classes within the assembly cannot be created
from COM until they are actually registered.
Execute Scalar returns the value in the first row first column of a query result set.
ExceuteNonQuery return number of rows affected.
The common language runtime is the execution engine for .NET Framework applications.
It provides a number of services, including the following:
• Code management (loading and execution)
Application memory isolation
• Verification of type safety
• Conversion of IL to native code
• Access to metadata (enhanced type information)
• Managing memory for managed objects
• Enforcement of code access security
• Exception handling, including cross-language exceptions
• Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and
data)
• Automation of object layout
• Support for developer services (profiling, debugging, and so on)
The common type system is a rich type system, built into the common language runtime that supports
the types and operations found in most programming languages. The common type system supports
the complete implementation of a wide range of programming languages.
The Common Language Specification is a set of constructs and constraints that serves as a guide for
library writers and compiler writers. It allows libraries to be fully usable from any language supporting
the CLS, and for those languages to integrate with each other. The Common Language Specification is
a subset of the common type system. The Common Language Specification is also important to
application developers who are writing code that will be used by other developers. When developers
design publicly accessible APIs following the rules of the CLS, those APIs are easily used from all other
programming languages that target the common language runtime.
MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It
contains instructions for loading, storing, initializing, and calling methods on objects.
Combined with metadata and the common type system, MSIL allows for true cross-language
integration.
Prior to execution, MSIL is converted to machine code. It is not interpreted.
Managed code is code that is written to target the services of the common language runtime (see
what is the Common Language Runtime?). In order to target these services, the code must provide a
minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET
code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler
can produce managed code by specifying a command-line switch (/CLR).
Closely related to managed code is managed data—data that is allocated and de-allocated by the
common language runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by
default. C# data can, however, be marked as unmanaged through the use of special keywords. Visual
Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using
Managed Extensions for C++, a class can be marked as managed by using the __gc keyword. As the
name suggests, this means that the memory for instances of the class is managed by the garbage
collector. In addition, the class becomes a full participating member of the .NET Framework
community, with the benefits and restrictions that brings. An example of a benefit is proper
interoperability with classes written in other languages (for example, a managed C++ class can inherit
from a Visual Basic class). An example of a restriction is that a managed class can only inherit from
one base class.
Assemblies are self-describing by means of their manifest, which is an integral part of every assembly.
The manifest: Establishes the assembly identity (in the form of a text name), version, culture, and
digital signature (if the assembly is to be shared across applications).
Defines what files (by name and file hash) make up the assembly implementation.
Specifies the types and resources that make up the assembly, including which are exported from the
assembly.
Itemizes the compile-time dependencies on other assemblies.
Specifies the set of permissions required for the assembly to run properly.
This information is used at run time to resolve references, enforce version binding policy, and validate
the integrity of loaded assemblies. The runtime can determine and locate the assembly for any
running object, since every type is loaded in the context of an assembly. Assemblies are also the unit
at which code access security permissions are applied. The identity evidence for each assembly is
considered separately when determining what permissions to grant the code it contains.
The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment
feasible.
A private assembly is used only by a single application, and is stored in that application's install
directory (or a subdirectory therein). A shared assembly is one that can be referenced by more than
one application. In order to share an assembly, the assembly must be explicitly built for this purpose
by giving it a cryptographically strong name (referred to as a strong name). By contrast, a private
assembly name need only be unique within the application that uses it.
By making a distinction between private and shared assemblies, we introduce the notion of sharing as
an explicit decision. Simply by deploying private assemblies to an application directory, you can
guarantee that that application will run only with the bits it was built and deployed with. References to
private assemblies will only be resolved locally to the private application directory.
There are several reasons you may elect to build and use shared assemblies, such as the ability to
express version policy. The fact that shared assemblies have a cryptographically strong name means
that only the author of the assembly has the key to produce a new version of that assembly. Thus, if
you make a policy statement that says you want to accept a new version of an assembly, you can
have some confidence that version updates will be controlled and verified by the author. Otherwise,
you don't have to accept them.
For locally installed applications, a shared assembly is typically explicitly installed into the global
assembly cache (a local cache of assemblies maintained by the .NET Framework). Key to the version
management features of the .NET Framework is that downloaded code does not affect the execution of
locally installed applications. Downloaded code is put in a special download cache and is not globally
available on the machine even if some of the downloaded components are built as shared assemblies.
The classes that ship with the .NET Framework are all built as shared assemblies.
48. If I want to build a shared assembly, does that require the overhead of signing and managing key
pairs?
Building a shared assembly does involve working with cryptographic keys. Only the public key is
strictly needed when the assembly is being built. Compilers targeting the .NET Framework provide
command line options (or use custom attributes) for supplying the public key when building the
assembly. It is common to keep a copy of a common public key in a source database and point build
scripts to this key. Before the assembly is shipped, the assembly must be fully signed with the
corresponding private key. This is done using an SDK tool called SN.exe (Strong Name).
Strong name signing does not involve certificates like Authenticode does. There are no third party
organizations involved, no fees to pay, and no certificate chains. In addition, the overhead for
verifying a strong name is much less than it is for Authenticode. However, strong names do not make
any statements about trusting a particular publisher. Strong names allow you to ensure that the
contents of a given assembly haven't been tampered with, and that the assembly loaded on your
behalf at run time comes from the same publisher as the one you developed against. But it makes no
statement about whether you can trust the identity of that publisher.
49. What is the difference between a namespace and an assembly name?
A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is
preceded with a dot-separated hierarchical name. Such a naming scheme is completely under the
control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B
might be logically expected to have functionality related to file access. The .NET Framework uses a
hierarchical naming scheme for grouping types into logical categories of related functionality, such as
the Microsoft® ASP.NET application framework, or remoting functionality. Design tools can make use
of namespaces to make it easier for developers to browse and reference types in their code. The
concept of a namespace is not related to that of an assembly. A single assembly may contain 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
convenience, whereas an assembly establishes the name scope for types at run time.
The .NET Framework simplifies deployment by making zero-impact install and XCOPY deployment of
applications feasible. Because all requests are resolved first to the private application directory, simply
copying an application's directory files to disk is all that is needed to run the application. No
registration is required.
This scenario is particularly compelling for Web applications, Web Services, and self-contained desktop
applications. However, there are scenarios where XCOPY is not sufficient as a distribution mechanism.
An example is when the application has little private code and relies on the availability of shared
assemblies, or when the application is not locally installed (but rather downloaded on demand). For
these cases, the .NET Framework provides extensive code download services and integration with the
Windows Installer. The code download support provided by the .NET Framework offers several
advantages over current platforms, including incremental download, code access security (no more
Authenticode dialogs), and application isolation (code downloaded on behalf of one application doesn't
affect other applications). The Windows Installer is another powerful deployment mechanism available
to .NET applications. All of the features of Windows Installer, including publishing, advertisement, and
application repair will be available to .NET applications in Windows Installer 2.0.
51. I've written an assembly that I want to use in more than one application. Where do I deploy it?
Assemblies that are to be used by multiple applications (for example, shared assemblies) are deployed
to the global assembly cache. In the prerelease and Beta builds, use the /i option to the GACUtil SDK
tool to install an assembly into the cache:
gacutil /i myDll.dll
Windows Installer 2.0, which ships with Windows XP and Visual Studio .NET will be able to install
assemblies into the global assembly cache.
52. How can I see what assemblies are installed in the global assembly cache?
The .NET Framework ships with a Windows shell extension for viewing the assembly cache. Navigating
to % windir%\assembly with the Windows Explorer activates the viewer.
An application domain (often AppDomain) is a virtual process that serves to isolate an application. All
objects created within the same application scope (in other words, anywhere along the sequence of
object activations beginning with the application entry point) are created within the same application
domain. Multiple application domains can exist in a single operating system process, making them a
lightweight means of application isolation.
An OS process provides isolation by having a distinct memory address space. While this is effective, it
is also expensive, and does not scale to the numbers required for large web servers. The Common
Language Runtime, on the other hand, enforces application isolation by managing the memory use of
code running within the application domain. This ensures that it does not access memory outside the
boundaries of the domain. It is important to note that only type-safe code can be managed in this way
(the runtime cannot guarantee isolation when unsafe code is loaded in an application domain).
Garbage collection is a mechanism that allows the computer to detect when an object can no longer
be accessed. It then automatically releases the memory used by that object (as well as calling a
clean-up routine, called a "finalizer," which is written by the user). Some garbage collectors, like the
one used by .NET, compact memory and therefore decrease your program's working set.
For most programmers, having a garbage collector (and using garbage collected objects) means that
you never have to worry about deallocating memory, or reference counting objects, even if you use
sophisticated data structures. It does require some changes in coding style, however, if you typically
deallocate system resources (file handles, locks, and so forth) in the same block of code that releases
the memory for an object. With a garbage collected object you should provide a method that releases
the system resources deterministically (that is, under your program control) and let the garbage
collector release the memory when it compacts the working set.
All languages that target the runtime allow you to allocate class objects from the garbage-collected
heap. This brings benefits in terms of fast allocation, and avoids the need for programmers to work
out when they should explicitly 'free' each object.
The CLR also provides what are called ValueTypes—these are like classes, except that ValueType
objects are allocated on the runtime stack (rather than the heap), and therefore reclaimed
automatically when your code exits the procedure in which they are defined. This is how "structs" in
C# operate.
Managed Extensions to C++ lets you choose where class objects are allocated. If declared as
managed Classes, with the __gc keyword, then they are allocated from the garbage-collected heap. If
they don't include the __gc keyword, they behave like regular C++ objects, allocated from the C++
heap, and freed explicitly with the "free" method.
57. How do in-process and cross-process communication work in the Common Language Runtime?
There are two aspects to in-process communication: between contexts within a single application
domain, or across application domains. Between contexts in the same application domain, proxies are
used as an interception mechanism. No marshaling/serialization is involved. When crossing application
domains, we do marshaling/serialization using the runtime binary protocol.
Cross-process communication uses a pluggable channel and formatter protocol, each suited to a
specific purpose.
If the developer specifies an endpoint using the tool soapsuds.exe to generate a metadata proxy,
HTTP channel with SOAP formatter is the default.
If a developer is doing explicit remoting in the managed world, it is necessary to be explicit about
what channel and formatter to use. This may be expressed administratively, through configuration
files, or with API calls to load specific channels. Options are:
HTTP channel w/ SOAP formatter (HTTP works well on the Internet, or anytime traffic must travel
through firewalls)
TCP channel w/ binary formatter (TCP is a higher performance option for local-area networks (LANs))
When making transitions between managed and unmanaged code, the COM infrastructure
(specifically, DCOM) is used for remoting. In interim releases of the CLR, this applies also to serviced
components (components that use COM+ services). Upon final release, it should be possible to
configure any remotable component.
Distributed garbage collection of objects is managed by a system called "leased based lifetime." Each
object has a lease time, and when that time expires, the object is disconnected from the remoting
infrastructure of the CLR. Objects have a default renew time-the lease is renewed when a successful
call is made from the client to the object. The client can also explicitly renew the lease.
58. Can I use COM objects from a .NET Framework program?
Yes. Any COM component you have deployed today can be used from managed code, and in common
cases the adaptation is totally automatic.
Specifically, COM components are accessed from the .NET Framework by use of a runtime callable
wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET
Framework-compatible interfaces. For OLE automation interfaces, the RCW can be generated
automatically from a type library. For non-OLE automation interfaces, a developer may write a custom
RCW and manually map the types exposed by the COM interface to .NET Framework-compatible
types.
Yes. Managed types you build today can be made accessible from COM, and in the common case the
configuration is totally automatic. There are certain new features of the managed development
environment that are not accessible from COM. For example, static methods and parameterized
constructors cannot be used from COM. In general, it is a good idea to decide in advance who the
intended user of a given type will be. If the type is to be used from COM, you may be restricted to
using those features that are COM accessible.
Depending on the language used to write the managed type, it may or may not be visible by default.
Specifically, .NET Framework components are accessed from COM by using a COM callable wrapper
(CCW). This is similar to an RCW (see previous question), but works in the opposite direction. Again, if
the .NET Framework development tools cannot automatically generate the wrapper, or if the
automatic behavior is not what you want, a custom CCW can be developed.
60. Can I use the Win32 API from a .NET Framework program?
Yes. Using platform invoke, .NET Framework programs can access native code libraries by means of
static DLL entry points.
Here is an example of C# calling the Win32 MessageBox function:
using System;
using System.Runtime.InteropServices;
class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);
61. What do I have to do to make my code work with the security system?
Usually, not a thing—most applications will run safely and will not be exploitable by malicious attacks.
By simply using the standard class libraries to access resources (like files) or perform protected
operations (such as a reflection on private members of a type), security will be enforced by these
libraries. The one simple thing application developers may want to do is include a permission request
(a form of declarative security) to limit the permissions their code may receive (to only those it
requires). This also ensures that if the code is allowed to run, it will do so with all the permissions it
needs.
Only developers writing new base class libraries that expose new kinds of resources need to work
directly with the security system. Instead of all code being a potential security risk, code access
security constrains this to a very small bit of code that explicitly overrides the security system.
62. Why does my code get a security exception when I run it from a network shared drive?
Default security policy gives only a restricted set of permissions to code that comes from the local
intranet zone. This zone is defined by the Internet Explorer security settings, and should be configured
to match the local network within an enterprise. Since files named by UNC or by a mapped drive (such
as with the NET USE command) are being sent over this local network, they too are in the local
intranet zone.
The default is set for the worst case of an unsecured intranet. If your intranet is more secure you can
modify security policy (with the .NET Framework Configuration tool or the CASPol tool) to grant more
permissions to the local intranet, or to portions of it (such as specific machine share names).
63. How do I make it so that code runs when the security system is stopping it?
Security exceptions occur when code attempts to perform actions for which it has not been granted
permission. Permissions are granted based on what is known about code; especially its location. For
example, code run from the Internet is given fewer permissions than that run from the local machine
because experience has proven that it is generally less reliable. So, to allow code to run that is failing
due to security exceptions, you must increase the permissions granted to it. One simple way to do so
is to move the code to a more trusted location (such as the local file system). But this won't work in
all cases (web applications are a good example, and intranet applications on a corporate network are
another). So, instead of changing the code's location, you can also change security policy to grant
more permissions to that location. This is done using either the .NET Framework Configuration tool or
the code access security policy utility (caspol.exe). If you are the code's developer or publisher, you
may also digitally sign it and then modify security policy to grant more permissions to code bearing
that signature. When taking any of these actions, however, remember that code is given fewer
permissions because it is not from an identifiably trustworthy source—before you move code to your
local machine or change security policy, you should be sure that you trust the code to not perform
malicious or damaging actions.
The .NET Framework includes the .NET Framework Configuration tool, an MMC snap-in
(mscorcfg.msc), to configure several aspects of the CLR including security policy. The snap-in not only
supports administering security policy on the local machine, but also creates enterprise policy
deployment packages compatible with System Management Server and Group Policy. A command line
utility, CASPol.exe, can also be used to script policy changes on the computer. In order to run either
tool, in a command prompt, change the current directory to the installation directory of the .NET
Framework (located in %windir%\Microsoft.Net\Framework\v1.0.2914.16\) and type mscorcfg.msc or
caspol.exe.
65. What’s the implicit name and type of the parameter that gets passed in