ASP.NET interview questions 1. What does the Orientation property do in a Menu control? Orientation property of the Menu control sets the display of menu on a Web page to vertical or horizontal. Originally the orientation is set to vertical. . !i""erentiate #etween$ a.%&lient'side and server'side validations in We# pa(es. - Client-side validations happends at the client's side with the help of Java cript and !" cript. #his happens before the Web page is sent to the server. - erver-side validations occurs place at the server side. #.%Authentication and authori)ation. - $uthentication is the process of verifyng the identity of a user using some credentials li%e username and password while authorization determines the parts of the system to which a
particular identity has access. - $uthentication is re&uired before authorization. 'or e.g. (f an employee authenticates himself with his credentials on a system) authorization will determine if he has the control over *ust publishing the content or also editing it. *.a.% What does the .We#Part "ile do? (t e+plains the settings of a Web ,arts control that can be included to a specified zone on a Web page. #.% +ow would you ena#le i,personation in the we#.con"i( "ile? (n order to enable the impersonation in the web.confing file) ta%e the following steps- (nclude the .identity/ element in the web.config file. - et the impersonate attribute to true as shown below.identity impersonate 0 1true1 2/ -. a.% !i""erentiate #etween a.%.ile'#ased dependency and /ey'#ased dependency. - (n file-based dependency) the dependency is on a file saved in a dis% while in %ey-based dependency) you depend on another cached item. #.% 0lo#ali)ation and locali)ation. - 3lobalization is a techni&ue to identify the part of a Web application that is different for different languages and separate it out from the web application while in localization you try to configure a Web application so that it can be supported for a specific language or locale. 1. a.%!i""erentiate #etween a pa(e the,e and a (lo#al the,e? - ,age theme applies to a particular web pages of the pro*ect. (t is stored inside a subfolder of the $pp4#hemes folder. - 3lobal theme applies to all the web applications on the web server. (t is stored inside the #hemes folder on a Web server. #.%What are We# server controls in ASP.NET? - #hese are the ob*ects on $ ,.56# pages that run when the Web page is re&uested. - ome of these Web server controls) li%e button and te+t bo+) are similar to the 7#M8 controls. - ome controls e+hibit comple+ behavior li%e the controls used to connect to data sources and display data. 2. a.% !i""erentiate #etween a +yper3in/ control and a 3in/4utton control.
- $ 7yper8in% control does not have the Clic% and Command events while the 8in%"utton control has them) which can be handled in the code-behind file of the Web page. #.% +ow do &oo/ies wor/? 0ive an e5a,ple o" their a#use. - #he server directs the browser to put some files in a coo%ie. $ll the coo%ies are then sent for the domain in each re&uest. - $n e+ample of coo%ie abuse could be a case where a large coo%ie is stored affecting the networ% traffic. 6. a.% What are &usto, 7ser &ontrols in ASP.NET? - #hese are the controls defined by developers and wor% similart to other web server controls. - #hey are a mi+ture of custom behavior and predefined behavior. #.% What is 8ole'#ased security? - 9sed in almost all organization) the :ole-based security assign certain privileges to each role. - 6ach user is assigned a particular role from the list. - ,rivileges as per role restrict the user's actions on the system and ensure that a user is able to do only what he is permitted to do on the system. 9. What are the +TM3 server controls in ASP.NET? - 7#M8 server controls are similar to the standard 7#M8 elements li%e those used in 7#M8 pages. - #hey e+pose properties and events for programatical use. - #o ma%e these controls programmatically accessible) we specify that the 7#M8 controls act as a server control by adding the runat01server1 attribute. :. a.% What are the various types o" &oo/ies in ASP.NET? #here e+ist two types of coo%ies in $ ,.56# - ession Coo%ie - (t resides on the machine of the client for a single session and wor%s until the user logs out of the session. - ,ersistent Coo%ie - (t resides on the machine of a user for a specified period. #his period can be set up manually by the user. #.% +ow would you turn o"" coo/ies on one pa(e o" your we#site? - #his can be done by using the Coo%ie.;iscard property. - (t 3ets or sets the discard flag set by the server. - When set to true) this property instructs the client application not to save the Coo%ie on the hard dis% of the user at the end of the session.
c.% +ow would you create a per,anent coo/ie? - ,ermanent coo%ies are stored on the hard dis% and are available until a specified e+piration date is reached. - #o create a coo%ie that never e+pires set its 6+pires property e&ual to ;ate#ime.ma+!alue. 1;. a.% E5plain &ulture and 7<&ulture values. - Culture value determines the functions li%e ;ate and Currency used to format data and numbers in a Web page. - 9(Culture value determines the resources li%e strings or images loaded in a Web application for a Web page. #.% What is 0lo#al.asa5 "ile used "or? (t e+ecutes application-level events and sets application-level variables. 11. a.% E5plain ASP.NET We# .or,s. - Web 'orms are an e+tremely important part of $ ,.56#. - #hey are the 9ser (nterface <9(= elements which provide the desired loo% and feel to your web applications. - Web 'orms provide properties) methods) and events for the controls that are placed onto them. #.% What is event #u##lin(? - When child control send events to parent it is termed as event bubbling. - erver controls li%e ;ata grid) ;ata 8ist) and :epeater can have other child controls inside them. 1 . What are the various types o" validation controls provided #y ASP.NET? $ ,.56# provides > types of validation controls as listed belowi.= :e&uired'ield!alidator - (t is used when you do not want the container to be empty. (t chec%s if the control has any value or not. ii.= :ange!alidator - (t chec%s if the value in validated control is within the specified range or not. iii.= Compare!alidator - Chec%s if the value in controls matches some specific values or not. iv.= :egular6+pression!alidator - Chec%s if the value matches a specific regular e+pression or not. v.= Custom!alidator - 9sed to define 9ser ;efined validation.
vi.= !alidation ummary -;isplays summary of all current validation errors on an $ ,.56# page. 1*. !i""erentiate #etween$ a.% Na,espace and Asse,#ly. - 5amespace is a naming convenience for logical design-time while an assembly establishes the name scope for types at run time. #.% Early #indin( and late #indin(. 6arly binding means calling a non-virtual method that is decided at a compile time while 8ate binding refers to calling a virtual method that is decided at a runtime. 1-. What are the di""erent /inds o" asse,#lies? #here can be two types of assemblies. i.= tatic assemblies - #hey are stored on dis% in portable e+ecutable files. - (t includes .56# 'ramewor% types li%e interfaces and classes) resources for the assembly <bitmaps) J,63 files) resource files etc.=. ii.= ;ynamic assemblies - #hey are not saved on dis% before e+ecution rather they run directly from memory. - #hey can be saved to dis% after they have been e+ecuted. 11. !i""erentiate #etween Structure and &lass. - tructures are value type while Classes are reference type. - tructures can not have constructor or destructors while Classes can have them. - tructures do not support (nheritance while Classes do support (nheritance. 12. E5plain =iewState. - (t is a .5et mechanism to store the posted data among post bac%s. - (t allows the state of ob*ects to be stored in a hidden field on the page) saved on client side and transported bac% to server whenever re&uired. 16. What are the various types o" Authentication?
#here are ? types of $uthentication namely Windows) 'orms and ,assport $uthentication. - Windows authentication - (t uses the security features integrated in Windows 5# and Windows @, O to authenticate and authorize Web application users. - 'orms authentication - (t allows you to create your own list of users and validate their identity when they visit the Web site. - ,assport authentication - (t uses the Microsoft centralized authentication provider to identify users. ,assport allows users to use a single identity across multiple Web applications. ,assport ;A needs to be installed to use ,assport authentication in your Web application. 19. E5plain Server'side scriptin( and &lient'side scriptin(. - erver side scripting - $ll the script are e+ecuted by the server and interpreted as needed. - Client side scripting means that the script will be e+ecuted immediately in the browser such as form field validation) email validation) etc. (t is usaullay carrried out in !" cript or Java cript. 1:. a.% What is (ar#a(e collection? (t is a system where a run-time component ta%es responsibility for managing the lifetime of ob*ects and the heap memory that they occupy. #.% E5plain seriali)ation and deseriali)ation. - erialization is the process of converting an ob*ect into a stream of bytes. - ;eserialization is the process of creating an ob*ect from a stream of bytes. "oth these processes are usually used to transport ob*ects. ;. What are the various session state ,ana(e,ent options provided #y ASP.NET? - $ ,.56# provides two session state management options - (n-,rocess and Out-of-,rocess state management. - (n-,rocess stores the session in memory on the web server. - Out-of-,rocess stores data in an e+ternal data source. #his data source may be a B8 erver or a tate erver service. Out-of-,rocess state management needs all ob*ects stored in session to be serializable. ASP.NET interview questions - Jan 04, 2011 at 05:16 PM ! "a#u$ !escri#e how Passport authentication wor/s. $ ,.56# application with ,assport authentication implemented chec%s the userCs machine for a current passport authentication coo%ie. (f it is not available) $ ,.56# directs the user to a
,assport sign-on page. #he ,assport service authenticates the user) stores an authentication coo%ie on the userCs computer and direct the user to the re&uested page. E5plain the steps to #e "ollowed to use Passport authentication. D. (nstall the ,assport ;A. E. et the applicationCs authentication mode to ,assport in Web.config. ?. et authorization to deny unauthenticated users. ?. 9se the ,assport$uthentication4On$uthenticate event to access the userCs ,assport profile to identify and authorize the user. F. (mplement a sign-out procedure to remove ,assport coo%ies from the userCs machine. E5plain the advanta(es o" Passport authentication. 9ser doesnCt have to remember separate user names and passwords for various Web sites 9ser can maintain his or her profile information in a single location. ,assport authentication also avail access to various Microsoft services) such as ,assport 6+press ,urchase. What is cachin(? Caching is the techni&ue of storing fre&uently used items in memory so that they can be accessed more &uic%ly. "y caching the response) the re&uest is served from the response already stored in memory. (tCs important to choose the items to cache wisely as Caching incurs overhead. $ Web form that is fre&uently used and does not contain data that fre&uently changes is good for caching. $ cached web form freezes formCs server-side content and changes to that content do not appear until the cache is refreshed. $dvanced $sp.net interview &uestions $ ,.56# practice test E5plain the use o" duration attri#ute o" >Output&ache pa(e directive. #he GOutputCache directiveCs ;uration attribute determines how long the page is cached. (f the duration attribute is set to >H seconds) the Web form is cached for >H secondsI the server loads the response in memory and retains that response for >H seconds. $ny re&uests during that time receive the cached response. Once the cache duration has e+pired) the ne+t re&uest generates a new response and cached for another >H seconds. $ ,.56# interview test - <EH &uestions= new $ ,.56# interview test for e+perienced - <DJ &uestions= &l erver <EK &uestions=
1. E5plain how a we# application wor/s. Answer$ $ web application resides in the server and serves the client's re&uests over internet. #he client access the web page using browser from his machine. When a client ma%es a re&uest) it receives the result in the form of 7#M8 which are interpreted and displayed by the browser. $ web application on the server side runs under the management of Microsoft (nternet (nformation ervices <(( =. (( passes the re&uest received from client to the application. #he application returns the re&uested result in the form of 7#M8 to (( ) which in turn) sends the result to the client. . E5plain the advanta(es o" ASP.NET. Answer$ 'ollowing are the advantages of $ ,.56#. Web application e+ists in compiled form on the server so the e+ecution speed is faster as compared to the interpreted scripts. $ ,.56# ma%es development simpler and easier to maintain with an event-driven) server-side programming model. "eing part of .'ramewor%) it has access to all the features of .5et 'ramewor%. Content and program logic are separated which reduces the inconveniences of program maintenance. $ ,.56# ma%es for easy deployment. #here is no need to register components because the configuration information is built-in. #o develop program logic) a developer can choose to write their code in more than EK .5et languages including !".5et) CL) J cript.5et etc. (ntroduction of view state helps in maintaining state of the controls automatically between the postbac%s events. $ ,.56# offers built-in security features through windows authentication or other authentication methods. (ntegrated with $;O.56#. "uilt-in caching features.
*. E5plain the di""erent parts that constitute ASP.NET application. Answer$ Content) program logic and configuration file constitute an $ ,.56# application. Content files Content files include static te+t) images and can include elements from database. ,rogram logic ,rogram logic files e+ist as ;88 file on the server that responds to the user actions. Configuration file Configuration file offers various settings that determine how the application runs on the server. -. !escri#e the sequence o" action ta/es place on the server when ASP.NET application starts "irst ti,e Answer$ 'ollowing are the se&uences(( starts $ ,.56# wor%er process - wor%er process loads assembly in the memory - (( sends the re&uest to the assembly - the assembly composes a response using program logic - (( returns the response to the user in the form of 7#M8. 1. E5plain the co,ponents o" we# "or, in ASP.NET Answer$ erver controls #he server controls are 7yperte+t Mar%up 8anguage <7#M8= elements that include a runat0server attribute. #hey provide automatic state management and server-side events and respond to the user events by e+ecuting event handler on the server. 7#M8 controls #hese controls also respond to the user events but the events processing happen on the client machine. ;ata controls ;ata controls allow to connect to the database) e+ecute command and retrieve data from database. ystem components ystem components provide access to system-level events that occur on the server.
2. !escri#e in #rie" .NET .ra,ewor/ and its co,ponents. Answer$ .56# 'ramewor% provides platform for developing windows and web software. $ ,.56# is a part of .5et framewor% and can access all features implemented within it that was formerly available only through windows $,(. .56# 'ramewor% sits in between our application programs and operating system. #he .5et 'ramewor% has two main components.5et 'ramewor% Class 8ibrary- (t provides common types such as data types and ob*ect types that can be shared by all .5et compliant language. #he Common language :untime- (t provides services li%e type safety) security) code e+ecution) thread management) interoperability services. 6. What is an Asse,#ly? E5plain its parts Answer$ $n assembly e+ists as a .;88 or [email protected]
that contains M (8 code that is e+ecuted by C8:. $n assembly contains interface and classes) it can also contain other resources li%e bitmaps) files etc. (t carries version details which are used by the C8: during e+ecution. #wo assemblies of the same name but with different versions can run side-by-side enabling applications that depend on a specific version to use assembly of that version. $n assembly is the unit on which permissions are granted. (t can be private or global. $ private assembly is used only by the application to which it belongs) but the global assembly can be used by any application in the system. #he four parts of an assembly are$ssembly Manifest - (t contains name) version) culture) and information about referenced assemblies. #ype metadata - (t contains information about types defined in the assembly. M (8 - M (8 code. :esources - 'iles such as "M, or J,3 file or any other files re&uired by application. 9. !e"ine &o,,on Type Syste,. Answer$ .5et allows developers to write program logic in at least EK languages. #he classes written in one language can be used by other languages in .5et. #his service of .5et is possible through C#
which ensure the rules related to data types that all language must follow. (t provides set of types that are used by all .56# languages and ensures .56# language type compatibility. :. !e"ine =irtual "older. Answer$ (t is the folder that contains web applications. #he folder that has been published as virtual folder by (( can only contain web applications. 1;. !escri#e the Events in the 3i"e &ycle o" a We# Application Answer$ $ web application starts when a browser re&uests a page of the application first time. #he re&uest is received by the (( which then starts $ ,.56# wor%er process <aspnet4wp.e+e=. #he wor%er process then allocates a process space to the assembly and loads it. $n application4start event occurs followed by ession4start. #he re&uest is then processed by the $ ,.56# engine and sends bac% response in the form of 7#M8. #he user receives the response in the form of page. #he page can be submitted to the server for further processing. #he page submitting triggers postbac% event that causes the browser to send the page data) also called as view state to the server. When server receives view state) it creates new instance of the web form. #he data is then restored from the view state to the control of the web form in ,age4(nit event. #he data in the control is then available in the ,age4load event of the web form. #he cached event is then handled and finally the event that caused the postbac% is processed. #he web form is then destroyed. When the user stops using the application) ession4end event occurs and session ends. #he default session time is EH minutes. #he application ends when no user accessing the application and this triggers $pplication46nd event. 'inally all the resources of the application are reclaimed by the 3arbage collector. 11. What are the ways o" preservin( data on a We# .or, in ASP.NET? Answer$ $ ,.56# has introduced view state to preserve data between postbac% events. !iew state can't avail data to other web form in an application. #o provide data to other forms) you need to save data in a state variable in the application or session ob*ects. 1 . !e"ine application state varia#le and session state varia#le. Answer$ #hese ob*ects provide two levels of scope-
$pplication tate ;ata stored in the application ob*ect can be shared by all the sessions of the application. $pplication ob*ect stores data in the %ey value pair. ession tate ession tate stores session-specific information and the information is visible within the session only. $ ,.56# creates uni&ue session(d for each session of the application. ession(;s are maintained either by an 7##, coo%ie or a modified 9:8) as set in the applicationCs configuration settings. "y default) ession(; values are stored in a coo%ie. 1*. !escri#e the application event handlers in ASP.NET $nswer'ollowing are the application event handlers$pplication4 tart- #his event occurs when the first user visits a page of the application. $pplication46nd- #his event occurs when there are no more users of the application. $pplication4"egin:e&uest- #his occurs at the beginning of each re&uest to the server. $pplication46nd:e&uest- occurs at the end of each re&uest to the server. ession4 tart- #his event occurs every time when any new user visits. ession46nd- occurs when the users stop re&uesting pages and their session times out. 1-. What are the We# .or, Events availa#le in ASP.NET? $nswer,age4(nit ,age48oad ,age4,re:ender ,age49nload ,age4;isposed ,age46rror ,age4$bort#ransaction ,age4Commit#ransaction ,age4;ata"inding 11. !escri#e the Server &ontrol Events o" ASP.NET. $nswer$ ,.56# offers many server controls li%e button) te+tbo+) ;rop;own8ist etc. 6ach control can respond to the user's actions using events and event handler mechanism. #here are three types of server control events-
,ostbac% events #his events sends the web page to the server for processing. Web page sends data bac% to the same page on the server. Cached events #hese events are processed when a postbac% event occurs. !alidation events #hese events occur *ust before a page is posted bac% to the server. 12. +ow do you chan(e the session ti,e'out value? $nswer#he session time-out value is specified in the web.config file within sessionstate element. Mou can change the session time-out setting by changing value of timeout attribute of sessionstate element in web.config file. 16. !escri#e how ASP.NET ,aintains process isolation "or each We# application $nswer(n $ ,.56#) when (( receives a re&uest) (( uses aspnet4isapi.dll to call the $ ,.56# wor%er process <aspnet4wp.e+e=. #he $ ,.56# wor%er process loads the Web application's assembly) allocating one process space) called the application domain) for each application. #his is the how $ ,.56# maintains process isolation for each Web application. 19. !e"ine na,espace. $nswer5amespaces are the way to organize programming code. (t removes the chances of name conflict. (t is &uite possible to have one name for an item accidentally in large pro*ects those results into conflict. "y organizing your code into namespaces) you reduce the chance of these conflicts. Mou can create namespaces by enclosing a class in a 5amespace...6nd 5amespace bloc%. Mou can use namespaces outside your pro*ect by referring them using :eferences dialog bo+. Mou can use (mports or using statement to the code file to access members of the namespaces in code. 1:. What are the options in ASP.NET to ,aintain state? $nswer-
Client-side state management #his maintains information on the clientCs machine using Coo%ies) !iew tate) and Buery trings. Coo%ies $ coo%ie is a small te+t file on the client machine either in the clientCs file system or memory of client browser session. Coo%ies are not good for sensitive data. Moreover) Coo%ies can be disabled on the browser. #hus) you canCt rely on coo%ies for state management. !iew tate 6ach page and each control on the page has !iew tate property. #his property allows automatic retention of page and controls state between each trip to server. #his means control value is maintained between page postbac%s. !iewstate is implemented using 4!(6W #$#6) a hidden form field which gets created automatically on each page. Mou canCt transmit data to other page using view state. Buerystring Buery strings can maintain limited state information. ;ata can be passed from one page to another with the 9:8 but you can send limited size of data with the 9:8. Most browsers allow a limit of EKK characters on 9:8 length. erver-side state management #his %ind of mechanism retains state in the server. $pplication tate #he data stored in the application ob*ect can be shared by all the sessions of the application. $pplication ob*ect stores data in the %ey value pair. ession tate ession tate stores session-specific information and the information is visible within the session only. $ ,.56# creates uni&ue session(d for each session of the application. ession(;s are maintained either by an 7##, coo%ie or a modified 9:8) as set in the applicationCs configuration settings. "y default) ession(; values are stored in a coo%ie. ;atabase ;atabase can be used to store large state information. ;atabase support is used in combination with coo%ies or session state. ;. E5plain the di""erence #etween Server control and +TM3 control. $nswererver events erver control events are handled in the server whereas 7#M8 control events are handled in the page.
tate management erver controls can maintain data across re&uests using view state whereas 7#M8 controls have no such mechanism to store data between re&uests. "rowser detection erver controls can detect browser automatically and adapt display of control accordingly whereas 7#M8 controls canCt detect browser automatically. ,roperties erver controls contain properties whereas 7#M8 controls have attributes only. 1. What are the validation controls availa#le in ASP.NET? $nswer$ ,.56# validation controls are:e&uired'ield!alidator- #his validates controls if controls contain data. Compare!alidator- #his allows chec%ing if data of one control match with other control. :ange!alidator- #his verifies if entered data is between two values. :egular6+pression!alidator- #his chec%s if entered data matches a specific format. Custom!alidator- !alidate the data entered using a client-side script or a server-side code. !alidation ummary- #his allows developer to display errors in one place. . !e"ine the steps to set up validation control. $nswer'ollowing are the steps to set up validation control ;rag a validation control on a web form. et the Control#o!alidate property to the control to be validated. (f you are using Compare!alidator) you have to specify the Control#oCompare property. pecify the error message you want to display using 6rrorMessage property. Mou can use !alidation ummary control to show errors at one place. *. What are the navi(ation ways #etween pa(es availa#le in ASP.NET? $nswer-
Ways to navigate between pages are7yperlin% control :esponse.:edirect method erver.#ransfer method erver.6+ecute method Window.Open script method -. +ow do you open a pa(e in a new window? $nswer#o open a page in a new window) you have to use client script using onclic%01window.open<=1 attribute of 7#M8 control. 1. !e"ine authentication and authori)ation. $nswer$uthorization- #he process of granting access privileges to resources or tas%s within an application. $uthentication- #he process of validating the identity of a user. 2. !e"ine cachin(. $nswerCaching is the techni&ue of storing fre&uently used items in memory so that they can be accessed more &uic%ly. Caching techni&ue allows to store2cache page output or application data on the client on the server. #he cached information is used to serve subse&uent re&uests that avoid the overhead of recreating the same information. #his enhances performance when same information is re&uested many times by the user. 6. !e"ine coo/ie. $nswer$ coo%ie is a small file on the client computer that a web application uses to maintain current session information. Coo%ies are used to identity a user in a future session. 9. What is dele(ate? $nswer-
$ delegate acts li%e a strongly type function pointer. ;elegates can invo%e the methods that they reference without ma%ing e+plicit calls to those methods. (t is type safe since it holds reference of only those methods that match its signature. 9nli%e other classes) the delegate class has a signature. ;elegates are used to implement event programming model in .56# application. ;elegates enable the methods that listen for an event) to be abstract. :. E5plain E5ception handlin( in .Net. $nswer6+ceptions or errors are unusual occurrences that happen within the logic of an application. #he C8: has provided structured way to deal with e+ceptions using #ry2Catch bloc%. $ ,.56# supports some facilities to handling e+ceptions using events suc% as ,age46rror and $pplication46rror. *;. What is i,personation? $nswer(mpersonation means delegating one user identity to another user. (n $ ,.56#) the anonymous users impersonate the $ ,56# user account by default. Mou can use .identity/ element of web.config file to impersonate user. 6.g. .identity impersonate01true12/ *1. What is ,ana(ed code in .Net? $nswer#he code that runs under the guidance of common language runtime <C8:= is called managed code. #he versioning and registration problem which are formally handled by the windows programming are solved in .5et with the introduction of managed code. #he managed code contains all the versioning and type information that the C8: use to run the application. * . What are Mer(e ,odules? $nswerMerge modules are the deployment pro*ects for the shared components. (f the components are already installed) the modules merge the changes rather than unnecessarily overwrite them. When the components are no longer in use) they are removed safely from the server using Merge modules facility. **. What is Satellite asse,#ly? $nsweratellite assembly is a %ind of assembly that includes localized resources for an application. 6ach satellite assembly contains the resources for one culture.
*-. !e"ine secured soc/ets layer. $nswerecured oc%et 8ayer < 8= ensures a secured web application by encrypting the data sent over internet. When an application is using 8 facility) the server generates an encryption %ey for the session and page is encrypted before it sent. #he client browse uses this encryption %ey to decrypt the re&uested Web page. *1. !e"ine session in ASP.NET. $nswer$ session starts when the browser first re&uest a resources from within the application. #he session gets terminated when either browser closed down or session time out has been attained. #he default time out for the session is EH minutes. *2. !e"ine Tracin(. $nswer#racing is the way to maintain events in an application. (t is useful while the application is in debugging or in the testing phase. #he trace class in the code is used to diagnose problem. Mou can use trace messages to your pro*ect to monitor events in the released version of the application. #he trace class is found in the ystem.;iagnostics namespace. $ ,.56# introduces tracing that enables you to write debug statements in your code) which still remain in the code even after when it is deployed to production servers. *6. !e"ine =iew State. $nswer$ ,.56# preserves data between postbac% events using view state. Mou can save a lot of coding using view state in the web form. !iew tate serialize the state of ob*ects and store in a hidden field on the page. (t retains the state of server-side ob*ects between postbac%s. (t represents the status of the page when submitted to the server. "y default) view state is maintained for each page. (f you do not want to maintain the !iew tate) include the directive .NG ,age 6nable!iew tate01false1 N/ at the top of an .asp+ page or add the attribute 6nable!iew tate01false1 to any control. !iew tate e+ist for the life of the current page. *9. What is application do,ain? $nswer-
(t is the process space within which $ ,.56# application runs. 6very application has its own process space which isolates it from other application. (f one of the application domains throws error it does not affect the other application domains. *:. 3ist down the sequence o" ,ethods called durin( the pa(e load. $nswer(nit<= - (nitializes the page. 8oad<= - 8oads the page in the server memory. ,re:ender<= - the brief moment before the page is displayed to the user as 7#M8 9nload<= - runs *ust after page finishes loading. -;. What is the i,portance o" 0lo#al.asa5 in ASP.NET? $nswer#he 3lobal.asa+ is used to implement application and session level events. -1. !e"ine MS<3. $nswerM (8 is the Microsoft (ntermediate 8anguage. $ll .5et languages' e+ecutable e+ists as M (8 which gets converted into machine specific language using J(# compiler *ust before e+ecution. - . 8esponse.8edirect vs Server.Trans"er $nswererver.#ransfer is only applicable for asp+ files. (t transfers page processing to another page without ma%ing round-trip bac% to the client's browser. ince no round trips) it offers faster response and doesn't update client url history list. :esponse.:edirect is used to redirect to another page or site. #his performs a trip bac% to the client where the clientCs browser is redirected to the new page. -*. E5plain Session state ,ana(e,ent options in ASP.NET. $nswer$ ,.56# provides (n-,rocess and Out-of-,rocess state management. (n-,rocess stores the session in memory on the web server. Out-of-,rocess ession state management stores data in an e+ternal data source such as B8 erver or a tate erver service. Out-of-,rocess state management re&uires that all ob*ects stored in session are serializable.
--. +ow to turn o"" coo/ies "or a pa(e? $nswerCoo%ie.;iscard ,roperty when true) instructs the client application not to save the Coo%ie on the user's hard dis% when a session ends. -1. +ow can you ensure a per,anent coo/ie? $nsweretting 6+pires property to Min!alue and restrict coo%ie to get e+pired. -2. What is AutoPost#ac/? $nswer$uto,ost"ac% automatically posts the page bac% to the server when state of the control is changed. -6. E5plain lo(in control and "or, authentication. $nswer8ogin controls encapsulate all the features offered by 'orms authentication. 8ogin controls internally use 'orms$uthentication class to implement security by prompting for user credentials validating them. -9. What is the use o" We#.con"i( "ile? $nswer'ollowing are the setting you can incorporate in web.config file. ;atabase connections 6rror ,age setting ession tates 6rror 7andling ecurity #race setting Culture specific setting -:. E5plain in what order a destructors is called. $nswer-
;estructors are called in reverse order of constructors. ;estructor of most derived class is called followed by its parent's destructor and so on till the topmost class in the hierarchy. 1;. What is #rea/ ,ode? What are the options to step throu(h code? $nswer"rea% mode lets you to observe code line to line in order to locate error. ! .56# provides following option to step through code. tep (nto tep Over tep Out :un #o Cursor et 5e+t tatement 11. E5plain how to retrieve property settin(s "ro, ?M3 .con"i( "ile. $nswerCreate an instance of $pp ettings:eader class) use 3et!alue method by passing the name of the property and the type e+pected. $ssign the result to the appropriate variable. 1 . E5plain 0lo#al Asse,#ly &ache. $nswer3lobal $ssembly Cache is the place holder for shared assembly. (f an assembly is installed to the 3lobal $ssembly Cache) the assembly can be accessed by multiple applications. (n order to install an assembly to the 3$C) the assembly must have to be signed with strong name. 1*. E5plain Mana(ed code an 7n',ana(ed code. $nswerManaged code runs under the safe supervision of common language runtime. Managed code carries metadata that is used by common language runtime to offer service li%e memory management) code access security) and cross-language accessibility. 9nmanaged code doesn't follow C8: conventions and thus) can't ta%e the advantages of .'ramewor%. 1-. What is side'#y'side e5ecution? $nswer-
#his means multiple version of same assembly to run on the same computer. #his feature enables to deploy multiple versions of the component. 11. !e"ine 8esource .iles. $nswer:esource files contains non-e+ecutable data li%e strings) images etc that are used by an application and deployed along with it. Mou can changes these data without recompiling the whole application. 12. !e"ine 0lo#ali)ation and 3ocali)ation. $nswer3lobalization is the process of creating multilingual application by defining culture specific features li%e currency) date and time format) calendar and other issues. 8ocalization is the process of accommodating cultural differences in an application. 16. What is re"lection? $nswer:eflection is a mechanism through which types defined in the metadata of each module can be accessed. #he ystem.:eflection namespaces contains classes that can be used to define the types for an assembly. 19. !e"ine Satellite Asse,#lies. $nsweratellite $ssemblies are the special %inds of assemblies that e+ist as ;88 and contain culturespecific resources in a binary format. #hey store compiled localized application resources. #hey can be created using the $8 utility and can be deployed even after deployment of the application. atellite $ssemblies encapsulate resources into binary format and thus ma%es resources lighter and consume lesser space on the dis%. 1:. What is &AS? $nswerC$ is very important part of .5et security system which verifies if particular piece of code is allowed to run. (t also determines if piece of code have access rights to run particular resource. .56# security system applies these features using code groups and permissions. 6ach assembly of an application is the part of code group with associated permissions.
2;. E5plain Auto,atic Me,ory Mana(e,ent in .NET. $nswer$utomatic memory management in .5et is through garbage collector which is incredibly efficient in releasing resources when no longer in use.