LATEST DOT NET INTERVIEW QUESTIONSWhat are Design Patterns?A Design Pattern essentially consists of a problem in a software design and a solution to the same. InDesign Patterns each pattern is described with its name, the motivation behind the pattern and itsapplicability.According to MSDN, "A design pattern is a description of a set of interacting classes that provide aframework for a solution to a generalized problem in a specific context or environment. In other words, apattern suggests a solution to a particular problem or issue in object-oriented software development.Benefits of Design PatternsThe following are some of the major advantages of using Design Patterns in software development.· Flexibility · Adaptability to change · ReusabilityWhen to use Design PatternsDesign Patterns are particularly useful in one of the following scenarios.· When the software application would change in due course of time.· When the application contains source code that involves object creation and event notification.When not to use Design Patterns. Do not use design patterns in any of the following situations.· When the software being designed would not change with time.· When the requirements of the source code of the application are unique.If any of the above applies in the current software design, there is no need to apply design patterns in thecurrent design and increase unnecessary complexity in the design.The Gang of Four (GOF) PatternsThe invention of the design patterns that we commonly use today can be attributed to the following fourpersons: Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. These men invented 23 patterns inall that are commonly known as the Gang of Four patterns or the GOF patterns.· Creational · Structural · BehavioralEach of these groups in turn contains related sub patterns.Creational PatternsThe Creational Patterns deals with the best possible way of creating an object or an instance of a class.They simplify object creation and provide a flexible approach towards object creation. The following are thesub-patterns that fall under this group.· Abstract Factory · Factory · Builder · Prototype · SingletonBoth the Abstract Factory and the Factory pattern have the same intent.
The Singleton Pattern indicates that there can be only one instance of a class throughout the Application’slife cycle. A singleton class is one that can be instantiated only once in the application domain and providesa global point of access to it.Structural PatternsStructural Patterns provides the flexibility to specify how objects and classes can interoperate. The followingare the sub patterns that comprise the Structural Patterns group.· Adapter · Façade · Bridge · Composite· Decorator · Flyweight · Proxy · Adapter· Bridge · Composite · Decorator · Flyweight· ProxyBehavioral PatternsBehavioral patterns help you define a structure for inter-object communication between objects in yoursystem. This design pattern is typically used to monitor the messages that are transmitted when the objectscommunicate in a system. The following are the sub patterns under Behavioral Patterns.· Chain of Responsibility · Command · Interpreter · Iterator· Mediator · Memento · Observer · State· Strategy · Template Method · VisitorASP.NET MVC is a framework that allows developers to apply the MVC pattern in the development of anASP.NET application, thus allowing a better separation of concerns, which results in better reusability andeasier testing.MVC consists of three kinds of objectsThe Model is an application object.The View is the screen presentation.The controller defines the way the user interface reacts to user inputs• The request comes from the client and hits the Controller.• The Controller calls the Model in order to perform some "business" operations. • The Model returns the results of the operations back to the Controller. • The Controller decides which View needs to be rendered and sends it the data that must be rendered. • Finally the View renders the output and sends the response back to the client.What is Cryptography?Cryptography is used to protect data and has many valuable uses. It can protect data from being viewed,modified, or to ensure the integrity from the originator. Cryptography can be used as a mechanism toprovide secure communication over an unsecured network, such as the Internet, by encrypting data, sendingit across the network in the encrypted state, and then the decrypting the data on the receiving end.Encryption can also be used as an additional security mechanism to further protect data such as passwordsstored in a database to prevent them from being human readable or understandable.Encryption Components
Encryption involves the use of a cryptography algorithm combined with a key to encrypt and decrypt thedata. The goal of every encryption algorithm is to make it as difficult as possible to decrypt the data withoutthe proper key. Data is translated from its originating form into something that appears meaningless unlessthe proper algorithm and key are used to decrypt the data.The Microsoft .NET Framework classes (System.Security.Cryptography) will manage the details ofcryptography for you. The classes are implemented with the same interface; so working with the classes isthe same across the cryptography namespace.Public-Key EncryptionPublic-key encryption, also known as asymmetric encryption, uses a public and private key pair to encryptand decrypt data. The public key is made available to anyone and is used to encrypt data to be sent to theowner of the private key. The private key, as the name implies, is kept private. The private key is used todecrypt the data and will only work if the correct public key was used when encrypting the data. The privatekey is the only key that will allow data encrypted with the public key to be decrypted. The keys can bestored for use multiple times, or generated for a one-time use.Asymmetric encryption algorithms are usually efficient for encrypting small amounts of data only. Thefollowing public-key algorithms are available for use in the .NET Framework.Digital Signature Algorithm (DSA)RSAPrivate-Key EncryptionPrivate-key Encryption, also known as symmetric encryption, uses a single key to encrypt and decryptinformation. The key must be kept secret from those not authorized to decrypt the data lest the data becompromised. Private-key algorithms are relatively fast and can be used to encrypt and decrypt largestreams of data. Private-key algorithms are known as block ciphers because they encrypt data one block at atime. A block cipher will encrypt the same input block into the same output block based on the algorithm andkey. If the anything were known about the structure of the data, patterns could be detected and the keycould possibly be reverse engineered. To combat this, the classes in the .NET Framework use a processknown as chaining where information from the previous block is used in encrypting the current block. Thishelps prevent the key from being discovered. It requires an initialization vector (IV) be given to encrypt thefirst block of data.The following private-key algorithms are available in the .NET Framework. Each description contains somebasic information about each algorithm, including the strengths and weaknesses.Data Encryption Standard (DES) algorithm encrypts and decrypts data in 64-bit blocks, using a 64-bit key.Even though the key is 64-bit, the effective key strength is only 56-bits. There are hardware devicesadvanced enough that they can search all possible DES keys in a reasonable amount of time. This makes theDES algorithm breakable, and the algorithm is considered somewhat obsolete.RC2 is a variable key-size block cipher. The key size can vary from 8-bit up to 64-bits for the key. It wasspecifically designed as a more secure replacement to DES. The processing speed is two to three timesfaster than DES. However, the RC2CryptoServiceProvider available in the .NET Framework is limited to 8characters, or a 64-bit key. The 8-character limitation makes it susceptible to the same brute force attack asDES.TripleDES algorithm uses three successive iterations of the DES algorithm. The algorithm uses either two orthree keys. Just as the DES algorithm, the key size is 64-bit per key with an effective key strength of 56-bitper key. The TripleDES algorithm was designed to fix the shortcomings of the DES algorithm, but the threeiterations result in a processing speed three times slower than DES alone.Rijndael algorithm, one of the Advanced Encryption Standard (AES) algorithms, was designed as areplacement for the DES algorithms. The key strength is stronger than DES, and was designed to out
perform DES. The key can vary in length from 128, 192, to 256 bits in length. This is the algorithm Ipersonally trust the most and that Ill use for the examples contained in the column.Hashing AlgorithmsNo, Im not talking about some type of drug related activity or an extra special recipe for brownies. Hashingrefers to mapping data of any length into a fixed-length byte sequence. Regardless of if the input is thecontents of the library of Congress or the typing test "The quick brown fox jumps over the lazy dog" it willresult in an output of the same size. Hashing also produces unique results. Just as no two snowflakes areidentical, no two combinations of input will produce the same hash output. Even if the input varies by asingle character it will produce different output. The .NET Framework provides support for the following hashalgorithms of which Ill leave it up to you to discover which one is right for you based on the size of the datayou require.HMACSHA1 MACTripleDES MD5CryptoServiceProvider SHA1ManagedSHA256Managed SHA384Managed SHA512ManagedHow to Generate a Key and IV for Private-key EncryptionEach algorithm has specific key sizes that it expects for use. Each key must fit a predetermined size typicallyranging from 1 character (8-bit) up to 32 characters (256-bit). Some of the algorithms support varying keysizes, but they must be within the valid ranges of key size for the particular algorithm. For our purposes,well use Rijndael, which supports 128, 192, and 256 bit keys. The way to generate a 128-bit key for use isthrough one of the hashing algorithms. A phrase, or "secret" of any length can be hashed to generate a keyof the required size for encrypting data. The following code outlines a class containing a method that takesan input phrase and generates a key and IV for use.Using Encryption to Protect Sensitive Data Stored in a DatabaseThis brings us to a possible and often overlooked use for encryption, which is encrypting data such aspasswords that are stored in a database. There are several benefits to storing sensitive data such aspasswords in encrypted format.It keeps sensitive application data such as passwords secret from those authorized to view data that ideallyshould not be able to see application specific data such as passwords.It keeps passwords protected from unauthorized access. If the database is somehow compromised, theintruder must now the correct algorithm and key to decrypt the sensitive data.Passing direct input to a query is dangerous because you never know what the input may contain. Suppose astored procedure including something like "WHERE vc_Login = @Login and Password = @Password" is usedfor authentication. A user name of "m or 1=1" with the same for the password could evaluate to a truestatement and result in incorrectly allowing access. If the user id and or password were stored encryptedthen the data would not evaluate to a valid SQL statement because an encrypted form of the statementwould be used in the evaluation.22 New Features of Visual Studio 2008 for .NET Professionals1. LINQ SupportLINQ essentially is the composition of many standard query operators that allow you to work with data in amore intuitive way regardless.The benefits of using LINQ are significant – Compile time checking C# language queries, and the ability todebug step by step through queries.2. Expression Blend Support
XCOPY DeploymentUsing the Copy Project option in VS .NETDeployment using VS.NET installerXCOPY DeploymentBefore looking at how .NET enables XCOPY deployment, let us take a moment to understand what XCOPYdeployment is. Prior to .NET, installing a component (for example, a COM Component) required copying thecomponent to appropriate directories, making appropriate registry entries, and so on. But now in .NET, toinstall the component all you need to do is copy the assembly into the bin directory of the client applicationand the application can start using it right away because of the self-describing nature of the assembly. Thisis possible because compilers in the .NET Framework embed identifiers or meta-data into compiled modulesand the CLR uses this information to load the appropriate version of the assemblies. The identifiers containall the information required to load and run modules, and also to locate all the other modules referenced bythe assembly. It is also refered to as zero-impact install since the machine is not impacted by way ofconfiguring the registry entries and configuring the component. This zero-impact install also makes itpossible to uninstall a component without impacting the system in any manner. All that is required tocomplete uninstallation is the removal of specific files from the specific directory. For performing this type ofdeployment, all you need to do is to go to the Command Prompt and copy over the required files to aspecific directory on the server using the XCOPY command.As you can see, the XCOPY command takes a number of arguments./ E - This option copies directories, subdirectories, and files of the source argument, including empty ones./ K - This option allows you to retain all the existing file and folder attributes. When you use XCOPY to copyfiles or a directory tree structure, XCOPY strips off file attributes by default. For example, if a file had theread-only attribute set, that attribute would be lost after the file is copied. To retain the original attributeswith the copied files, you must use the / K parameter./ R - This option overwrites files marked as read only./ O - This option preserves all security-related permission ACLs of the file and folders./ H - This option copies both hidden and system files./ I - This option tells XCOPY to assume that the destination is a directory and create it if it does not alreadyexist.Once the folder is copied over to the target server, you then need to create a virtual directory on the targetserver (using Internet Information Manager MMC snap-in) and map that virtual directory to the physicaldirectory that is created using the XCOPY command. Thats all there is to deploying an ASP.NET Webapplication on a remote server using XCOPY Deployment.Using the Copy Project Option in VS .NETThe Copy Project option in VS .NET makes it very easy to deploy ASP.NET Web applications onto the targetservers. Using this option, you can copy the Web project to the same server or to a different server.If you are using VS .NET to develop Web applicatons, the first thing that you need to do before packaging anASP.NET Web applications is to change the Active Solution Configuration from Debug to Release as shownbelow. This allows the compiler not only to optimize the code but also remove the debugging relatedsymbols from the code, making the code run much faster. To bring up the Configuration Manager, selectyour Web project from the Solution Explorer and select Project->Properties->Configuration Properties fromthe menu and then click on the Configuration Manager Command button. In the Active SolutionConfiguration combo box, select the Release option.To copy the Web project onto the target server, select Project->Copy Project from the menu. Selecting thatoption will result in the following dialog box being displayed.The Copy Project dialog provides the following options.Destination Project Folder: Using this option, you can specify the location to which you want to copy theproject. The location can be the same server or a remote server.Web access method: The Web access method option determines the access method that is used to copy theWeb project to the destination folder. There are two types of Web access methods.File share: This option indicates that you want to directly access your project files on the Web server througha file share. It does not require FrontPage Server Extensions on the server.
FrontPage: This option specifies that you want to use the HTTP-based FrontPage Server Extensions totransfer your project files to the server. Before using this option, make sure FrontPage Server Extensions areinstalled on the server. This option will automatically create the required virtual directory on the targetserver.Copy: The Copy option provides three types:Only files needed to run this application: this option copies built output files (DLLs and references from thebin folder) and any content files (such as .aspx, .asmx files). Most of the time, you should be able to deploythe application using this default option.All project files: this option copies built outputs (DLLs and references from the bin folder) and all files thatare in the project. This includes the project file and source files.All Files in the source project folder: choosing this option will result in all the project files and any other filesthat are in the project folder (or subfolder) being transferred to the destination folder.To copy the Web project, select the appropriate options from the above Copy Project dialog box and clickOK. This will result in the ASP.NET Web application being deployed on the target server.Deployment Using VS .NET Web Setup ProjectEven though XCOPY deployment and Copy Project options are very simple and easy-to-use, they do not lendthemselves well to all of the deployment needs. For example, if your application requires more robustapplication setup and deployment requirements, VS .NET installer can be the right choice. Although you candistribute your Web application as a collection of build outputs, installer classes, and database creationscripts, it is often easier to deploy complex solutions with Windows Installer files. VS .NET provides Websetup projects that can be used to deploy Web applications. These Web setup projects differ from standardsetup projects in that they install Web applications to a virtual root folder on a Web server rather than in theProgram Files folder, as is the case with the applications installed using standard setup projects.Since VS .NET installer is built on top of Windows Installer technology, it also takes advantages of WindowsInstaller features. Before starting on a discussion of VS .NET Web Setup Project, let us understand thearchitecture of Windows Installer technology that provides the core foundation on top of which the VS .NETinstaller is built.Features Provided by VS .NET Web Setup ProjectThe deployment project in VS .NET builds on features of the Windows installer by allowing us to perform thefollowing operations.Reading or writing of registry keysCreating directories in the Windows file system on the target serversProvides a mechanism to register componentsProvides a way to gather information from the users during installationAllows you to set launch conditions, such as checking the user name, computer name, current operatingsystem, software application installed, presence of .NET CLR and so on.Also makes it possible to run a custom setup program or script after the installation is complete.In the next section, we will see how to deploy our DeploymentExampleWebApp using the VS .NET WebSetup Project.Creating a Web Setup Project Using VS .NET InstallerWe will start by adding a new Web Setup Project to our DeploymentExampleWebApp ASP.NET Webapplication solution by selecting File->Add Project-> New Project from the menu. In the New Project dialogbox, select Setup and Deployment Projects from the Project Types pane and then select Web Setup Projectin the Templates pane as shown in the following figure.After creating the project, you then need to add the output of the primary assembly and the content files ofthe ASP.NET Web application to the setup project. To do this, right click on theDeploymentExampleWebAppSetup project in the solution explorer and select Add->Project Output from thecontext menu. In the Add Project Output Group dialog box, select DeploymentExampleWebApp from theProject combo box and select Primary Output from the list.
After adding the project output, you then need to add the related Content Files (such as .aspx files, Images,and so on) to the project. To do this, again bring up the Add Project Output dialog box and then selectContent Files from the list this time. It is illustrated in the following screenshot.After adding the Primary output and the Content Files to the Web Setup project, the solution explorer looksas follows:Configuring Properties through the Properties WindowThere are a number of properties that you can set through the properties window of the Web Setup project.These properties determine the runtime display and behavior of the Windows installer file. To accomplishthis, right click on the DeploymentExampleWebAppSetup project from the solution explorer and selectProperties from the context menu to bring up its properties window. The dialog box shown below appears inthe screen.As can be seen from the above screenshot, the properties window provides properties such as Author,Description, Manufacturer, Support Phone and so on that can be very useful to the users (who are installingyour application) of your application to get more details about your application.Installing the ASP.NET Web ApplicationOnce you have created the Windows installer file (.msi file), then installing the ASP.NET application in thetarget servers is very straightforward. All you need to do is to double-click on the .msi file from the Windowsexplorer. This will initiate the setup wizard, which will walk you through the installation steps. The followingscreenshot shows the first dialog box displayed during the installation.Clicking on Next in the above dialog box results in the following dialog box, where you can specify the virtualdirectory that will be used to host this Web application. This is one of the handy features wherein thecreation of virtual directory is completely automated obviating the need for manual intervention. In part twoof this article, we will see how to set specific properties (such as Directory Security, Default Document andso on) on the virtual directory as part of the installation process.In the above dialog box, you can also click on the Disk Cost... command button to get an idea of the spacerequired for installing this Web application. Clicking on Next in the above dialog box results in the followingdialog box where you are asked to confirm the installation.When you click on Next in the above dialog box, the installation will begin and the application will beinstalled. If the application is successfully installed, you will see the following dialog box.After installing the application, you can see the installed ASP.NET application through the Add/RemovePrograms option (that can be accessed through Start->Settings->Control Panel) in your computer. Fromhere, you can run the setup program to uninstall the application any time you want to. CachingThe ability to store data in the main memory and then allow for retrieval of the same as and when they arerequested.Caching is a technique of persisting the data in memory for immediate access to requesting program calls.ASP.NET supports three types of caching for Web-based applications: 1. Page Level Caching (called Output Caching) 2. Page Fragment Caching (often called Partial-Page Output Caching) 3. Programmatic or Data CachingOutput CachingOutput caching caches the output of a page (or portions of it) so that a pages content need not begenerated every time it is loaded.In a typical ASP.NET page, every time the user views the page, the Web server will have to dynamicallygenerate the content of the page and perform the relevant database queries (which are a very expensivetask to do).
Considering the fact that the page does not change for a certain period of time, it is always a good idea tocache whatever is non-static so that the page can be loaded quickly.In Page Output Caching, the entire page is cached in memory so all the subsequent requests for the samepage are addressed from the cache itself.In Page Fragment Caching, a specific a portion of the page is cached and not the entire page. Page Output orFragment Caching can be enabled or disabled at the Page, Application or even the Machine levels.Data Caching allows us to cache frequently used data and then retrieve the same data from the cache asand when it is needed. We can also set dependencies so that the data in the cache gets refreshed wheneverthere is a change in the external data store. The external data store can be a file or even a database.Accordingly, there are two types to dependencies, namely, file based and Sql Server based. There are alsodiffering cache expiration policiesSyntax: <%@ OutputCache Duration="60" VaryByParam="none" %>The above syntax specifies that the page be cached for duration of 60 seconds and the value "none" forVaryByParam* attribute makes sure that there is a single cached page available for this duration specified.* VaryByParam can take various "key" parameter names in query string. Also there are other attributes likeVaryByHeader, VaryByCustom etc.The following is the complete syntax of page output caching directive in ASP.NET.<%@ OutputCache Duration="no of seconds"Location="Any | Client | Downstream | Server | None"VaryByControl="control"VaryByCustom="browser |customstring"VaryByHeader="headers"VaryByParam="parameter" %>To store the output cache for a specified durationDeclarative Approach:<%@ OutputCache Duration="60" VaryByParam="None" %>Programmatic Approach:Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));Response.Cache.SetCacheability(HttpCacheability.Public);• To store the output cache on the browser client where the request originatedDeclarative Approach:<%@ OutputCache Duration="60" Location="Client" VaryByParam="None" %>Programmatic Approach:Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));Response.Cache.SetCacheability(HttpCacheability.Private);• To store the output cache on any HTTP 1.1 cache-capable devices including the proxy serversand the client that made requestDeclarative Approach:<%@ OutputCache Duration="60" Location="Downstream" VaryByParam="None" %>Programmatic Approach:
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));Response.Cache.SetCacheability(HttpCacheability.Public);Response.Cache.SetNoServerCaching();• To store the output cache on the Web serverDeclarative Approach:<%@ OutputCache Duration="60" Location="Server" VaryByParam="None" %>Programmatic Approach:TimeSpan freshness = new TimeSpan(0,0,0,60);DateTime now = DateTime.Now;Response.Cache.SetExpires(now.Add(freshness));Response.Cache.SetMaxAge(freshness);Response.Cache.SetCacheability(HttpCacheability.Server);Response.Cache.SetValidUntilExpires(true);• To cache the output for each HTTP request that arrives with a different City:Declarative Approach:<%@ OutputCache duration="60" varybyparam="City" %>Programmatic Approach:Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));Response.Cache.SetCacheability(HttpCacheability.Public);Response.Cache.VaryByParams["City"] = true;For the VaryByCustom attribute, the VaryByHeader attribute, and the VaryByParam attribute in the @OutputCache directive, the HttpCachePolicy class provides the VaryByHeaders property and theVaryByParamsproperty, and the SetVaryByCustom method.1. Page Output CachingIn Page Output Caching, the entire page is cached in memory so all the subsequent requests for the samepage are addressed from the cache itself.Partial-Page Output Caching/ Page Fragment CachingIn Page Fragment Caching, a specific a portion of the page is cached and not the entire page. Page Output orFragment Caching can be enabled or disabled at the Page, Application or even the Machine levels.More often than not, it is impractical to cache entire pages. For example, you may have some content onyour page that is fairly static, such as a listing of current inventory, but you may have other information,such as the users shopping cart, or the current stock price of the company, that you wish to not be cachedat all. Since Output Caching caches the HTML of the entire ASP.NET Web page, clearly Output Cachingcannot be used for these scenarios: enter Partial-Page Output Caching.Partial-Page Output Caching, or page fragment caching, allows specific regions of pages to be cached.fragment caching comes from the attribute "VaryByControl". Using this attribute one can cache a usercontrol based on the properties exposed.Syntax: <%@ OutputCache Duration="60" VaryByControl="DepartmentId" %>The above syntax when declared within an *.ascx file ensures that the control is cached for 60 seconds andthe number of representations of cached control is dependant on the property "DepartmentId" declared inthe control.
Data CachingProgrammatic or data caching takes advantage of the .NET Runtime cache engine to store any data or objectbetween responses. That is, you can store objects into a cache, similar to the storing of objects inApplication scope in classic ASP.Realize that this data cache is kept in memory and "lives" as long as the host application does. In otherwords, when the ASP.NET application using data caching is restarted, the cache is destroyed and recreated.Data Caching is almost as easy to use as Output Caching or Fragment caching: you simply interact with it asyou would any simple dictionary object.Note that the Insert method allows you to simply add items to the cache using a key and value notation aswell. For example to simply add an instance of the object bar to the cache named foo, use syntax like this:Cache.Insert("foo", bar); // C#Cache.Insert("foo", bar) VB.NETQuestion - Define Caching in ASP.NET.Answer - Caching technique allows to store/cache page output or application data on the client. The cachedinformation is used to serve subsequent requests that avoid the overhead of recreating the sameinformation. This enhances performance when same information is requested many times by the user.Question - Advantages of CachingAnswer - 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 typesPage Output CachingPage Fragment CachingData CachingQuestion - Explain in brief each kind of caching in ASP.NET.Answer - Page Output CachingThis type of caching is implemented by placing OutputCache directive at the top of the .aspx page at designtime.For example:<%@OutputCache Duration= "30" VaryByParam= "DepartmentId"%>The duration parameter specifies for how long the page would be in cache and the VaryByParam parameteris 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 CachingThis technique is used to store part of a Web form response in memory by caching a user control.Data CachingData 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:-What do you mean by Share Point Portal ?Answer: Here I have taken information regarding Share Point Portal Server 2003 provides mainly access tothe crucial business information and applications. With the help of Share Point Server we can serverinformation between Public Folders, Data Bases, File Servers and the websites that are based on Windowsserver 2003. This Share Point Portal is integrated with MSAccess and Windows servers, So we can get aWide range of document management functionality. We can also create a full featured portal withreadymade navigation and structure.
Windows Authentication is implemented mostly in Intranet scenarios. When a browser (client) sends aRequest to a server where in windows authentication has been implemented, the initial request isanonymous in nature. The server sends back a Response with a message in HTTP Header. This Prompts aWindow to display a Modal Dialog Box on the browser, where the end user may enter the "User name" and"Password".The end user enters the credentials, which are then validated against the User Store on the Windows server.Note that each user who access the Web Application in a Windows Authentication environment needs to havea Windows Account in the company network.How to avoid or disable the modal dialog box in a Windows Authentication environment?By enabling the Windows Integrated Authentication checkbox for the web application through settings in IIS.Forms Authentication is used in Internet based scenarios, where its not practical to provide a Windows basedaccount to each and every user to the Web Server. In a Forms Authentication environment, the user enterscredentials, usually a User Name and a corresponding Password, which is validated against a UserInformation Store, ideally a database table.Forms Authentication Ticket is the cookie stored on the users computer, when a user is authenticated. Thishelps in automatically logging in a user when he/she re-visits the website. When a Forms Authenticationticket is created, when a user re-visits a website, the Forms Authentication Ticket information is sent to theWeb Server along with the HTTP Request.Describe the Provider Model in ASP.NET 2.0?The Provider model in ASP.NET 2.0 is based on the Provider Design Pattern that was created in the year2002 and later implemented in the .NET Framework 2.0.The Provider Model supports automatic creation of users and their respective roles by creating entries ofthem directly in the SQL Server (May even use MS Access and other custom data sources). So actually, thismodel also supports automatically creating the user tables schema.The Provider model has 2 security providers in it: Membership provider and Role Provider. The membershipprovider saves inside it the user name (id) and corresponding passwords, whereas the Role provider storesthe Roles of the users.For SQL Server, the SqlMembershipProvider is used, while for MS Access, the AccessMembershipProvider isused. The Security settings may be set using the website adminstration tool. Automatically, theAccessMembershipProvider creates a Microsoft Access database file named aspnetdb.mdb inside theapplications App_Data folder. This contains 10 tables.Describe the Personalization in ASP.NET 2.0?ASP.NET 2.0 Personalization - Personalization allows information about visitors to be persisted on a datastore so that the information can be useful to the visitor when they visit the site again. In ASP.NET 2.0, thisis controlled by a Personalization API. Before the Personalization Model came into existence, the priorversions of ASP.NET used of the old Session object to take care of re-visits. Now comes the Profile object.In order to use a Profile object, some settings need to be done in web.config. The example below shallexplain how to use a profile object://Add this to System.Web in web.config<profile><properties> <add name="FirstName" type="System.String"/></properties></profile>In Page_Load event, add the following...If Profile.FirstName <> "" Then
Panel1.Visible = False Response.Write("Welcome Back Dear :, " & Profile.FirstName & ", " & Profile.LastName)Else Panel1.Visible = TrueEnd IfHere is the code how to save the profile properties in an event to save itProfile.FirstName = txtFirstName.TextExplain about Generics?Generics are not a completely new construct; similar concepts exist with other languages. For example, C++templates can be compared to generics. However, theres a big difference between C++ templates and .NETgenerics. With C++ templates the source code of the template is required when a template is instantiatedwith a specific type. Contrary to C++ templates, generics are not only a construct of the C# language;generics are defined with the CLR. This makes it possible to instantiate generics with a specific type in VisualBasic even though the generic class was defined with C#.Why we use Serialization?Serialization of data using built-in .NET support makes persistence easy and reusable.Most uses of serialization fall into two categories: persistence and data interchange. Persistence allowsus to store the information on some non-volatile mechanism for future use. This includes multiple uses ofour application, archiving, and so on. Data interchange is a bit more versatile in its uses. If our applicationtakes the form of an N-tier solution, it will need to transfer information from client to server, likely using anetwork protocol such as TCP. To achieve this we would serialize the data structure into a series of bytesthat we can transfer over the network. Another use of serialization for data interchange is the use of XMLserialization to allow our application to share data with another application altogether. As you can see,serialization is a part of many different solutions within our application.What is Serialization?Serialization is the process of converting an object, or group of objects, into a form that can be persisted.When u serialize an object, you also serialize the values of its properties.How Do You Use Serialization?Serialization is handled primarily by classes and interfaces in the System.Runtime.Serializationnamespace. To serialize an object, you need to create two things: • A stream to contain the serialized objects. • A formatter to serialize the objects into the stream.The Role of Formatters in .NET SerializationA formatter is used to determine the serialized format for objects. All formatters expose the IFormatterinterface, and two formatters are provided as part of the .NET framework: • BinaryFormatter provides binary encoding for compact serialization to storage, or for socket-based network streams. The BinaryFormatter class is generally not appropriate when data must be passed through a firewall. • SoapFormatter provides formatting that can be used to enable objects to be serialized using the SOAP protocol. The SoapFormatter class is primarily used for serialization through firewalls or among diverse systems. The .NET framework also includes the abstract Formatter class that may be used as a base class for custom formatters. This class inherits from the IFormatter interface, and all IFormatter properties and methods are kept abstract, but you do get the benefit of a number of helper methods that are provided for you.