1.Difference
between XML Serialization and Binary Serialization
3.Difference
between Forms Authentication and Windows Authentication
-
S.No XML SerializationBinary Serialization (SOAP)1No need of Serializable attribute on the classNeed Serializable attribute2 Only public members are serializedAll members are serialized unless specified as NonSerializable3 Class should have default public constructor and class itself should have public access.No need of default constructor or public access4 Namespace: System.XML.SerializationNamespace: System.Runtime.Serialization.Formatteres.Binary (.Soap)5 Outputfile is XMLOutputfile is Binary or XML for SOAP formatter6 XMLSerializer need type of object to be serialized or deserializedNo need to specify type of object to be serialized or deserialized.7 Support only IDesrializationCallback interface. No support for binary events.Binaryformatter support binary events. Soap formatter supports only IDeserializationCallback interface
-
S.No CurrentCultureCurrentUICulture1CurrentCulture property affects how the .NET Framework handles regional options (dates, currencies, sorting, formatting, etc.) for the current user.i.e., it provides cultural context for formatting and parsing (for ex. to parse dates or numbers) A date is often written like '10/30/2000' by Americans, but '30/10/2000' by Irish people, and 30.10.2000 by Germans etc.CurrentUICulture property determines which satellite assembly is used when loading resources and reflects the UI language for the current user.i.e., it provides the cultural context for localization, i.e. translation of resources.2 CurrentCulture does not support neutral cultures (i.e. "en", "fr" ...). It is always a specific culture (i.e. "en-GB", "de-AT", "pt-BR")CurrentUICulture supports neutral cultures (i.e. "en", "fr" ...)
Example
for CurrentCulture - To parse the date in asp.net:
using
System.Threading;
using
System.Globalization;
DateTime
dt;
//
this is a British English date format
string
dateStr = "31/10/2001";
//
parse it with British English culture
Thread.CurrentThread.CurrentCulture
= new CultureInfo("en-GB");
bool
parseOk = DateTime.TryParse(dateStr, out dt);
//
parseOk: true -- dt: {31/10/2001 00:00:00}
Thread.CurrentThread.CurrentCulture
= new CultureInfo("en-US");
parseOk
= DateTime.TryParse(dateStr, out dt);
//
parseOk: false-- dt: {1/1/0001 12:00:00 AM}
...
Example
for CurrentUICulture - To get the resources in asp.net:
using
System.Threading;
using
System.Globalization;
string
culture = "en";
Thread.CurrentThread.CurrentUICulture
= new CultureInfo(culture);
string
hello = (string)HttpContext.GetGlobalResourceObject("myClassKey",
"myResourceKey");
//
and now French
string
culture = "fr";
Thread.CurrentThread.CurrentUICulture
= new CultureInfo(culture);
string
hello = (string)HttpContext.GetGlobalResourceObject("myClassKey",
"myResourceKey");
...
-
S.No Forms AuthenticationWindows Authentication1Forms authentication enables us to identify users with a custom database, such as an ASP.NET membership database. Alternatively, we can implement our own custom database. Once authenticated, we can reference the roles the user is in to restrict access to portions of our Web site.Windows authentication enables us to identify users without creating a custom page. Credentials are stored in the Web servers local user database or an Active Directory domain. Once identified, we can use the users credentials to gain access to resources that are protected by Windows authorization.2 Form authentication is preferable for the applications which have diversified users from several places.Windows authentication is best suited for the application which is meant for a corporate users3 In case of form authentication, lists are there in 'credential' element of web.config file.User lists for windows authentication are found in 'authorization' element4 There is no such classification available in Forms authentication.There are four different kinds of Windows authentication options available that can be configured in IIS1)Integrated Windows authentication2) Basic and basic with SSL authentication3) Digest authentication4) Client Certificate authentication
No comments:
Post a Comment