Professional Documents
Culture Documents
Answer - It is a primary unit of deployment in a Microsoft .NET Framework application. It is called as building block of an application which provides all required execution information to common language runtime. An assembly perform following functions: It contains IL code that gets executed by common language runtime. It forms a security boundary. An assembly is the unit at which permissions are requested and granted. It ensures type safety by establishing name scope for types at the runtime. It contains version information. It allows side-by-side execution of multiple versions of same assembly. Assemblies can be static or dynamic. Static assemblies are created when the program is compiled using .Net compiler. It exists as PE file either in .exe or .dll. However, dynamic assemblies are created at runtime and run from the memory without getting saved on the disk.
The hash checks if the assembly is tempered since it is created. The key pair that defines the strong name is created using the Strong Name utility, Sn.exe. To sign an assembly with a strong name Create Key pair using the Strong Name utility, Sn.exe. Open the AssemblyInfo file of your project. Use the AssemblyKeyFileAttribute to specify the path to the key file for your project. Build your assembly. The strong name will be generated and signed to the assembly.
It provides a CLR environment. It helps in maintaining security as it grants grant or denial of permissions. When an application starts only assemblies the application initially calls must be present. Assemblies can be either static or dynamic. Assemblies help in resolving versioning issues.
Web services are built on XML standard and use SOAP protocol that allows them to communicate across different platforms and programming languages. Web services easily manage to work across corporate firewalls as they use HTTP protocol which is firewall friendly. Web services platform elements are SOAP (Simple Object Access Protocol) UDDI (Universal Description, Discovery and Integration) WSDL (Web Services Description Language) The web services are built on internet standards that are not platform or language specific. The .Net framework provides in-built classes to build and consume web services. The components offered by web services are reusable. The examples of web service components can be shipment tracking, translation utility, weather forecasting, sports scores etc.
What is SOAP?
SOAP, Simple Object Access Protocol is a communication protocol, a way to structure data before transmitting it, is based on XML standard. It is developed to allow communication between applications of different platforms and programming languages via internet. It can use range of protocols such as HTTP, FTP, SMTP, Post office protocal 3(POP3) to carry documents. Http-Get, Http-Post works with name/value pair which means transferring complex object is not possible with these protocols, whereas SOAP serializes complex structure, such as ASP.NET DataSets, complex arrays, custom types and XML nodes before transmitting and thus allows exchange of complex objects between applications. Two components can easily communicate using Remote Procedure Calls protocol. But because of their compatibility and security issues, most of firewalls and proxy server block this type of messages. SOAP uses HTTP channel to transport which makes it widely accepted protocal over the internet.
What is WSDL?
WSDL stands for Web Ser vices Description Language, an XML-based language that describes Web services and how to access and locate them.
What is UDDI?
UDDI stands for Universal Description, Discovery and Integration. It is an open, Internet-based specification that offers directory service for storing information about web services.
Describe the Components that help locate and consume XML Web Service.
Directories This is the place to store published information about the Web Services. The UDDI specifications define guidelines for publishing information about the Web Services. Microsoft provides directory service which is located at http://uddi.microsoft.com. Discovery Using Discovery process, the client can know the location of Web Service. Client can locate documents that describe Web Service using WSDL. Description This component allows client know what operations to perform on an XML Web service. Wire Formats XML Web Service uses Wire Formats protocol to enable heterogeneous applications to interoperate. This protocol can be understood by any system who knows standard protocol like HTTP and SOAP.
which gets serialized and send over network. The message then received by client infrastucture, deserializes it and sends to the proxy object. The proxy object returns the value to the client application.
The browser is directly redirected to another page There is no round trip A Server transfer is possible within a website Information can be preserved in Server transfer through a parameter called preserveForm
response.Redirect
The browser is requested to redirect to some other page through a message. There is a round trip. Response redirect is possible within two websites too. A state can be maintained in Response redirect but has a lot of drawbacks
Passport Authentication provider: It is a centralized authentication service provided by Microsoft that offers a single login and core profile service for member sites.
b. Form Authentication: Its a custom security based on roles and user accounts created specifically for an application. c. Passport Authentication: This is based on hotmail passport account.
Windows authentication.
If windows authentication mode is selected for an ASP.NET application, then authentication also needs to be configured within IIS since it is provided by IIS. IIS provides a choice for four different authentication methods: Anonymous: IIS doesnt perform any authentication. All are allowed to access the ASP.NET application. Basic: users must provide a windows username and password to connect. This information is plain text which makes this mode insecure. Digest: Users need to provide a password which is sent over the network. However in this case the password is hashed. It also requires that all users be using IE 5 or later versions. Windows integrated: passwords are not sent over the network. The application uses either the Kerberos or challenge/response protocols authenticate the user. Users need to be running IE 3.01 or later.
Passport authentication
Passport authentication provides authentication using Microsofts passport service. If passport authentication is configured and users login using passport then the authentication duties are off-loaded to the passport servers. Passport uses an encrypted cookie mechanism to indicate authenticated users. The passport users are considered authenticated while the rest are redirected to the passport servers to log in, after which they are redirected back to the site. Passport Software Development Kit can be downloaded and installed http:// msdn.microsoft.com/library/default.asp?url=/downloads/list/websrvpass.aps.
Forms authentication
Using form authentication, ones own custom logic can be used for authentication. ASP.NET checks for the presence of a special session cookie when a user requests a page for the application. Authentication is assumed if the cookie is present else the user is redirected to a web form.
Answer - Localization is the process of adapting a software application for a specific locale. Globalization is the process of identifying the localizable resources of the application. You can provide support for Localization and
Globalization to the application using System.Globalization, System.Resources and System.Threading namespaces. The developer can define culture specific information using the System.Globalization namespace. The System.Resources namespace contains ResourceManager class that allows access to resources either from the main assembly or from the Satellite Assemblies. The System.Threading namespace supports for multithreaded programming. A web form has two culture values, Culture and UICulture. Culture value is used for date and number formatting and UICulture values are used to determine culture specific resources. You can set culture and UICulture values in the application as follows. Using <globalization> element of Web.Config. Using @Page directive in the Page. In Code-Behind Page e.g. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture ("en-GB"); Thread.CurrentThread.CurrentUICulture=new CultureInfo("en-GB");
Answer - You can follow many approaches to have globalized application. You can create separate web application for each culture. You can create an application that can detect the users culture and adjusts output at run time using format specifiers and other tools. You can store culture-dependent strings in resource files that are compiled into satellite assemblies.
Question - Implementing ASP.NET Globalization.
Answer - Create resource files and compile them into a binary resource file. Create satellite assembly for each of the resource file for each culture. Store them in separate folders for easy access and replacement. Read the resources from the satellite assembly that is stored in different folders based on the locale and culture.
Question - Define Resource Files and Satellite Assemblies.
Answer - Resource Files: A resource file contains non-executable data that are used by the application and deployed along with it. Bitmaps, Icons etc are the examples of resource files. In ASP.NET, resource files are used to make application to support multiple cultures. You can create resource files each of them correspond to specific locale or culture of the application. You can use resgen utility to compile resource file into an assembly. You can create a satellite assembly from a compiled resource file using the AL utility provided with Microsoft .NET SDK. Advantages of resource files are as follows. It supports Globalization features in ASP.NET. You can have culture based information separate from the content and logic of the application. You can change resource content without effecting application's code. Satellite Assemblies Satellite Assemblies are the special kinds of assemblies that exist as DLL and contain culture-specific resources in a binary format. They store compiled localized application resources. They can be created using the AL utility and can be deployed even after deployment of the application. Satellite Assemblies encapsulate resources into binary format and thus make resources lighter and consume lesser space on the disk.
Note: Resource-only assemblies can contain any resource, such as images and text. Satellite assemblies contain only culture-specific resources.
Caching is defined as temporary storage of data for faster retrieval on subsequent requests. In ASP .NET 2.0, the caching support is integrated with the DataSource controls to cache data in a web page.
Answer - Caching technique allows to store/cache page output or application data on the client. The cached information is used to serve subsequent requests that avoid the overhead of recreating the same information. This enhances performance when same information is requested many times by the user.
Question - Advantages of Caching
Answer - It increases performance of the application by serving user with cached output. It decreases server round trips for fetching data from database by persisting data in the memory. It greatly reduces overhead from server resources.
Question - What are the types of Caching in ASP.NET?
Answer - Caching in ASP.NET can be of the following types Page Output Caching Page Fragment Caching Data Caching
Question - Explain in brief each kind of caching in ASP.NET.
Answer - Page Output Caching This type of caching is implemented by placing OutputCache directive at the top of the .aspx page at design time. For example: <%@OutputCache Duration= "30" VaryByParam= "DepartmentId"%> The duration parameter specifies for how long the page would be in cache and the VaryByParam parameter is used to cache different version of the page. The VaryByParam parameter is useful when we require caching a page based on certain criteria. Page Fragment Caching This technique is used to store part of a Web form response in memory by caching a user control. Data Caching Data Caching is implemented by using Cache object to store and quick retrieval of application data. Cache object is just like application object which can be access anywhere in the application. The lifetime of the cache is equivalent to the lifetime of the application.
Question - Define Exception handling in ASP.NET.
Answer - Exceptions or errors are unusual occurrences that happen within the logic of an application. The CLR has provided structured way to deal with exceptions using Try/Catch block. ASP.NET also supports exception handling through server events such as Page_Error and Application_Error events.
Question - What are the ways of handling exceptions in ASP.NET?
Answer - There are three ways to handle exceptions in ASP.NET Try/catch/finally block. Using Events like Page_Error and Application_Error Using Custom error page
Question - Explain Try/catch block of exception handling.
Answer - You can enclose code in Try/Catch/Finally block. You can catch all exceptions in the catch block. The third part of this block is finally. It is executed irrespective of the fact that an exception has been raised.
Question - Define Error Events.
Answer - ASP.NET supports events that occur when any unhandled exception occurs in an application. These events are called as Error Events. ASP.NET provides two such events to handle exceptions
Page_Error : This is page event and is raised when any unhandled exception occur in the page. Application_Error: This is application event and is raised for all unhandled exceptions in the ASP.NET application and is implemented in global.asax
Specify application-wide error page settings in the customErrors section of the Web.config file. Specify an error page for a specific Web form in the ErrorPage attribute of the Web forms @ Page directive
Answer - A Master page offers a template for one or more web forms. It defines placeholders for the content, which can be overridden by the content pages. The content pages contains only content. When users request the content page, ASP.NET merges the layout of the master page with the content of the content page and produce output.
Question - Advantages of using Master Page in ASP.NET
Answer - Master pages enables consistent and standardized layout to the website. You can make layout changes of the site in the master page instead of making change in the pages. It is very easy to implement.
Question - Define Multiple Master Page.
Answer - In ASP.NET, you can have multiple master pages each for a different purpose. You can provide users several layout options using Multiple Master Page. You can define Master Page at multiple places in the web application. You can specify page-level using the @Page dierective. You can specify using the Web.config. Remember that the definition closest to the user wins that means page-level definition supersedes site-level definition.
Question - How do you create Master Page?
Answer - Steps to create Master Page Right-click your web project in the Solution Explorer window Select Add New Item. Select the Master Page item type from the Add New Item dialog. Following is an example of Master Page and a Content Page. <%@ Master %> <html> <body> <Title>Title of the Pages</Title> <asp:ContentPlaceHolder id="Content1" runat="server"> </asp:ContentPlaceHolder> </body> </html> This is simple HTML page that serves template for other pages. The @ Master directive at the top of the page defines that the page is Master Page. A placeholder tag <asp:ContentPlaceHolder> is overridden by the content page to place the content. You can have many placeholders tag each of them with different id. Content Page Example %@ Page MasterPageFile="master1.master" %> <asp:Content ContentPlaceHolderId="Content1" runat="server"> <h1>ASP Interview Questions</h1> </asp:Content> When you request this page, ASP.NET merges layout specified in the Master Page and content of content page to produce page result.
Question - Define Session, SessionId and Session State in ASP.NET.
Answer - A session is the duration of connectivity between a client and a server application.
SessionId is used to identify request from the browser. By default, value of SessionId is stored in a cookie. You can configure the application to store SessionId in the URL for a "cookieless" session.
Question - What is Session Identifier?
Answer - Session Identifier is used to identify session. It has SessionID property. When a page is requested, browser sends a cookie with a session identifier. This identifier is used by the web server to determine if it belongs to an existing session. If not, a Session ID (120 - bit string) is generated by the web server and sent along with the response.
Question - Advantages and disadvantages of using Session State.
Answer - The advantages of using session state are as follows: It is easy to implement. It ensures data durability, since session state retains data even if ASP.NET work process restarts as data in Session State is stored in other process space. It works in the multi-process configuration, thus ensures platform scalability. The disadvantages of using session state are: Since data in session state is stored in server memory, it is not advisable to use session state when working with large sum of data. Session state variable stays in memory until you destroy it, so too many variables in the memory effect performance.
Question - What are the Session State Modes? Define each Session State mode supported by ASP.NET.
InProc Mode This mode stores the session data in the ASP.NET worker process. This is the fastest among all of the storage modes. This mode effects performance if the amount of data to be stored is large. If ASP.NET worker process recycles or application domain restarts, the session state will be lost. State Server mode In this mode, the session state is serialized and stored in memory in a separate process. State Server can be maintained on a different system. State Server mode involves overhead since it requires serialization and de-serialization of objects. State Server mode is slower than InProc mode as this stores data in an external process. SQL Server Mode In this storage mode, the Session data is serialized and stored in a database table in the SQL Server database. This is reliable and secures storage of a session state. This mode can be used in the web farms. It involves overhead in serialization and de-serialization of the objects. SQL Server is more secure than the InProc or the State server mode.
Explain how to access ViewState value of this page in the next page.
PreviousPage property is set to the page property of the nest page to access the viewstate value of the page in the next page. Page poster = this.PreviousPage; Once that is done, a control can be found from the previous page and its state can be read. Label posterLabel = poster.findControl("myLabel"); string lbl = posterLabel.Text;
Both Class and Structures can have methods, variables and objects. Both can have constructor. Both are user defined types.
Differences:
Structure being value type, the variables cannot be assigned to NULL. On the other hand, classes being reference type, a class variable can be assigned to NULL. Structure is allocated on a stack when instantiated, while Class is allocated on a heap. When a method is passed to a class, pass by reference is used. Pass by value is used for struts. A class can have a destructor.
Garbage collection for managing life of objects. Enables Cross language inheritance as explained in example above. Syntax and keywords similar to C and C++
Any language(s) that intend to use the Common Language Infrastructure needs to communicate with other CLS-Compliant language. This communication is based on set of rules laid by CLS. These rules define a subset of CTS.
What is connection pooling and what is the maximum Pool Size in ADO.NET Connection String?
A connection pool is created when a connection is opened the first time. The next time a connection is opened, the connection string is matched and if found exactly equal, the connection pooling would work. Otherwise, a new connection is opened, and connection pooling won't be used. Maximum pool size is the maximum number of connection objects to be pooled. If the maximum pool size is reached, then the requests are queued until some connections are released back to the pool. It is therefore advisable to close the connection once done with it. Connection pooling in ADO.NET - June 06, 2009 at 10:30 AM by Shuchi Gauri
What is connection pooling and what is the maximum Pool Size in ADO.NET Connection String?
Connection pooling is a method of reusing the active database connections instead of creating new ones every time the user request one. Connection pool manager keeps track of all the open connections. When a new request comes in, the pool manager checks if there exists any unused connections and returns one if available. If all connections are busy and the maximum pool size has not been reached, a new connection is formed and added to the pool. And if the max pool size is reached, then the requests gets queued up until a connection in the pool becomes available or the connection attempt times out. Connection pooling behavior is controlled by the connection string parameters. The following are four parameters that control most of the connection pooling behavior: Default max pool size is 100.