How to access Master Page Controls in Content Page?

Add Page Detective

<%@ MasterType VirtualPath="~/MasterPage.master" %>

now content page has reference of the Master Page as Properties.
If one lable in the Master Page with id lblLoginStatus

This can be find like this way

Label lbl= this.Master.FindControl("lblLoginStatus");
if(lbl!=null)
 lbl.Text="Success";

More Details : http://msdn.microsoft.com/en-us/library/xxwa0ff0(VS.80).aspx

LINQ to SQL vs ADO.NET Entity Framework

LINQ to SQL and ADO.NET Entity Framework are extensions of ADO.NET and are introduced to avoid difficulties involved in writing programs using object oriented programming languages to access data residing in RDBMS. Both have provided mechanisms to de-couple pure business logic and underlying data access logic (which is provided within the framework) with the help of LINQ (Language-Integrated Query) and thus allowing to query data using programming language’s own syntax. Thus both allow representing data in the relational database as business objects and also represent relations within the objects (including inheritance).

While speaking about similarities or differences, we understand that ADO.NET Entity Framework’s LINQ to Entities can be considered as superset of LINQ to SQL and that, ADO.NET Entity Framework is much more than LINQ to Entities.

LINQ to SQL can be used for rapid application development while ADO.NET Entity Framework can be used for enterprise application development.

LINQ to SQL can only support MS SQL Server database (also its compact version) however, external vendors are developing data providers for MySQL, Oracle, Postgres, etc. ADO.NET Entity Framework is built on top of ADO.NET data provider model and thus supports all existing ADO.NET data providers.

LINQ to SQL allows developers to generate .NET classes that directly map respective database tables or views. This leads to 1:1 mapping between class and table. This means that it looses the flexibility of an object representing a part of table or one object representing data from multiple tables. On the other hand, ADO.NET Entity Framework allows developers to generate .NET classes that map to conceptual data model. This leads to m:n mapping between classes and tables and thus has the flexibility of an object representing a part of table or one object representing data from multiple tables. Due to this flexibility, DBA can make changes to the database for improving performance, partitioning, etc. without affecting business logic.

Thus LINQ to SQL is targeted for developing rapid applications which can support MS SQL database and have simple mapping of business objects to relational data while ADO.NET Entity Framework is targeted for developing Enterprise applications which can support MS SQL databases as well as other databases through extended ADO.NET data provider and also have complex mapping of business objects to the persistent data.

Source : http://www.dotcominfoway.com/blog/linq-to-sql-vs-ado-net-entity-framework

What is difference between URL and URI?

  • A URL (Uniform Resource Locator) is the address of some resource on the Web. A resource is nothing but a page of a site. It gives absolute path of the current page or image i.e. perfect location of the page or image.
  • While URI is Uniform Resource Identifier looks like a URL but it doesn’t have to necessarily locate any resource on the web. Like this string may have querystring and other things.

What is Satellite Assembly?

Satellite Assemblies are language-specific assemblies and are used for language-specific resources for an application. Each assembly of this kind has a separate language specific ID and is installed in a language-specific subdirectory for each language.

Explain the concepts of Post Cache Substitution in .NET

Post Cache Substitution works opposite to fragment caching.

The entire page is cached, except what is to be kept dynamic. When [OutputCache] attribute is used, the page is cached on both the server and the client. Whereas, you use in case of post cache substitution the page is cached on the server only. HttpResponse.WriteSubstitution method is a way to implement it.

Explain how to access ViewState value of this page in the next page.

PreviousPage property is set to the page property of the nest page to access the viewstate value of the page in the next page.
Page poster = this.PreviousPage;
Once that is done, a control can be found from the previous page and its state can be read.
Label posterLabel = poster.findControl("myLabel");
string lbl = posterLabel.Text;

What is partial classess in .net?

  • When there is a need to keep the business logic separate from the User Interface or when there is some class which is big enough to have multiple number of developers implement the methods in it, the class can be separated and written in different files as partial class.
  • Partial classes allow us to divide the class definition into multiple files (physically). Logically, all the partial classes are treated as a single file by the compiler.

What is Fragment Caching in ASP.NET?

Fragment caching allows to cache specific portions of the page rather than the whole page. It is done by implementing the page in different parts by creating everything in form of user controls and caching each user control individually.

Difference between Server-Side AJAX framework and Client-side AJAX framework?

  • ASP.NET AJAX contains both a server-side Ajax framework and a client-side Ajax framework. The server-side framework provides developers with an easy way to implement Ajax functionality, without having to possess much knowledge of JavaScript. The framework includes server controls and components and the drag and drop functionality. This framework is usually preferred when you need to quickly ajaxify an asp.net application. The disadvantage is that you still need a round trip to the server to perform a client-side action.
  • The Client-Side Framework allows you to build web applications with rich user-interactivity as that of a desktop application. It contains a set of JavaScript libraries, which is independent from ASP.NET. The library is getting rich in functionality with every new build released.

What is the Difference between imperative and interrogative code?

Some methods return values or provide information back to the calling code. These are called interrogative methods.Others, called imperative methods, just perform a service and return nothing to the calling code.
In VB.NET, methods are implemented using Sub (for imperative methods) or Function (for interrogative methods) routines within the class module that defines our object. Sub routines may accept parameters, but they don't return any result value when they are complete. Function routines can also accept parameters, and they always generate a result value that can be used by the calling code.

Difference between Public, Protected, Protected Friend, Private, Friend.

These term determine the visiblity of any classes, properties, or methods you declare.

Public : Declaring a class as Public means you can "see" and instantiate this class in any other classes or subroutines within the same assembly. If you've compiled it into a DLL, referencing assemblies can see it, as well. Declaring a Public Sub / Function or Property means that when its container class is instantiated, the consumer can also see the method or property.

 Private : Private limits the visiblity to a scope. Declaring a private class within a class means that "sub-class" can't be seen from outside of the class. This is also true for methods and properties - they can be seen within the class, but not to any consumers or inheritors.

Protected : This will more likely apply to methods and properties; they won't necessarily be seen outside of the class in which they're declared. However, if a class inherits the container class, that inheritor can see the protected members.

Friend : This applies to classes, methods, and properties. They can be seen within the assembly, but not to any referencing assemblies or even inheritors. (This is the equivalent of "internal" in C#).


 Protected Friend : This is what it seems; classes, methods, and properties declared with this can be seen both within the assembly, as well as by inheritors. They cannot be seen from referencing assemblies. (This is "protected internal" in C#).

What is the difference between "Web.config" and "Machine.Config"?

"Web.config" files apply settings to each web application, while "Machine.config" file apply settings to all ASP.NET applications.

How do we assign page specific attributes?

Page attributes are specified using the @Page directive.

How do we ensure view state is not tampered?

Using the @Page directive and setting 'EnableViewStateMac' property to True.

What is event bubbling?

Server controls like Data grid, Data List, and Repeater can have other child controls inside them. Example Data Grid can have combo box inside data grid. These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a data grid, data list, repeater), which passed to the page as "ItemCommand" event. As the child control send events to parent it is termed as event bubbling.

What is Neutral Cultures?

A neutral culture is a culture that is associated with a language but not with a country/region. A specific culture is a culture that is associated with a language and a country/region. For example, fr is the neutral name for the French culture, and fr-FR is the name of the specific French (France) culture. Note that Chinese (Simplified) and Chinese (Traditional) are also considered neutral cultures.

What is invariant cultures?

The invariant culture is culture-insensitive. Your application specifies the invariant culture by name using an empty string ("") or by its language identifier. InvariantCulture retrieves an instance of the invariant culture. It is associated with the English language but not with any country/region. It is used in almost any method in the Globalization namespace that requires a culture.

What is assembly in .net? and Which are the types of assembly?

Assembly is the partially compiled code which may be in format of dll and exe. Which is in the CLI language.
An assembly can consist of one or more files. Code files are called modules. An assembly can contain more than one code module and since it is possible to use different languages to create code modules it is technically possible to use several different languages to create an assembly.

Types of the Assembly are
Private Assembly :
Private assebllies are stored in the appliation's bin folder. so other application can not access that.

Shared Assembly :
Shared application assembly stored in the global path (default framework path) which also called Global Assembly Catche(GAC). This asseblies are globally unique names and version. Benfits of this assembly is resusablity and versoning.

Static and Dynami Asseblies
Assemblies can be static or dynamic. Static assemblies are stored in the disk as physical files but dynamic assemblies are not saved to disk before execution and are executed directly from memory.

Satellite Assembly
Satellite assembly can not store any code but this stores the resoures like culture, images, language specific string via resource file. So this is also called as localised assebly.

How to deploy asp.net website on remote server?

Basically there is 3 main types of web deployement on server
  1. XCOPY : By this method all the local website copy and past to the remote server (with aspx and asp.cs/vb ) pages
  2. Publish Website Wizard :
    This is the one of the option in the Visual Studio (Right click on website). By this you can compile all the website and generate assembly for each page in the bin folder. you can now upload this published(compiled website)
  3. Web Deployement Kit :
    This is the small external tools from the Microsoft. After install you can found this in the Website right click menu in the Solution Explorer as WebDeployment Project. It works same as the Publish website but main difference is that this tool combines all assembly (aspx.cs/vb) in to one. so when ever you have changes you need to upload single assembly and seperate aspx page.

What is Enum? (C#)

The enum keyword is used to declare an enumeration, a distinct type consisting of a set of named constants called the enumerator list. Every enumeration type has an underlying type, which can be any integral type except char.

Enums type can be integer (float, int, byte, double etc.). But if you used beside int it has to be cast.

enum is used to create numeric constants in .NET framework. All member of enum are of enum type. There must be a numeric value for each enum type.

The default underlying type of the enumeration elements is int. By default, the first enumerator has the value 0, and the value of each successive enumerator is increased by 1.

enum Dow {Sat, Sun, Mon, Tue, Wed, Thu, Fri};


  • enums are enumerated data type in c#.
  • enums are not for end-user, they are meant for developers.
  • enums are strongly typed constant. They are strongly typed, i.e. an enum of one type may not be implicitly assigned to an enum of another type even though the underlying value of their members are the same.
  • Enumerations (enums) make your code much more readable and understandable.
  • enum values are fixed. enum can be displayed as a string and processed as an integer.
  • The default type is int, and the approved types are byte, sbyte, short, ushort, uint, long, and ulong.
  • Every enum type automatically derives from System.Enum and thus we can use System.Enum methods on enums.
  • Enums are value types and are created on the stack and not on the heap.
Source : 

What is global.asax? Defiene global.asax events.

The Global.asax file, also known as the ASP.NET application file which contains code for responding to application-level and session-level events raised by ASP.NET or by HTTP modules. The Global.asax file resides in the root directory of an ASP.NET application.

Events

  • Application_Init: Fired when an application initializes or is first called. It's invoked for all HttpApplication object instances.
  • Application_Disposed: Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources.
  • Application_Error: Fired when an unhandled exception is encountered within the application.
  • Application_Start: Fired when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible by all HttpApplication instances.
  • Application_End: Fired when the last instance of an HttpApplication class is destroyed. It's fired only once during an application's lifetime.
  • Application_BeginRequest: Fired when an application request is received. It's the first event fired for a request, which is often a page request (URL) that a user enters.
  • Application_EndRequest: The last event fired for an application request.
  • Application_PreRequestHandlerExecute: Fired before the ASP.NET page framework begins executing an event handler like a page or Web service.
  • Application_PostRequestHandlerExecute: Fired when the ASP.NET page framework is finished executing an event handler.
  • Applcation_PreSendRequestHeaders: Fired before the ASP.NET page framework sends HTTP headers to a requesting client (browser).
  • Application_PreSendContent: Fired before the ASP.NET page framework sends content to a requesting client (browser).
  • Application_AcquireRequestState: Fired when the ASP.NET page framework gets the current state (Session state) related to the current request.
  • Application_ReleaseRequestState: Fired when the ASP.NET page framework completes execution of all event handlers. This results in all state modules to save their current state data.
  • Application_ResolveRequestCache: Fired when the ASP.NET page framework completes an authorization request. It allows caching modules to serve the request from the cache, thus bypassing handler execution.
  • Application_UpdateRequestCache: Fired when the ASP.NET page framework completes handler execution to allow caching modules to store responses to be used to handle subsequent requests.
  • Application_AuthenticateRequest: Fired when the security module has established the current user's identity as valid. At this point, the user's credentials have been validated.
  • Application_AuthorizeRequest: Fired when the security module has verified that a user can access resources.
  • Session_Start: Fired when a new user visits the application Web site.
  • Session_End: Fired when a user's session times out, ends, or they leave the application Web site.

Difference between Store Procedure and Function(UDF)

  • Function must return value but SP not.
  • Function can be used in the sql statements anywhere in the WHERE/HAVING/SELECT section where as SP cannot be.
  • Function has not output parameter but SP has
  • If there is an error in Function its stops executing. But in SP’s it just ignores the error and moves to the next statement
  • UDF cannot make permanent changes to server environments while SP’s can change some of the server environment.
  • EXEC command can't be used inside a Function where it can be used inside an sproc.
  • Functions are normally used for computations where as procedures are normally used for executing business logic.
  • Stored procedure returns always integer value by default zero. Whereas function returns type could be scalar or table or table values

Common Mistakes during Interview to Avoid

For many job seekers, the interview is the single most stressful part of the job search process. Any number of things can go wrong, and a big part of being successful is avoiding simple mistakes. Here is list of most common mistakes job seekers make and how to avoid them.

  1. Failure to research the company Recruiters say that they expect candidates to spend at least one hour doing research on their web sites and reading about their companies via other web sites. Do your homework before the interview; know what the company does, and who their competitors are.
  2. Being unclear on which job you are interviewing for Become familiar with the job description so you can explain how your experiences, talents, strengths, and abilities will connect with company needs. Highlight how you're suited to that particular job.
  3. Not Marketing yourself Define yourself. What makes you different from other job candidates? Know your major strengths and accomplishments as they relate to the job you are applying for and the company.
  4. Asking silly questions Have at least three or four intelligent questions to ask the recruiter. It's OK (it actually leaves a positive impression with the recruiter) to have them written down in advance and to reference them at the appropriate time. Interviews are an exchange of information, and arriving without questions shows that you did not prepare for the whole interview.
  5. Dressing inappropriately for the interview Professional attire and attention to detail still count. You can never be too professional. Remember that everything-your appearance, your tone of voice, your conduct-contribute to the impression (positive or negative) that you make. Be presentable. Wear a pressed suit and shirt and polished shoes.
  6. Trying to wing the interview Practice! Get a list of general interview questions, a friend, a tape recorder, and a mirror and conduct an interview rehearsal. Practice until your delivery feels comfortable, not canned. 
  7. Not being yourself Be yourself and be honest! Don't pretend to understand a question or train of thought if you don't. If you don't know an answer, say so. Relax and be yourself. Remember you're interviewing the company, too.
  8. Listening poorly Focus on the question that is being asked and don't try to anticipate the next one. It's OK to pause and collect your thoughts before answering a question.
  9. Offering too little detail When answering case questions or technical questions or solving technical problems, take the time to "talk through" your thought processes. Recruiters are interested in seeing how your mind works and how it attacks a problem. 
  10. Lacking enthusiasm Maintain eye contact, greet the interviewer with a smile and a firm handshake (not too weak, not too strong), and show common courtesy. Don't be afraid to display your passion for the job/industry and to show confidence. 
  11. Do not arrive late for the interview. 
  12. Do not indicate you are late because the directions you were given were not good. 
  13. Do not slouch in your seat. 
  14. Do not maintain eye contact with the wall instead of the interviewer.
  15. Do not answer most questions with simple "yes" and "no" answers.
  16. Do not badmouth your current or former employer. 
  17. Do not ask "How am I doing? Are you going to hire me?" 
  18. When asked "Do you have any questions?", do not reply "No."

Personal Questions in Interview - 16

Describe your work ethic.
Emphasize benefits to the organization. Things like, determination to get the job done and work hard but enjoy your work are good.

Tell me about the most fun you have had on the job.
Talk about having fun by accomplishing something for the organization.

Do you have any questions for me?
Always have some questions prepared. Questions prepared where you will be an asset to the organization are good. How soon will I be able to be productive? and What type of projects will I be able to assist on? are examples.

Personal Questions in Interview - 15

What qualities do you look for in a boss?
Be generic and positive. Safe qualities are knowledgeable, a sense of humor, fair, loyal to subordinates and holder of high standards. All bosses think they have these traits.

Tell me about a time when you helped resolve a dispute between others.
Pick a specific incident. Concentrate on your problem solving technique and not the dispute you settled.

What position do you prefer on a team working on a project?
Be honest. If you are comfortable in different roles, point that out.

Personal Questions in Interview - 14

If you were hiring a person for this job, what would you look for?
Be careful to mention traits that are needed and that you have.

Do you think you are overqualified for this position?
Regardless of your qualifications, state that you are very well qualified for the position.

How do you propose to compensate for your lack of experience?
First, if you have experience that the interviewer does not know about, bring that up: Then, point out (if true) that you are a hard working quick learner.

Personal Questions in Interview - 13

Describe your management style.
Try to avoid labels. Some of the more common labels, like progressive, salesman or consensus, can have several meanings or descriptions depending on which management expert you listen to. The situational style is safe, because it says you will manage according to the situation, instead of one size fits all.

What have you learned from mistakes on the job?
Here you have to come up with something or you strain credibility. Make it small, well intentioned mistake with a positive lesson learned. An example would be working too far ahead of colleagues on a project and thus throwing coordination off.

Do you have any blind spots?
Trick question. If you know about blind spots, they are no longer blind spots. Do not reveal any personal areas of concern here. Let them do their own discovery on your bad points. Do not hand it to them.

Personal Questions in Interview - 12

How would you know you were successful on this job?
Several ways are good measures: You set high standards for yourself and meet them. Your outcomes are a success.Your boss tell you that you are successful

Would you be willing to relocate if required?
You should be clear on this with your family prior to the interview if you think there is a chance it may come up. Do not say yes just to get the job if the real answer is no. This can create a lot of problems later on in your career. Be honest at this point and save yourself uture grief.

Are you willing to put the interests of the organization ahead of your own?
This is a straight loyalty and dedication question. Do not worry about the deep ethical and philosophical implications. Just say yes.

Personal Questions in Interview - 11

Do your skills match this job or another job more closely?
Probably this one. Do not give fuel to the suspicion that you may want another job more than this one.

What motivates you to do your best on the job?
This is a personal trait that only you can say, but good examples are: Challenge, Achievement, Recognition

Are you willing to work overtime? Nights? Weekends?
This is up to you. Be totally honest.

Personal Questions in Interview - 10

Tell me about a problem you had with a supervisor.
Biggest trap of all. This is a test to see if you will speak ill of your boss. If you fall for it and tell about a problem with a former boss, you may well below the interview right there. Stay positive and develop a poor memory about any trouble with a supervisor.

What has disappointed you about a job?
Don't get trivial or negative. Safe areas are few but can include:Not enough of a challenge. You were laid off in a reduction Company did not win a contract, which would have given you more responsibility.

Tell me about your ability to work under pressure.
You may say that you thrive under certain types of pressure. Give an example that relates to the type of position applied for.

Personal Questions in Interview - 9

What kind of person would you refuse to work with?
Do not be trivial. It would take disloyalty to the organization, violence or lawbreaking to get you to object. Minor objections will label you as a whiner.

What is more important to you: the money or the work?
Money is always important, but the work is the most important. There is no better answer.

What would your previous supervisor say your strongest point is?
There are numerous good possibilities:Loyalty, Energy, Positive attitude, Leadership, Team player, Expertise, Initiative, Patience, Hard work, Creativity, Problem solver

How to take SQL Server Database Offline and Online?

-- OFFLINE
 ALTER DATABASE [TEST_DB] SET OFFLINE WITH
 ROLLBACK IMMEDIATE
 GO
-- ONLINE 
 ALTER DATABASE [TEST_DB] SET ONLINE
 GO

Personal Questions in Interview - 8

What is your greatest strength?
Numerous answers are good, just stay positive. A few good examples: Your ability to prioritize, Your problem-solving skills, Your ability to work under pressure, Your ability to focus on projects, Your professional expertise, Your leadership skills, Your positive attitude.

Tell me about your dream job. / What are you looking for in a job?
Stay away from a specific job. You cannot win. If you say the job you are contending for is it, you strain credibility. If you say another job is it, you plant the suspicion that you will be dissatisfied with this position if hired. The best is to stay genetic and say something like: A job where I love the work, like the people, can contribute and can't wait to get to work.

Why do you think you would do well at this job?
Give several reasons and include skills, experience and interest.

Personal Questions in Interview - 7

Why should we hire you?
Point out how your assets meet what the organization needs. Do not mention any other candidates to make a comparison.

Tell me about a suggestion you have made.
Have a good one ready. Be sure and use a suggestion that was accepted and was then considered successful. One related to the type of work applied for is a real plus.

What irritates you about co-workers?
This is a trap question. Think real hard but fail to come up with anything that irritates you. A short statement that you seem to get along with folks is great.

Personal Questions in Interview - 6

If you had enough money to retire right now, would you?
Answer yes if you would. But since you need to work, this is the type of work you prefer. Do not say yes if you do not mean it.

Have you ever been asked to leave a position?
If you have not, say no. If you have, be honest, brief and avoid saying negative things about the people or organization involved.

Explain how you would be an asset to this organization.
You should be anxious for this question. It gives you a chance to highlight your best points as they relate to the position being discussed. Give a little advance thought to this relationship.

Personal Questions in Interview - 5

How long would you expect to work for us if hired?
Specifics here are not good. Something like this should work: I'd like it to be a long time. Or As long as we both feel I'm doing a good job.

Have you ever had to fire anyone? How did you feel about that?
This is serious. Do not make light of it or in any way seem like you like to fire people. At the same time, you will do it when it is the right thing to do. When it comes to the organization versus the individual who has created a harmful situation, you will protect the organization. Remember firing is not the same as layoff or reduction in force.

What is your philosophy towards work?
The interviewer is not looking for a long or flowery dissertation here. Do you have strong feelings that the job gets done? Yes. That's the type of answer that works best here. Short and positive, showing a benefit to the organization.

Personal Questions in Interview - 4

Do you know anyone who works for us?
Be aware of the policy on relatives working for the organization. This can affect your answer even though they asked about friends not relatives. Be careful to mention a friend only if they are well thought of.

What kind of salary do you need?
A loaded question. A nasty little game that you will probably lose if you answer first. So, do not answer it. Instead, say something like, That's a tough question. Can you tell me the range for this position? In most cases, the interviewer, taken off guard, will tell you. If not, say that it can depend on the details of the job. Then give a wide range.

Are you a team player?
You are, of course, a team player. Be sure to have examples ready. Specifics that show you often perform for the good of the team rather than for yourself are good evidence of your team attitude. Do not brag, just say it in a matter-of-fact tone. This is a key point.

Personal Questions in Interview - 3

What have you done to improve your knowledge in the last year?
Try to include improvement activities that relate to the job. A wide variety of activities can be mentioned as positive self-improvement. Have some good ones handy to mention.

Are you applying for other jobs?
Be honest but do not spend a lot of time in this area. Keep the focus on this job and what you can do for this organization. Anything else is a distraction.

Why do you want to work for this organization?
This may take some thought and certainly, should be based on the research you have done on the organization. Sincerity is extremely important here and will easily be sensed. Relate it to your long-term career goals.

Personal Questions in Interview - 2

Do you consider yourself successful?
You should always answer yes and briefly explain why. A good explanation is that you have set goals, and you have met some and are on track to achieve the others.

What do co-workers say about you?
Be prepared with a quote or two from co-workers. Either a specific statement or a paraphrase will work. Jill Clark, a co-worker at Smith Company, always said I was the hardest workers she had ever known. It is as powerful as Jill having said it at the interview herself.

What do you know about this organization?
This question is one reason to do some research on the organization before the interview. Find out where they have been and where they are going. What are the current issues and who are the major players?

Difference between Authentication and Authorization

Authentication

  • Authentication is the process of validating a user on the credentials (username and password) 
  • Authentication is a proof/identity of you that you are you in your house.

Authorization

  • Authorization performs after authentication. After Authentication a user will be verified for performing the various tasks, It access is limited it is known as authorization. 
  • Authorization is a permission/right that you can involve/handle any perticular matter of the house.

What is CLR (Common Language Runtime)?

CLR is the main part of the Microsoft.NET Framewrok, which is used for the execution for the any .net application. 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.
The runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. Objects whose lifetimes are managed in this way are called managed data. Garbage collection eliminates memory leaks as well as some other common programming errors. If your code is managed, you can use managed data, unmanaged data, or both managed and unmanaged data in your .NET Framework application. Because language compilers supply their own types, such as primitive types, you might not always know (or need to know) whether your data is being managed.

CLR has a set of Services calles

1) Garbage Collection.
2) Thread Management.
3) Code Verification.
4) Code Access Security.
5) Exception Handling.
6) Security.

Personal Questions in Interview - 1

Tell me about yourself
The most often asked question in interviews. You need to have a short statement prepared in your mind. Be careful that it does not sound rehearsed. Limit it to work-related items unless instructed otherwise. Talk about things you have done and jobs you have held that relate to the position you are interviewing for. Start with the item farthest back and work up to the present.

Why did you leave your last job?
Stay positive regardless of the circumstances. Never refer to a major problem with management and never speak ill of supervisors, co- workers or the organization. If you do, you will be the one looking bad. Keep smiling and talk about leaving for a positive reason such as an opportunity, a chance to do something special or other forward- looking reasons.

What experience do you have in this field?
Speak about specifics that relate to the position you are applying for. If you do not have specific experience, get as close as you can.

Asp.NET Page Life Cycle

Page request
The page request occurs before the page life cycle begins. When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled (therefore beginning the life of a page), or whether a cached version of the page can be sent in response without running the page.

Start
In the start step, page properties such as Request and Response are set. At this stage, the page also determines whether the request is a postback or a new request and sets the IsPostBack property. Additionally, during the start step, the page's UICulture property is set.

Page initialization
During page initialization, controls on the page are available and each control's UniqueID property is set. Any themes are also applied to the page. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.

Load
During load, if the current request is a postback, control properties are loaded with information recovered from view state and control state.

Validation
During validation, the Validate method of all validator controls is called, which sets the IsValid property of individual validator controls and of the page.

Postback event handling
If the request is a postback, any event handlers are called.

Rendering
Before rendering, view state is saved for the page and all controls. During the rendering phase, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream of the page's Response property.

Unload
Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed.

What is GAC?

A computer installed with the common language runtime has a machine-wide code cache known as Global Assembly Cache. In the .NET Framework the Global Assembly Cache acts as the central place for registering the assemblies. All the shared Asp.Net assemblies have a unique name and they are placed in GAC.

The Global Assembly Cache or GAC is a machine-wide .NET assemblies cache for Microsoft's CLR platform. The approach of having a specially controlled central repository addresses the shared library concept and helps to avoid pitfalls of other solutions that lead to drawbacks like DLL hell.

GAC Assembly is differenciate with the Strong Name

What is authentication and which are the types of Authentication in Asp.NET?

Authentication is the process of validating client identity, usually by means of a designated third-party authority. The client might be an end user, computer, application, or service. The client's identity is called a security principal. To authenticate with a server application, the client provides some form of credentials to allow the server to verify the client's identity. After the client's identity is confirmed, the application can authorize the principal to perform operations and access resources.




Windows Authentication

The WindowsAuthenticationModule provider relies on IIS to provide authenticated users, using any of the mechanisms IIS supports. The provider module constructs a WindowsIdentity object. The default implementation constructs a WindowsPrincipal object and attaches it to the application context. The WindowsPrincipal object maps identities to Windows groups.


Forms
Forms authentication uses an authentication ticket that is created when a user logs on to a site, and then it tracks the user throughout the site. The forms authentication ticket is usually contained inside a cookie. However, ASP.NET version 2.0 supports cookieless forms authentication, which results in the ticket being passed in a query string.

Passport
Passport authentication is a centralized authentication service provided by Microsoft that offers a single logon and core profile services for member sites.

Source :
Windows : http://authors.aspalliance.com/aspxtreme/webapps/thewindowsauthenticationprovider.aspx
Forms : http://authors.aspalliance.com/aspxtreme/webapps/thecookieauthenticationprovider.aspx
Passport :http://authors.aspalliance.com/aspxtreme/webapps/thepassportauthenticationprovider.aspx

What is Managed Code?

Managed code is written with the Microsoft.NET Framework supported languages. For Ex. VB.NET, C#, C++ or F#. All of these languages share a unified set of class libraries and can be encoded into an Intermediate Language (IL). A runtime-aware compiler compiles the IL into native executable code within a managed execution environment that ensures type safety, array bound and index checking, exception handling, and garbage collection.

By using managed code and compiling in this managed execution environment, you can avoid many typical programming mistakes that lead to security holes and unstable applications. Also, many unproductive programming tasks are automatically taken care of, such as type safety checking, memory management, and destruction of unneeded objects.

Difference between VB.NET and C# (C Sharp)

It is not easy to post long content here. but you can download nice document provided by Microsoft.

http://download.microsoft.com/download/6/3/5/6354bf47-c597-4029-89e9-2495e7539ab9/vbcsharpwp.exe

Another Url are

http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET
http://www.codeproject.com/kb/dotnet/vbnet_c__difference.aspx

Advantages and Disadvantages of Cookie

Advantages 

  • Cookies stores in client side
  • Easy to use with Javascript and Asp.NET . 
  • You can configure cookies to expire when the browser session ends (session cookies) or they can exist for a specified length of time on the client computer (persistent cookies). 
  • Stores server information on client side
  • Data need not to be sent back to server. 

Disadvantages 

  • Users can delete a cookies. 
  • Users browser can refuse cookies,so your code has to anticipate that possibility. 
  • Cookies exist as plain text on the client machine and they may pose a possible security risk as anyone can open and tamper with cookies.vv
  • Number of cookies that can be stored and their size is limited. 
  • They don't work if security level is set too high in browser. 
  • Some people might just disable cookies on their browsers at there web can not run.

What is Reference Type?

Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. The type of a reference type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates.



What is CTS (Common Type System)?

The common type system defines how types are declared, used, and managed in the runtime, and is also an important part of the runtime's support for cross-language integration. The common type system performs the following functions:

  • Establishes a framework that helps enable cross-language integration, type safety, and high performance code execution.
  • Provides an object-oriented model that supports the complete implementation of many programming languages.
  • Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.

What is Value Type?

Value types directly contain their data, and instances of value types are either allocated on the stack or allocated inline in a structure. Value types can be built-in (implemented by the runtime), user-defined, or enumerations.

Which types of the object can stored in the Session State?

It's depends on the session mode.

  • InProc mode : objects stored in session state are actually live objects, and so you can store whatever object you have created. 
  • State Server or SQL Server mode : objects in the session state will be serialized and deserialized when a request is processed.  So make sure your objects are serializable and their classes must be marked as so.  If not, the session state will not be saved successfully.

Difference between Equals and ==

Equals : Determines whether the specified Object is equal to the current Object and also check the reference of object. Handles NULL

== : Can not handle null, checks object with their type and value.

Explain Session and Session State in Asp.NET

Web is Stateless, which means a new instance of the web page class is re-created each time the page is posted to the server. As we all know HTTP is a stateless protocol, it can't hold the client information on page. If user inserts some information, and move to the next page, that data will be lost and user would not able to retrieve the information. So what we need? we need to store information. Session provides that facility to store information on server memory. It can support any type of object to store along with our custom object.

Advantages :

  • It helps to maintain user states and data to all over the application.
  • It can easily be implemented and we can store any kind of object. 
  • Stores every client data separately. 
  • Session is secure and transparent from user.


Disadvantages :

  • Performance overhead in case of large volume of user, because of session data stored in server memory.
  • Overhead involved in serializing and De-Serializing session Data. because In case of StateServer and SQLServer session mode we need to serialize the object before store. 


Asp.Net use 120 bit identifier to track each session. This is secure enough and can't be reverse engineered. When client communicate with server, only  session id is transmitted, between them. When client request for data, ASP.NET looks on to session ID and retrieves corresponding data. This is done in following steps,

Client hits web site and some information is stored in session.
Server creates a unique session ID for that clients and stored in Session State Provider .
Again client request For some information with that unique session ID from Server.
Server,looks on Session Providers, and retrieve the serialized data from state server  and type cast the object .
Just have a look on the pictorial flow,



Session Mode  and State Provider 

  • InProc: In-Proc mode stores values in the memory of the ASP.NET worker process. Thus, this mode offers the fastest access to these values. However, when the ASP.NET worker process recycles, the state data is lost.
  • StateServer: Alternately, StateServer mode uses a stand-alone Microsoft Windows service to store session variables. Because this service is independent of Microsoft Internet Information Server (IIS), it can run on a separate server. You can use this mode for a load-balancing solution because multiple Web servers can share session variables. Although session variables are not lost if you restart IIS, performance is impacted when you cross process boundaries.
  • SqlServer: If you are greatly concerned about the persistence of session information, you can use SqlServer mode to leverage Microsoft SQL Server to ensure the highest level of reliability. SqlServer mode is similar to out-of-process mode, except that the session data is maintained in a SQL Server. SqlServer mode also enables you to utilize a state store that is located out of the IIS process and that can be located on the local computer or a remote server.


A Great Article, Must Visit
Source : http://www.codeproject.com/KB/aspnet/ExploringSession.aspx

What is ViewState?

ASP.NET Web page to persist changes to the state of a Web Form across postbacks
The view state of a page is, by default, placed in a hidden form field named __VIEWSTATE.
This hidden form field can easily get very large, on the order of tens of kilobytes.


Advantages:
  • No server resources.
  • Viewstate ensures security because it stores the data in encrypted format.
  • Viewstates are simple. They are used by enabling or disabling the viewstate properties.
  • It is based on the wish of developer that they want to implement it at the page level or at control level.
Disadvantages:
  • If large amount of data is stored on the page, then page load might cause a problem. 
  • Does not track across pages. Viewstate information does not automatically transfer from page to page.

What is Linq?

Language Integrated Query is a set of extension to the Microsoft .NET Framework component that adds native data querying capabilities to .NET languages. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities. Using LINQ, you can virtually query through any enumerable types of objet such as arrays, control collections and data source.
Currently Supported objects are

  • LINQ to Objects
  • LINQ to XML
  • LINQ to SQL
  • LINQ to DataSets 

Difference between Microsoft.NET 2.0, 3.0 and 3.5


Difference between Microsoft.NET 2.0 - 3.0 and 3.5 -

What is Partial Class?

Partial Keyword indicates that class, structure or interface devided in more than 1 part with in same namespace
At compilet time all parts are mearged in to single.
When some large class or many people working on the same project and in multiple files
this is used
For example in one project 2 people working in same task, so both needs that class to change, so that single file is not possible. There is a chance to overwrite on without Visual Source Safe and in with another can not work on that file. so class is devided in to two parts with partial in two files.
//User1.cs
  public partial class Sample
  {
  Int a;
  }
//User2.cs
  public partial class Sample
  {
  public void changeA(int val) { a = val; }
  }

Difference between Dataset method Clone() and Copy()

  • Clone :Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data.
  • Copy :Copies both the structure and data for this DataSet.

Difference between Server.Transfer and Response.Write

  • Server.Transfer redirects page form the server side and but page in the current site
  • Server.Transfer can not support query string
  • Response.Write supports query string and redirect to any page which may be from current site or other site.
  • Response.Write also supports wite files and streams on the response

Difference between Gridview and DataGrid

  • Datagrid is older control and GridVeiw is new and improved
  • DataGrid is required additional coding for sorting,paging and edit. Gridview has this functionality inbuit.
  • Datagrid has BoundColumn, ButtonColumn, EditCommandColumn, HyperLinkColumn and TemplateColumn.  And Gridview has BoundField, ButtonField, CheckBoxField, CommandField, HyperLinkField, ImageField, and TemplateField basic column types.
  • The DataGrid control raises single events for operations, while the GridView control is capable of both pre-operation and post-operation events.

Difference between ADO.NET and ADO Reocordset

  • A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
  • A DataSet is designed to work without any continuing connection to the original data source.
  • Data in a DataSet is bulk-loaded, rather than being loaded on demand.
  • There's no concept of cursor types in a DataSet.
  • DataSets have no current record pointer You can use For Each loops to move through the data.
  • You can store many edits in a DataSet, and write them to the original data source in a single operation.
  • Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.