ASP.NET 3.5 Interview Questions & Answers : 1. Explain the life cycle of an ASP .NET page.?

Following are the events occur during ASP.NET Page Life Cycle:

1)Page_PreInit 2)Page_Init 3)Page_InitComplete 4)Page_PreLoad 5)Page_Load 6)Control Events 7)Page_LoadComplete 8)Page_PreRender 9)SaveViewState 10)Page_Render 11)Page_Unload

Among above events Page_Render is the only event which is raised by page. So we can't write code for this event.

2. how does the cookies work in we know Http is an state-less protocol which is required for interaction between clinet and server .

so there is an need to remeber state of request raised by an web browser so that web server can recognize you have already previously visited or not.

There are two types of state management techniques: a) Client side state management b) Server - side statemanagement

Using cookies comes under clinet side statemanagement .In HttpResponse we write Cookie containing sessionId and other information within it.

when a browser made a request to the web server the same cookie is sent to the server where server recognize the session id and get other information stored to it previously.

3. What is Ispostback method in ASP.Net? Why do we use that?? Basically Post back is an action performed by a interactive Webpage. When it goes to the server side for a non-client Operation Server again posts it back to the client and hence the name. Ex:


will not allow the page to post back again n again bcoz it reduces the performance.

4. Can User Control be stored in library?. I will say "NO"

there are 3 types of controls: 1) User Control 2) Custom Control 3) Web parts

you can reuse User control in the current project in which you have built it, but you can't move it to other project as unless you just copy paste the same file there and make the changes for that project ( which violets the concept of library).

but custom control can be shared between projects. and you can precompile them even as a dll, so this means you can use them in library of any type.

5. what is the difference between application state and caching? Application Object and Cached Object both falls under Server side State


Application object resides in InProc i.e. on the same server where we hosted our application. Cache Object resides on server side/ DownStream/Client Side.

Application Object will be disposed once application will stop. Cache Object can be disposed using Time based cache dependency.

Only one user can access Application Object at a time hence we have to lock it every time we modify it.

6. what is boxing and unboxing? Boxing is what happens when a value-type object is assigned to a reference-type variable. Unboxing is what happens when a reference-type variable is assigned to a valuetype variable. 7. What are the uses of Reflection?? Reflection is a concept using which we can

1) Load assemblies dynamically 2) Invoke methods at runtime 3) Retriving type information at runtime.

8. What is the use of AutoWireup in AutoEventWireup attribute is used to set whether the events needs to be automatically generated or not. In the case where AutoEventWireup attribute is set to false (by default) event handlers are automatically required for Page_Load or Page_Init. However when we set the value of the AutoEventWireup attribute to true the ASP.NET runtime does not require events to specify event handlers like Page_Load or Page_Init.

Where do the Cookie State and Session State information be stored? Cookie Information will be stored in a txt file on client system under a folder named Cookies. what events will occur when a page is loaded? Below are the events occures during page load.(To use it in other application we need to add it to that project. Where is the View state Data stored? ViewState data is stored in the hidden field. 11. 3) Can be added to ToolBox. When the page is submitted to the server the data is sent to the server in the form of hidden fields for each control. 2) It Can be used inside the same Application. 12. What is the difference between custom web user control and a custom web server control? Web User Control: 1) Easy to Create. Web Server Control: 1) Bit tuff to create as compare to User Control.9.) 3) It Can take advantage of Caching Technique. Search for it in your system you will find it. 1) Page_PreInit 2) Page_Init 3) Page_InitComplete 4) Page_PreLoad 10. . 2) Easy to use. If th viewstate of the control is enable true the value is retained on the post back to the client when the page is post backed.

? Session Management can be achieved in two ways 1)InProc 2)OutProc OutProc is again two types 1)State Server 2)SQL Server InProc Adv. 13.: 1) Faster as session resides in the same process as the application 2) No need to serialize the data DisAdv. 14. Default DB which will be created after running InstallSQLState Script is ASPState. What is the difference between adding reference in solution Explorer and adding references by USING ? Adding reference in solution explorer is used to add the DLL for that project for reference only. If you want to utilize that DLL methods/functions in our aspx.Net? Name them.Coming to Session State As we know for every process some default space will be allocated by OS. In case of InProc Session Info will be stored inside the process where our application is running.cs file etc you must write using that nameclass library name in file. What are the different types of sessions in ASP.NET State Service.: 1) Will degrade the performance of the application if large chunk of data is stored 2) On restart of IIS all the Session info will be lost . In case of SQLServer Session info will be stored inside Database. In case of StateServer Session Info will be stored using ASP.cs/.

.NET State Service restart won't effect the session data 3) Good place for storing large chunk of data DisAdv.: 1) Data need to be serialized 2) Slower as compare to InProc and State Server 3)Need to purchase Licensed version of SQL Serve 15.: 1) Data need to be serialized 2) On restart of ASP. How do you design a website with multilingual support in ASP. Using Globalization we change the Currency Date Numbers etc to Language Specific Format.: 1) Faster then SQL Server session management 2) Safer then InProc.State Server Adv.NET? Multilingual website can be created using Globalization and Localization.: 1) Reliable and Durable 2) IIS and ASP.NET State Service session info will be lost 3)Slower as compared to InProc SQL Server Adv. As IIS restart won't effect the session data DisAdv. To change the string which is there in the label button etc to language specific string we use Localization.

e. 16. Fragment Caching .e it is applied on all application in o/s .g. etc. This is considered as the best way to enhance the performance of the application.Net Framework is used for Automatic Memory Management i.gc.config is a system level configuration i. Explain the basic functionality of garbage collector? Garbage Collector in .NET? Caching is a technique of persisting the data in memory for immediate access to requesting program calls. 2)Business Layer (Where we keep business logic). What is caching? What are different ways of caching in ASP.Resources System.collect().e. e.Caches the whole page. 3)Data Access Layer (Where we keep code used to interact with DB). e.In Localization we have to create different Resource files for different languages. During this process we use some classes present in System.g Code related to manipulating data Custom Exception classes Custom Control classes Login related code if any etc. it is collect all unused memory area and give to application.gc.Threading namespaces. What is meant by 3-tier architecture. We can have the methods which are using SQL Helper (Application Block). system. What is the difference between mechine. We generally split our application into 3-Layers 1)Presentation Layer ( Where we keep all web forms Master Pages and User Controls).config and web. But remember one think it is only an request i.config? machine. Caching is of 3 types: Output Caching . we can't explicitly release the memory by using system.Caches a part of the page Data Caching .Caches the data 17. 19. 18.Globalization System.collect() is a method for release the memory.

net?.config file. How we implement Web farm and Web Garden concept in ASP.Server.e each asp.NET?. 23. Response. 1. (All servers share load equally) 2. The user's browser history list is updated to reflect the new address. So we may have a server in each state of US. RoundRobin. Hybrid (of 2 and 3). What is the difference between Response. 22.Redirect is used toredirect the user's browser to another page or site. 20. . NLB (economical) 3. How they bear it is based on various models.config it is applicable to only one application i.Transfer. HLB (expensive but can scale up to 8192 servers) 4. 5.Redirect and Server. This provides a faster response with a little less overhead on the server. CLB (Component load balancer).that the configuration is set where as in web. webapplication will contain atleast on web. How can exception be handled with out the use of try catch? using Exception Management application block or Page_error Application_error objects 21. Where the assembly is stored in asp. If the load on one server is in excess then the other servers step in to bear the brunt. This performs a trip back to the client where the client's browser is redirected to the new page. A web farm is a multi-server scenario. private are stored in application / bin directory and public are stored in GAC.Transfer does not update the clients url history list or current url.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser.

Query string length depends on browser compatability IE supports upto 255 Firefox supports upto 4000 25.e. b) Say mode StateServer (for webfarm) c) Say mode SqlServer (for webfarm) Whether to use option b or c depends on situation. a) Say mode inproc (non web farm but fast when you have very few customers). i.Net: Go to web. a single server (not like the multi server above).NET maps HTTP requests to HttpHandlers.aspx) .Default HttpHandler for all ASP.A web garden is a multi-processor setup. StateServer is faster but SqlServer is more reliable and used for mission critical applications.config and Here for mode you have 4 options. Each HttpHandler enables processing of individual HTTP URLs or groups of URL extensions within an application. 24. HttpHandlers have the same functionality as ISAPI extensions with a much simpler programming model Ex 1.config and Change the false to true.NET pages ->ASP.Net: Go to web. Is there any limit for query string? means what is the maximum size?. What is the exact purpose of http handlers? ASP.. How to use webgardens in . Servers should be cautious about depending on URI lengths above 255 bytes because some older client or proxy implementations may not properly support these lengths. How to implement webfarms in .NET Page Handler (*. You have one more attribute that is related to webgarden in the same tag called cpuMask.

etc. the state of a page is maintained in the in the page itself automatically. Email Validator. Can the validation be done in the server side? Or this can be done only in the Client side? Client side is done by default.NET able to support multiple languages? A language should comply with the Common Language Runtime standard to become a .Default HttpHandler for all ASP. Server side validation is also possible. A synchronous handler does not return until it finishes processing the HTTP request for which it is called.NET language.config file. This can be switched off / on for a single control How do you validate the controls in an ASP . We have Range Validator.NET. VB. A code can call or use a function written in another language. these DLLs can be executed on the server. code is compiled to Microsoft Intermediate Language (MSIL for short).NET service pages->ASP.NET. We can switch off the client side and server side can be done.NET was introduced it came with several languages. This Managed code is run in . How ASP . This is called as Managed Code. COBOL and Perl. this is done automatically by the ASP.NET is supporting now? When .NET different from ASP? Scripting is separated from the HTML.NET Service Handler (*. 44 languages are supported.NET page? Using special validation controls that are meant for this. How many languages .NET.2. How is .NET. Code is compiled as a DLL.asmx) An HttpHandler can be either synchronous or asynchronous. What is smart navigation? The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed. C#. An asynchronous handler usually launches a process that can be lengthy and returns before that process finishes After writing and compiling the code to implement an HttpHandler you must register the handler using your application's Web. In . What is view state? The web is stateless. .NET environment. But in ASP. So after compilation to this IL the language is not a barrier. How? The values are encrypted and saved in hidden controls.

How to manage pagination in a page? Using pagination option in DataGrid control. if you are binding a control to data on every round trip (as in the datagrid example in tip #4). the only option we had was Response.NET? ADO. The biggest . This feature is not free however. For example. To disable it. Client side scripting means that the script will be executed immediately in the browser such as form field validation. since you will wipe out any re-populated data in any case. What is the difference between Server. since the state of a control is passed to and from the server in a hidden form field. Download time. uploading. While this method does accomplish our goal. I can update the actual database as a batch.Redirect? Why would I choose one over the other? Server. clock.Dedirect() :client know the physical location (page name and query string as well).Net as a separate inmemory database where in I can use relationships between the tables and select insert and updates to the database. etc. ASP doesn’t have some of the functionality like sockets. What type of code (server or client) is found in a Code-Behind class? C# Should validation (did the user enter a real date) occur server-side or clientside? Why? Client-side validation because there is no need to request a server side date when you could obtain a date from the client machine. Response. Also a possible security hazards for the client computer. You should be aware of when ViewState is helping you and when it is not. then it takes care of pagination by itself.Item collection. I can treat the ADO. What does the "EnableViewState" property do? Why would I want it on or off? Enable ViewState turns on the automatic state management feature that enables server controls to re-populate their values on a round trip without requiring you to write any code.NET is stateless mechanism. Client side scripting is usually done in VBScript or JavaScript. Data can be persist across the pages using Context. browser compatibility. and visible code . ViewState is enabled for all server controls by default.Transfer and Response. etc.Redirect. if we wanted to send a user to a new Web page. What is ADO . but the all the content is of the requested page. We have to set the number of records for a page.Transfer() : client is shown as it is on the requesting page only.Items loses the persistence when navigate to destination page. For these you have to make a custom components usually in VB or VC++. it has several important drawbacks. then you do not need the control to maintain it’s view state. set the EnableViewState property of the control to false. In earlier versions of IIS.since JavaScript and VBScript code is included in the HTML page. then anyone can see the code by viewing the page source. email validation. Context. Explain the differences between Server-side and Client-side code? Server side scripting means that all the script will be executed by the server and interpreted as needed.NET and what is difference between ADO and ADO. which is one of the best way to transfer data from one page to another keeping the page state alive.

First. The limiting factor here is that you can reuse the code but not the data behind it. * A RecordSet looks like a single table. A scenario could be when you are building an app that aggregates the functionality of several other Applications. * Business-to-Business Integration This is an enabler for B2B integration which allows one to expose vital business processes to authorized supplier and customers.NET Components as there is very little overhead.NET. it prevents good encapsulation of code.problem is that this method causes each page to be treated as a separate transaction. on high-volume sites. causes scalability problems.Transfer fixes all of these problems. In ADO.Redirect introduces some additional headaches. there is always the problem of communicating between client and server because of firewalls and proxy servers. which. * Application Integration When integrating applications written in various languages and running on disparate systems. it is the dataset. * Software Reuse This takes place at multiple levels. Exposing your middle tier components as Web Services and invoking the directly from a Windows UI is a very valid option.NET component? When to Use Web Services: * Communicating through a Firewall When building a distributed application with 100s/1000s of users spread over multiple locations. the in-memory representation of data is the RecordSet. Besides making it difficult to maintain your transactional integrity. * When not to use Web Services: Single machine Applications When the apps are running on the same machine and need to communicate with each other use a native API. but there is value in perhaps combining the multiple apps to present a unified view in a Portal or Intranet. Code Reuse at the Source code level or binary component-based reuse.NET Dataset and an ADO Recordset? In ADO. but they’re difficult.Redirect necessitates a round trip to the client. Finally.NET Remoting in the case of . It is much more efficient to use DCOM in the case of Win32 apps and . An example would be exposing electronic ordering and invoicing. Or even applications running on the same platform that have been written by separate vendors. If a recordset is to contain data from . * Homogeneous Applications on a LAN If you have Win32 or Winforms apps that want to communicate to their server counterpart. Server. As you might suspect. Webservice overcome this limitation. allowing customers to send you purchase orders and suppliers to send you invoices electronically. Second. Each of these functions could be performed by individual apps. Response. Response. It does this by performing the transfer on the server without requiring a roundtrip to the client. there are workarounds. There are important differences between them. Can you explain the difference between an ADO. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET Apps. Sure. You also have the options of using component technologies such as COM or . you lose access to all of the properties in the Request object.

* Sharing Data Between Applications. * In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method. or adding any other extra processing. read-only cursor is available in the ADO. If a dataset contains data from multiple database tables. Microsoft and third-party providers can make available other . it can hold much richer data structures than a recordset. data commands. The tables within a dataset are called data tables. or access particular rows via ordinal or primary key index. or OracleDataAdapter object). they are DataTable objects. For more information about cursor functionality. and data readers are the components that make up a .NET Framework data provider. For example. so you can loop through a table as you would through any collection. it must use a JOIN query.NET you communicate with the database through a data adapter (an OleDbDataAdapter.multiple database tables. To . Because the dataset can hold multiple. performing data validation checks.NET DataReader object. There is one significant difference between disconnected processing in ADO and ADO. * Minimized Open Connections: In ADO. see Data Access Technologies.NET Framework data providers that can be integrated into Visual Studio.NET. In ADO. In contrast. rows are represented as collections. Data adapters. but ADO is designed primarily for connected access. each DataTable object typically corresponds to a single database table or view. which assembles the data from the various database tables into a single result table. ADO. You can read rows into a dataset and then work with them without staying connected to the data source. Transmitting an ADO. A cursor is a database element that controls record navigation. if a dataset contains a table about investors and another table about each investor’s stock purchases.NET does not have an inherent cursor object. The important difference is that in ADO.NET. such as a Select or Update. A relationship within a dataset is analogous to a foreign-key relationship in a database —that is." you can navigate to the set of rows of the Purchase table describing his purchases. OdbcDataAdapter. In ADO you communicate with the database by making calls to an OLE DB provider. it could also contain a relationship connecting each row of the investor table with the corresponding rows of the purchase table. it associates rows of the tables with each other. a dataset can mimic the structure of the underlying database. which makes calls to an OLE DB provider or the APIs provided by the underlying data source. the functionality of a forwardonly. That is. a dataset is a collection of one or more tables. but instead includes data classes that provide the functionality of a traditional cursor. and the visibility of changes made to the database by other users. In ADO the recordset can provide disconnected access. A dataset usually also contains relationships. In this way. For example.NET dataset between applications is much easier than transmitting an ADO disconnected recordset. separate tables and maintain information about relationships between them. the ability to update data. SqlDataAdapter. In ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database — by optimizing for performance.NET you open connections only long enough to perform a database operation. data connections. For example. specifically. DataRelation objects maintain information about master and detail records and provide a method that allows you to get records related to the one you are working with. it will typically contain multiple DataTable objects. including self-relating tables and tables with many-to-many relationships. starting from the row of the Investor table for "Nate Sun.

NET is based on an XML format. you will also get the familiar dragand-drop interface used to create your UI for your Web application. For example. SessionStateModule exposes both Session_Start and Session_End events. you use a dataset.g. there is no restriction on data types. But ADO.NET/C# achieve polymorphism? By using Abstract classes/functions. firewalls are typically configured to allow HTML text to pass. Transmitting a large ADO recordset or a large ADO. * Penetrating Firewalls. the stress placed on the network also rises. To transmit data in ADO. Web Forms are the User Interface (UI) elements that give your Web applications their look and feel. Thus.NET. you might want to retrieve a list of products from a database table and place the list in application state or the Cache object. you use COM marshalling. e. ADO. If you use Microsoft Visual Studio . Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines? The Application_Start event is guaranteed to occur only once throughout the lifetime of the application. If I’m developing an application that must accomodate multiple security levels though secure login and my ASP. Can you explain what inheritance is and an example of when you might use it? .NET.NET let you minimize which data is transmitted. It’s a good place to initialize global variables.NET offers another performance advantage. Remember.transmit an ADO disconnected recordset from one component to another.COM marshalling provides a limited set of data types — those defined by the COM standard.NET. Both ADO and ADO. which can transmit an XML stream. However. How does VB. the components sharing the dataset can use whatever rich set of data types they would ordinarily use. these UI elements render themselves in the appropriate markup language required by the request.A firewall can interfere with two components trying to transmit disconnected ADO recordsets.NET Web Forms? How is this technology different than what is available though ASP? Web Forms are the heart and soul of ASP. HTML. does require that ADO data types be converted to COM data types.NET dataset can consume network resources.NET does not require data-type conversions. * Richer data types. Web Forms are similar to Windows Forms in that they provide properties. methods.NET web appplication is spanned across three web-servers (using round-robbin load balancing) what would be the best approach to maintain login-in state for the users? What are ASP. as the amount of data grows. which requires COM marshalling to transmit records sets among components. * Performance. in that ADO. and events for the controls that are placed onto them. but to prevent system-level requests (such as COM marshalling) from passing. Because the transmission of datasets in ADO.

Rather than developing new objects from scratch. and event. the path that data takes between client and server. Describe the difference between inline and code behind .NET assembly.aspx file at run time. Page logic code that is written within an external class that is compiled prior to deployment on a server and linked "behind" the . new code can be based on the work of other programmers. An assembly provides the common language runtime with the information it needs to be aware of type implementations. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. and events can be merged. and events of that base class ? including the implementation behind each method. The DataSet uses the DiffGram format to load and persist its contents. Essentially inheritance is a way of merging functionality from an existing class into our new subclass. it populates the DiffGram with all the necessary information to accurately recreate the contents. and a good use for one? A DiffGram is an XML format that is used to identify current and original versions of data elements.extending the original interface with new functionality. Each of our subclasses will automatically have all of the methods. Once we have a base class. and what are the limitations of anyapproach you might take in implementing one? One of ASP. When a DataSet is written as a DiffGram.Inheritance is a fundamental feature of an object oriented system and it is simply the ability to inherit data and functionality from a parent object.NET/C#? When we set out to implement a class using inheritance. of the DataSet. or base class. properties. and row order. and to serialize its contents for transport across a network connection. a subclass can replace the methods and properties of the base class with its own new implementation effectively overriding the original behavior and replacing it with new behaviors.NET’s most useful features is the extensibility of the HTTP pipeline. properties.aspx file and dynamically compiled the first time the page is requested on the server. You can use them to extend . it may be part of some other application or . a type does not exist outside the context of an assembly.NET system class library framework. reuse.which is best in a loosely coupled solution? ASP. or we may create it as part of our existing application. activation scoping. we must first start with an existing class from which we will derive our new subclass. properties. Inheritance also defines rules for how these methods. Additionally. and events of its own . row error information. may be part of the . including column values from both the Original and Current row versions. This existing class. property. version control.NET supports two modes of page development: Page logic code that is written inside <script runat=server> blocks within an . they form the fundamental unit of deployment. we can then implement one or more subclasses based on that base class. and security permissions. Our subclass can add new methods. Explain what a diffgram is. What's an assembly? Assemblies are the building blocks of . adding only new features that are needed. How would you implement inheritance using VB. Where would you use an iHTTPModule.NET Framework applications. To the runtime. though not the schema.

NET. Which template must you provide. and what method must you call in your code.UI. What property must you set.Data. In what order do the events of an ASPX page execute.Page What method do you use to explicitly kill a user’s session? The Abandon method destroys all the objects stored in a Session object and releases their resources. Page_PreRender. in order to display data in a Repeater control? ItemTemplate How can you provide an alternating color scheme in a Repeater control? AlternatingItemTemplate Like the ItemTemplate element.Fill(dsUsers). What base class do all Web Forms inherit from? System. If you do not call the Abandon method explicitly. in order to bind the data from some data source to the Repeater control? You must set the DataMember property which Gets or sets the specific table in the DataSource to bind to the control and the DataBind method to bind data from a source to a server control. this property instructs the client application not to save the Cookie on the user’s hard disk when a session ends. but rendered for every other row (alternating items) in the Repeater control.your ASP.Web. Which method do you invoke on the DataAdapter control to load your generated dataset with data? System.Data. Page_Load. The three that you will deal with the most are: Page_Init.NET applications by adding pre. if you wanted custom authentication facilities for your application. . Syntax: Session.Discard Property which Gets or sets the discard flag set by the server. the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.DataAdapter.Abandon How do you turn off cookies for one page in your site? Use the Cookie.Fill(System. You can specify a different appearance for the AlternatingItemTemplate element by setting its style properties.and post-processing to each HTTP request coming into your application. the server destroys these objects when the session times out.DataSet).aspx page is) has nine events. This method is commonly used after retrieving a data set through a database query. most of which you will not have to worry about in your day to day dealings with ASP. When true. If my DataAdapter is sqlDataAdapter and my DataSet is dsUsers then it is called this way: sqlDataAdapter.Common. For example. As a developer is it important to understand these events? Every Page object (which your .

Transport Protocols: It is essential for the acceptance of Web Services that they are based on established Internet infrastructure. IBM UDDI it is a syntactical and logical definition.? False. What does WSDL stand for? Web Services Description Language Where on the Internet would you look for Web services? UDDI repositaries like uddi. Answer2: SOAP is not the transport SOAP and ebXML Transport are specifications which fulfill these requirements. UDDI Registries in Google Directory.transfer() What is the transport protocol you use to call a Web service? Answer1: SOAP. SOAP is not dependant on any single transport protocol or SMTP and FTP protocols based on the TCP/IP family of transports. enthusiast sites like XMethods. not a transport protocol. Which method do you use to redirect the user to another page without performing a round trip to the client? Server. Messaging Protocol: The format of messages exchanged between Web Services clients and Web Services should be vendor neutral and should not carry details about the technology used to implement the service.Which two properties are on every validation control? ControlToValidate & ErrorMessage properties How do you create a permanent cookie? Setting the Expires property to MinValue means that the Cookie never expires.NET: Public ReadOnly Property PropertyName As ReturnType Get ‘Your Property Implementation goes in here End Get End Property . This in fact imposes the usage of of the HTTP. SOAP is the data encapsulation protocol that is used but the transport protocol is fairly unlimited. How is a property designated as read-only? In VB. the message format should allow for extensions and different bindings to specific transport protocols. What tags do you need to add within the asp:datagrid tags to bind columns manually? Column tag and an ASP:databound tag. Also. We expect that the W3C XML Protocol Working Group defines a successor standard. Generally HTTP is the most common transport protocol used though you could conceivanly use things like SMTP or any others. True or False: A Web service can only be written in .

make sure your objects are serializable. True or False: To test a Web service you must create a windows application or Web application to consume this service? C# public returntype PropertyName { get{ //property implementation goes here } // Do not write the set implementation } Which control would you use if you needed to make sure the values in two different controls matched? Use the CompareValidator control to compare the values of 2 different controls. the Application Path of the website in the IIS Metabase should be identical in all the web servers in the web farm. How many classes can a single . StateServer mode uses an out-of-process Windows NT Server to store state information. Describe session handling in a webfarm. however. . It solves the session state loss problem in InProc mode. (when re-displaying the same page). make sure you have the same in all your web servers. What are the disadvantages of viewstate/what are the benefits? Answer1: Disadvantage of viewstate is that additional data is sent to the browser. . This feature does impact performance. how does it work and what are the limits? Set the sessionState mode in the web. Follow these simple steps: . Allows a webfarm to store session on a central server. . since a server control’s view state is passed to and from the server in a hidden form field. You should be aware of when view state helps you and when it hinders your page’s performance. Answer2: Automatic view-state management is a feature of server controls that enables them to repopulate their property values on a round trip (without you having to write any code). It provides a Single point of failure at the State Server.In a web farm.NET DLL contain? Unlimited.For session state to be maintained across different web servers in the web farm. The benefits are that you do not have to manually manage refreshing the page fields after a submit.Also.config file to “StateServer”.

However. To do so. the runtime creates a temporary reference-type box for the object on heap.Net? What is view state? Web pages are recreated each time the page is posted to the server. process . Basically. The page framework includes a facility called view state that automatically preserves property values of the page and all the controls on it between round trips. but I think you were aiming for SOAP (with the caveat that this is MS’s version of SOAP) What is the difference between boxing and unboxing ? Boxing allows us to convert value types to reference types. Manually a std html anchor tag (a) will work or you can use the micro-magical tag What is the standard you use to wrap up a call to a Web service? Several possible answers depending on your interpretation of the quesiton. for managing state. you will probably also have application-specific values that you want to preserve. Eg: int i=20. this would ordinarily mean that all information associated with the page and the controls on the page would be lost with each round trip. In traditional Web programming.What tags do you need to add within the asp:datagrid tags to bind columns manually? Answer1: Set AutoGenerateColumns Property to false on the datagrid tag Answer2: tag and either or tags (with appropriate attributes of course) What is State Management in .is used to execute more than one program at a time. Client-Based State Management Options: View State Hidden Form Fields Cookies Query Strings Server-Based State Management Options Application State Session State Database Support What tag do you use to add a hyperlink column to the DataGrid? Depends on who’s definition of hyperlink your using. To overcome this inherent limitation of traditional Web programming. the ASP.executes single program . you can use one of the state management options. Describe the difference between a Thread and a Process? Answer1: Thread .Net and how many ways are there to maintain a state in . object o=i.NET page framework includes various options to help you preserve changes — that is.

it is instead used by other programs or the system to perform operations. If multiple threads can exist within a process. file handles. Windows Services are controlled through the Service Control Manager where they can be stopped. They do not require a logged in user in order to execute and can run under the context of any user including the system. Services can be automatically started when the computer is booted. compile the components with the debug flags by using either Visual Studio . whereas DLL will run within an EXE. Which is preferred depends on what you want. Resources include memory. then they share the same memory and file resources. you need to generate debug symbols. and windows. strong typing can reduce errors at compile time. Processes own resources allocated by the operating system. Answer4: Thread is a light weight process. What is a Windows Service and how does its lifecycle differ from a “standard” EXE? Windows Service applications are long-running applications that are ideal for use in server environments. A process have at least one thread of execution. paused. Answer3: The operating system creates a process for the purpose of running a program. sockets. which is initialized itself by a process. Processes do not share address spaces or file resources except through explicit methods such as inheriting file handles or shared memory segments. To do this. these are loaded by its parent process which has generated it. In big programs. Each process executes a single program. For scripts & quick stuff you’ll usually want weak typing. This makes services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer. usually to run-time. The applications do not have a user interface or produce any visual output.NET or a . a proccess is a collection of threads that share the same virtual memory. and started as needed. Threads allow a program to do multiple things concurrently. device handles. or mapping the same file in a shared way. What is the difference between an EXE and a DLL? An EXE can run independently. and a thread always run in a process context. What are PDBs? Where must they be located for debugging to work? Answer1: To debug precompiled components such as business objects and code-behind modules. DLL is an inprocess file and EXE is an out-process file What is strong-typing versus weak-typing? Which is preferred? Why? Strong type is checking the types of variables as soon as possible. Any user messages are typically written to the Windows Event Log.Answer2: A thread is a path of execution that run on CPU. usually at compile time. While weak typing is delaying checking the types of the system as late as possible. At least one thread exists within each process. Light weigt processes does not loads resources required by it itself. because you want to write as much less code as possible.

PDB. CC = E . The project. Right-click the project in the Solution Explorer and click Properties. 4. The concept. meaning that all (. Using Visual Studio . In the left pane. select Build. not just the type information found in VCx0.pdb files).PDB contains full debug information. By definition. The nodes of the graph correspond to the commands of a program. A directed edge connects two nodes. including function prototypes. 7. Answer2: A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program. What is FullTrust? Do GAC’ed assemblies have FullTrust? Your code is allowed to do anything in the framework.NET 1. Both PDB files allow incremental updates. Open the ASP. Set Generate Debugging Information to true. In the Properties dialog box. click the Configuration Properties folder.NET Web Application project in Visual Studio .exe (for Microsoft Visual Basic . if the second command might be executed immediately after the first command.command line compiler such as Csc. The linker creates project. 2.Net) permissions are granted.N + P where CC = cyclomatic complexity E = the number of edges of the graph N = the number of nodes of the graph P = the number of connected components. you can change that using caspol What does this do? gacutil /l | find /i “about” Answer1: This command is used to install strong typed assembly in GAC .exe (for Microsoft Visual C# . and that has FullTrust by default. 3.NET). 6. Right-click the project and click Build to compile the project and generate symbols (.NET. which contains debug information for the project’s EXE file. is somewhat similar to that of general text complexity measured by the Flesch-Kincaid Readability Test. 5.NET) or Vbc. The GAC has FullTrust because it’s on the local HD.PDB. although not the method. It directly measures the number of linearly independent paths through a program’s source code. They should be located at bin\Debug directory What is cyclomatic complexity and why is it important? Cyclomatic complexity is a computer science metric (measurement) developed by Thomas McCabe used to generally measure the complexity of a program. Close the Properties dialog box. Cyclomatic complexity is computed using a graph that describes the control flow of the program.

These services could be databases. Write? When should each be used? Answer1: The Debug. There should be a speed difference. The Service Layer provides a way to access these services that the applications do not need to know how the access is done. In SOA you create an abstract layer that your applications use to access various “services” and can aggregate the services. Write is for information you want only in debug builds. And in any case. Write is for when you want it in release build as well. Write & Trace. Write call won’t be compiled when the DEBUG symbol is not defined (when doing a release build). that is). Write calls will be compiled. Debug. What is the difference between Debug. If any lines contains the text “about” then that line will get displayed on console window. Trace.write only will work . message queues or other sources. The Service layer hides this from the calling application.exe /l is used to lists the contents of the global assembly cache.Try changing the Active Config property of Solution in Property page nd find the difference. I might need to get data from a SGL Server database. less checking.Answer2: gacutil. while in Release Mode. can’t be debugged (easily. etc.write is used in Released version of Applications. It doesn’t know what system or systems it came from or how it was retrieved. doesn’t have [Conational(”DEBUG”)] methods calls compiled. to get a full customer record. because of disabling debug methods. For example. web services. if at that point you know that an error has occurred. Debug. What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not? Debug build contain debug symbols and can be debugged while release build doesn’t contain debug symbols. then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project. find /i “about” is to find the text “about” on gacutil output. Trace. How does the XmlSerializer work? What ACL permissions does a process using it require? XmlSerializer requires write permission to the system’s TEMP directory.exe is used to install strong typed assembly in GAC. All the application knows is that it asked for a full customer record. a web service and a message queue. you should use something like log4net because that is both faster and better Answer2: Debug.Trace. write .write is used while debugging a project and Trace. |(pipe) symbol is used to filter the output with another command.both works in Debug mode. Why is catch(Exception) almost always a bad idea? Well. reducing code size etc but that is not a guarantee (at least not a significant one) . Write and Trace. Contrast OOP and SOA. gacutil. What are tenets of each Service Oriented Architecture.

Equals(b) and a == b? Answer1: a=b is used for assigning the values (rather then comparison) and a==b is for comparison. they are doing the same thing there is only sytaxtical difference. Answer6: a. a==b : means compare “b” with “a”. Answer2: a == b is used to compare the references of two objects a. while == compares value.equals(b) will check whether the “b” has same type as “a” has and also has the same data as “a” has. bool b = 0 if(a. a==b will do the same thing. What is the difference between a. if you have done this in c++ under “operator overloading” than you guys must be aware of this The Equals method returns a boolean value. If you are Java/C++ programmer better to choose C# for same coding style otherwise you can choose VB. there is no meaning of which language it was written. Once it compile and generates MSIL. a == b is a simple assignment statement. always left hand side expression evaluated . Both the languages are using same classes and namespaces. in the abstract class some methods can be concrete.Equals(b) returns false.Equals(b) is used to compare two objects Answer3: A equals b -> copies contents of b to a a == b -> checks if a is equal to b Answer4: Equals method compares both type and value of the variable. int a = 0.NET/C#. Dim a As Integer = 1 Dim b As Single = 1 a. let me explain it in different manner.Equals(b)) Answer5: a.Contrast the use of an abstract base class against an interface? Answer1: In the interface all methods must be abstract.Equals(b) checks whether the Type of a is equal to b or not! Put it in another way. In the interface no accessibility modifiers are allowed. which is ok in abstract classes Answer2: Whether to Choose VB.

bool.NET? Answer1: System. ulong. // A value type Object box = i // Boxing Unboxing is an explicit conversion from the type object to a value type int i = 123. sbyte. : Use xml Serialization if you dont want private variable to be copied.equals(b) goanna called. ushort Value types are stored in the Stack Reference type . : Use binary serialization if you want private variables to be copied.CopyTo() . thus.NET? The First Approach.Equals(b) a. interface. For reference types other than string.Equals(b): The default implementation of Equals supports reference equality only. float.strut. that is. For the string type. double. Value type .Create a new instance. ultimately a.first so here in this case “a” (considered an object) will call the overloaded operator “=” which defines “Equals(object)” method in it’s class. // Boxing int j = (int)box. // Unboxing Is string a value type or a reference type? Answer1: String is Reference Type. whether the references refer to the same object. 1. == compares the values of the strings. What is boxing? Boxing is an implicit conversion of a value type to the type object int i = 123. object. enum .class. they are different by syntaxt Answer7: Difference b/w a==b. == returns true if its two operands refer to the same object.Array.Copy the properties from source instance to newly created instance. // A value type object box = i. equality is defined as object equality. long. so the answer is: both will perform the same task. For reference types. 1. byte. chat. string Reference types are stored in the Heap . delegate. int.Deep copies an Array Answer2: How would one do a deep copy in . the equality operator (==) returns true if the values of its operands are equal. For value types. 2. [Use reflection if you want to write a common method to achive this] The Second Approach. false otherwise.a. decimal. but derived classes can override this method to support value equality. short. Serialize the object and deserialize the output. How would one do a deep copy in . uint. equality is defined as bitwise equality == : For predefined value types.

should be something like varx = DateTime.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.Net’s framework has CLS.When an ASP.when page finishes loading.Output.exe is theMicrosoft IIS server running. handling ASP.Page Where do you store the information about the user’s locale? System.UI.aspx extension).CTS and CLR.Parse(myString) the result returned by this function is not assigned to anything.NET Framework class hierarchy? System.exe.when the page is loaded into server memory.Page.Web. string and object are reference type. inetinfo.Parse(myString) NET is Compile Time OR RunTime Environment? . aspnet_isapi. How does the lifecycle of Windows services differ from Standard EXE? Windows services lifecycle is managed by “Service Control Manager” which is responsible for starting and stopping the service and the applications do not have a user interface or produce any visual output.UI. Where does the Web page belong in the . What methods are fired during the page load? Init() .the brief moment before the page is displayed to the user asHTML. but “Standard executable” doesn’t require Control Manager and is directly related to the visual output What’s wrong with a line like this? DateTime.dll andaspnet_wp.Culture . What’s the difference between Response.Answer2: Yes String is reference type. Unload() .CTS checks declartion of types at the time when u write code and CLS defines some rules and restrictions. Load() .and CLR comile everything at runtime with following benefits: Vastly simplified development Seamless integration of code written in various languages Evidence-based security with code identity Assembly-based deployment that eliminates DLL Hell Side-by-side versioning of reusable components Code reuse through implementation inheritance Automatic object lifetime management Self describing objects Describe the role of inetinfo.Web.Write()? The latter one allows you to write formattedoutput.Write() andResponse.when the pageis instantiated.the ISAPI filter aspnet_isapi.NET request is received (usually a file with .exe in the page loading process. C# gives two types of variable reference and value type.NET requests among other things.PreRender() .

So btnSubmit. allowing the main DataGrid event handler to take care of its constituents. An assembly is a collection of one or more files and one of them (DLL or EXE) contains a special metadata called Assembly Manifest. What data type does the RangeValidator control support? Integer.") A simple”Javascript:ClientCode().) is quite tedious.What’s the difference between Codebehind="MyCode.aspx. writing an event processing routine for each object (cell.cs"? CodeBehind is relevant to Visual Studio. There may be multiple namespaces in a single application code. o o o o Windows (default) Forms Passport None (Security disabled) Explain Assembly and Manifest.NET only.aspx.cs" andSrc="MyCode. What’s a bubbled event? When you have a complex control.aspx page will attach the handler (javascript function)to the onmouseover event. the Add function inside that property. Explain Namespace. The name of any given identifier must appear only once in its namespace.String and Date.” in the button control of the .NET function executed on MouseOver overa certain button.NET.Attributes.Add("onMouseOver"."someClientCode(). Where do you add an event handler? It’s the Attributesproperty. etc. Suppose you want a certain ASP. List the types of Authentication supported by ASP. The controls can bubble up their event handlers. Namespaces are logical groupings of names used within a program. row. The manifest is stored as binary data and . like DataGrid. grouped based on the identifiers’ use. button.

This is called Postback. The manifest can be viewed programmatically by making use of classes from the System. What is Shadow Copy? In order to replace a COM component on a live web server. Whenever new versions of the PEs are released.NET components are different. and list of files forming the assembly. The tool Intermediate Language Disassembler (ILDASM) can be used for this purpose. while the older version still runs the currently executing requests. What is Postback? When an action occurs (like button click). It can be launched from the command prompt or via Start> Run. An assembly is created whenever a DLL is built. o o @ Page directive @ Import directive . the page containing all the controls within the <FORM. This is not feasible for the web servers that need to be always running. This is also called sideby-side component versioning. By bleeding out the older version. They will be used to process all new requests not currently executing. Enumerate the types of Directives.Reflection namespace. they are automatically detected by the CLR and the changed components will be automatically loaded. copy the new files and then restart the website. > tag performs an HTTP POST. the author. .. It prevents the Portable Executable (PE) files like DLLs and EXEs from being locked.contains details like versioning requirements for the assembly. They can be overwritten at any time using a mechanism called Shadow Copy. while having itself as the target URL. . security permissions.. it was necessary to stop the entire website. the update is completed What is DLL Hell? DLL hell is the problem that occurs when an installation of a newer application might break or hinder other applications as newer DLLs are copied into the system and the older applications do not support or are not compatible with them.NET overcomes this problem by supporting multiple versions of an assembly at any given time.

Redirect? o Response. The browser then initiates another request to the new page loading its contents in the browser.Transfer and Response. .Mode What is the difference between Server. some methods can be defined. What is an interface and what is an abstract class? In an interface. This results in two requests by the browser. As far as the browser client is concerned. whereas it is allowed in abstract classes. In an abstract class.NET. no accessibility modifiers are allowed.Redirect: This tells the browser that the requested page can be found at a new location. all methods must be abstract (must not be defined). In an interface. The DataGrid control in ASP. ASP. The AllowPaging property of the DataGrid can be set to True to perform paging. based on the property that has been set for PagerStyle.o o o o o @ Implements directive @ Register directive @ Assembly directive @ OutputCache directive @ Reference directive Describe Paging in ASP.NET enables easy paging of the data. it made one request and the initial page is the one responding with content. o Server. Also. any posted form variables and query string parameters are available to the second page as well. The benefit of this approach is one less round trip to the server from the client browser.NET automatically performs paging and provides the hyperlinks to the other pages in different styles.Transfer: It transfers execution from the first page to the second page on the server.

Hence session state is used.NET’s built-in parsers are used to remove code from ASPX files and create temporary files. The alternative for view state is session state.Though the view state data is encoded and may be encrypted.NET will automatically load the DLL when the type is referenced.NET\Framework\v1. Thus.0. using view state is not feasible. o Problems in serializing of objects into view state . Therefore mixing of languages in a single ASPX file is not possible. session state is a more secure option.nnnn\Temporary ASP.config. Can two different programming languages be mixed in a single ASPX file? ASP.NET data type be used in a Web form? This can be achieved by placing the DLL containing the custom data type in the application root's bin directory and ASP.Session state vs. Session state is employed under the following situations: o Large amounts of data .NET Files). The code is stored in a CS or VB file (usually in the \%SystemRoot %\Microsoft. Can a custom . the generated code can be viewed. Other types like DataSet are slower and can generate a very large view state. View state: In some cases. Is it possible to see the code that ASP.NET generates from an ASPX file? By enabling debugging using a <%@ Page Debug="true" %> directive in the ASPX file or a <compilation debug="true"> statement in Web.View state is efficient for a small set of data.View state tends to increase the size of both the HTML page sent to the browser and the size of form posted back.asax? o Application start and end event handlers . Each parser understands only one language. it is better and secure if no sensitive data is sent to the client. o Secure data . List the event handlers that can be included in Global.

WebControls. Other namespaces must be imported manually using @ Import directives.config.config file. Another way is to include the <pages enableViewStateMac="true" /> statement in the Web. Do Web controls support Cascading Style Sheets? All Web controls inherit a property named CssClass from the base class System.o o o Session start and end event handlers Per-request event handlers Non-deterministic event handlers Can the view state be protected from tampering? This can be achieved by including an @ Page directive with an EnableViewStateMac="true" attribute in each ASPX file that has to be protected.Specialized . Can the view state be encrypted? The view state can be encrypted by setting EnableViewStateMac to true and either modifying the <machineKey> element in Machine.Web.config to <machineKey validation="3DES” /> or by adding the above statement to Web.WebControl which can be used to control the properties of the web control. What namespaces are imported by default in ASPX files? The following namespaces are imported by default. When during the page processing cycle is ViewState available? The view state is available after the Init() and before the Render() methods are called during Page load.Collections.Collections System.UI. o o o System System.

Context.NET Framework Class Library's System.Text System.RegularExpressions System. A client who requests a VSDISCO file gets back what appears to be a static DISCO document. Server.Web.Web.Web.o o o o o o o o o o System.HtmlControls System. How can files be uploaded to Web pages in ASP. Why do some web service classes derive from System.NET? .NET application? The classes MailMessage and SmtpMail have to be used to send email from an ASP.Web.UI System. If it does not use these objects. and User have to derive from System.Web System.Web.Web.Text.Configuration System.Web.Security System.SessionState System. MailMessage and SmtpMail are classes defined in the . What are VSDISCO files? VSDISCO files are DISCO files that enable dynamic discovery of Web Services. ASP.Mail namespace.UI.Web.Caching System.WebServices while others do not? Those Web Service classes which employ objects like Application.NET application.UI. Session.WebControls What classes are needed to send e-mail from an ASP.NET links the VSDISCO to a HTTP handler that scans the host directory and subdirectories for ASMX and DISCO files and returns a dynamically generated DISCO document.Web. it is not necessary to be derived from it.WebServices.

How can the focus be set to a specific control when a Web form loads? This can be achieved by using client-side script: document. How do I create an ASPX page that periodically refreshes itself? The following META tag can be used as a trigger to automatically refresh the page every n seconds: <meta http-equiv="Refresh" content="nn"> How do I initialize a TextBox whose TextMode is "password".TextBox1. This can then be sent to the server. <asp:TextBox Value="imbatman" TextMode="Password" ID="Password" RunAt="server" /> Why does the control's PostedFile property always show null when using HtmlInputFile control to upload files to a Web server? This occurs when an enctype="multipart/form-data" attribute is missing in the <form> tag. with a password? The TextBox’s Text property cannot be used to assign a value to a password field. its Value field can be used for that purpose.UI. Instead. If there are none.Page's IsPostBack property work? IsPostBack checks to see whether the HTTP request is accompanied by postback data containing a __VIEWSTATE or __EVENTTARGET parameter. Then.focus () The above code will set the focus to a TextBox named TextBox1 when the page loads.Web.This can be done by using the HtmlInputFile class to declare an instance of an <input type="file" runat="server"/> tag. a byte[] can be declared to read in the data from the input file. then it is not a postback. What is WSDL? .forms[0]. How does System.

google.NET Web service from a WSDL? The It is like an "Yellow Pages" for Web What is UDDI? UDDI stands for Universal Description. Example: wsdl /server http://api. The default size is 4 MB.w3. Inline code is written along side the HTML in a page. Why do uploads fail while using an ASP. This can be changed by modifying the maxRequestLength attribute of Machine. IBM. Discovery.NET file upload control to upload large files? ASP. Describe the difference between inline and code behind. The UDDI can be queried for specific Web Services.exe tool (.NET web service with its WSDL link. Is it possible to generate the source code for an ASP. Code-behind is code written in a separate file and referenced by the . The operations and messages are described abstractly. and Integration. and Ariba. Related concrete endpoints are combined into abstract endpoints (services).aspx page. It is maintained by Microsoft. and is designed to provide detailed information regarding registered Web Services for all vendors.NET Framework SDK) can be used to generate source code for an ASP.config's <httpRuntime> element. Differences Between XML and HTML? Anyone with a fundamental grasp of XML should be able describe some of the main differences outlined in the table below XML User definable tags Content driven HTML Defined set of tags designed for web display Format driven .NET limits the size of file uploads for security purposes.wsdl. and then bound to a concrete network protocol and message format to define an endpoint.WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. (Source: www.

or navigation bar. such as a page header. in a common location called a "master page". to be shared by many pages in your site.End tags required for well formed documents Quotes required around attributes values Slash required in empty tags What are Master Pages? End tags not required Quotes not required Slash not required This feature provides the ability to define common structure and interface elements for your site. and much of functionality for an entire Web site. This improves the maintainability of your site and avoids unnecessary duplication of code for shared site structure or behavior . footer. feel. In one simple place you can control the look.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.