.NET Interview Questions – Part 1
1. How do you turn off cookies for one page in your site?
Use the Cookie. Discard Property which Gets or sets the discard flag set by the server. When true, this property instructs the client application
not to save the Cookie on the users hard disk when a session ends.Orit can be turned off by mentioning cookie state= false in web.config file
2. How u can create XML file?
To write Dataset Contents out to disk as an XML file use:
3. What is CLR?
CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that converts a MSIL code into the host machine language code, which is then executed appropriately. The CLR is the
execution engine for .NET Framework applications. It provides a number of services, including:Code management (loading and execution)Application memory isolation
Verification of type safety Conversion of IL to native code.Access to metadata (enhanced type information)Managing memory for managed objects Enforcement of code access security
Exception handling, including cross-language exceptions Interoperation between managed code, COM objects, and pre-existing DLL’s (unmanaged codeand data)Automation of object layoutSupport for developer
Services (profiling, debugging, and so on).
4. Which two properties are on every validation control?
Control to validate & Error Message.
5. What Is The Difference Between ViewState and SessionState?
View State persist the values of controls of particular page in the client (browser) when postback operation done. When user requests another page previous page data no longer available.
SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes.
6. What is CTS and CLS?
cls stands for common language specification where as cts stands for common type system.
CLS : cls is a standard for .net . cls is small set of specification to make all languages as a .net compliant languages. cls make a use of cts and clr.
if my languages (c#,vb.net,j#,vc++) wants to be compliant language it has to follow cls standard.
CTS : Common Type System is also a standard like cls. If two languages (c# or vb.net or j# orvc++) wants to communicate with eachother, they have to convert into some common type (i.e
in clr common language runtime). In c# we use int which is converted to Int32 of CLR to communicate with vb.net which uses Integer or vice versa.
7. Which property on a Combo Box do you set with acolumn name, prior to setting the Data Source, to display data in the combo box?
ComboBox.DataValueField = “ColumnName”When we use Databind method for the Combo box we set Display Member and Display Value property to column name.
8. In .NET Compact Framework, can I free memory explicitly without waiting for garbage collector to free the memory?
Yes you can clear the memory using gc.collect method but it is recommended that u should not call this coz we don’t know the exact time when the gc will be called automatic.
9. What is “Common Type System” (CTS)?
CTS define all of the basic types that can be used in the .NET Framework and the operations performed on those type. All this time we have been
talking about language interoperability, and .NET Class Framework. None of this is possible without all the language sharing the same data types. What this means is that an int should m
ean the same in VB, VC++, C# and all other.NET compliant languages. This is achieved through introduction of Common Type System (CTS).
10. What is the difference between the C#.NET and VB.NET?
– It didn’t have the XML Documentation.
– It didn’t have the Operator Overloading.
– It didn’t have the Pointer Type variables.
– It has XML Documentation, Operator Overloading and supports Pointer Variables using unsafe keyword
11. How do you create a permanent cookie?
By setting the expiry date of the cookie to a latertime (like 10 years later.)
12. Why is catch(Exception) almost always a bad idea?
Well, if at that point you know that an error has o ccurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwingyour own exceptions signifies some design flaws in
13. What tags do you need to add within the asp datagrid tags to bind columns manually?
<asp:BoundColumn> is the tag you usually use to add a bound column. You may also use
to add a bound column to a datagrid.
14. What tags do you need to add within the asp:dat agrid tags to bind columns manually?
Inside tag in asp:Datagrid we set Text attribute to
<%= #container.Eval(databinder.dataitem,”Col_Name”) %>
15.What tag do you use to add a hyperlink column to the DataGrid?
Anchor tag is used to add a hyperlink column to the data grid
16. How does VB.NET/C# achieve polymorphism?
VB.Net / C# provide polymorphism through the following mechanisms:
1. Inheritance – base class provides overridable methods which are re-implemented in derived classes.
2. Interface – different class can implement same interface, resulting in different implementations of interface methods.
3. Virtual methods – achieve runtime polymorphism.
17.Can a .NET web application consume Java web service?
Yes Offcourse.Actually Webservices are independent to language. it depends on WSDL and SOAP. so any one can develope the Webservices and disclose the wsdl and users can consume
the webservices.wsdl and soap both are xml based.and all languages having xml parsing capability and access to http protocol will be able to work with Webservices.
18.What are value types and reference types?
Value type – bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint,ulong, ushort. Value types are stored in the Stack
Reference type – class, delegate, interface, objectstring. Reference types are stored in the Heap
19.Which control cannot be placed in MDI?
The controls that do not have events.
20. Can we run DOT.NET in UNIX platform?
One of the disadvantages of using Visual Studio.NET and the .NET framework to develop applications has been the lack of cross-platform support. Since the introduction of the .NET
framework and common language run time a few years ago, there have been a few projects designed to bring the .NET framework to other platforms, including Linux and UNIX. The
DotGNU project is touted as the “Free software alternative to .NET” and encompasses a number of projects, including DotGNU Portable .NET, whichis designed to be used to compile and run C#
and C applications on a multitude of platforms, including GNU/Linux, FreeBSD, Mac OS X, and Windows.One of the main features of the product is it’s compatibility with EMCA standards for
C# and the Common Language Infrastructure (CLI), as well as Microsoft’s own CLI implementation in the .NET framework. The project chose to go with a “Virtual Machine”
implementation, where bytecode is transformed into a simple instruction set which is then passed to a “Converted Virtual Machine”, which then are executed through an interpreter. This approach is different to other open source .NET implementations, but provides more flexibility
when porting the project to other platforms.At thecore of the project is the runtime engine(ilrun) and compiler (cscc) with an implementation of System.Windows.Forms that make
developing for the platform easier, as it doesn’t required translation through another toolkit or toolset
21.What are the Types of Assemblies?
One of the disadvantages of using Visual Studio.NET and the .NET framework to develop applications has been the lack of cross-platform support. Since the introduction of the .NET
framework and common language run time a few years ago, there have been a few projects designed to bring the .NET framework to other platforms, including Linux and UNIX. The DotGNU project is touted as the “Free software alternative to .NET” and encompasses a number of projects, including DotGNU Portable .NET, which
is designed to be used to compile and run C#and C applications on a multitude of platforms, including GNU/Linux, FreeBSD, Mac OS X, andWindows. One of the main features of the product is
it’s compatibility with EMCA standards for C# and the Common Language Infrastructure (CLI), as well as Microsoft’s own CLI
implementation in the .NET framework. The project c hose to go with a “Virtual Machine”implementation, where bytecode is transformed intoa simple instruction set which is then
passed to a “Converted Virtual Machine”, which then are executed through an interpreter. This approach is different to other open source .NET implementations, but provides more flexibility
when porting the project to other platforms. At the core of the project is the runtime engine(ilrun) and compiler (cscc) with an implementation
of System.Windows.Forms that make developing for the platform easier, as it doesn’t required translation through another toolkit or toolset
22.What is .NET / .NET Framework?
It is a Framework in which Windows applications may be developed and run. The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications. It
provides a highly productive, standards-based, multi-language environment for integrating existing investments with next-generation applications and services as well as the agility to solve
the challenges of deployment and operation of Internet-scale applications. The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class
libraries, and a componentized version of Active Server Pages called ASP.NET. The .NET Framework provides a new programming model and rich set of classes designed to simplify
application development for Windows, the Web, and mobile devices. It provides full support for XML Web services, contains robust security features, and delivers new levels of programming
power. The .NET Framework is used by all Microsoft languages including Visual C#, Visual J#, and Visual C++.
23. How many classes can a single .NET DLL contain?
24. What is the difference between thread and process?
Thread – is used to execute more than one program at a time.
process – executes single program Interview Success Kit – Free Edition: If you like this preview, you’ll love the full version .A thread is a path of execution that run on CPU, a process is a collection of threads that share
the same virtual memory. A process has at least one thread of execution, and a thread always run in a process context.
25. What is the difference between authentication and authorization?
Authentication verifies the identity of a user and authorization is a process where you can check whether or not the identity has access rights to the system. In other words, you can say that authentication is a procedure of getting some credentials from the users and verify the user’s identity against those credentials. Authorization is a procedure of granting access of particular resources to an authenticated user. You should note that authentication always takes place before authorization.
26. How can you register a custom server control to a Web page?
You can register a custom server control to a Web page using the @Register directive.
27. Which ASP.NET objects encapsulate the state of the client and the browser?
The Session object encapsulates the state of the client and browser.
28. Differentiate globalization and localization.
The globalization is a technique to identify the specific part of a Web application that is different for different languages and make separate that portion from the core of the Web application. The localization is a procedure of configuring a Web application to be supported for a specific language or locale.
29. How does the Xml Serializer work? What ACL permissions does a process using it require?
Xml Serializer requires write permission to the system’s TEMP directory.
30. Difference between Panel and Group Box classes?
Panel & Group box both can used as container for other controls like radio buttons & check box. the difference in panel & group box are Panel
1) In case of panel captions cannot be displayed
2) Can have scroll bars.
1) Captions can be displayed.
2) Cannot have a scroll bar
31. How would ASP and ASP.NET apps run at the same time on the same server?
Both ASP and ASP.net can be run at same server, becuase IIS has the capability to respond/serve both ASP and ASP.NET request.
32. What is the Main difference between ASP and ASP.NET ?
ASP contains scripts which are not compiled where as in ASP.net the code is compiled.
33. What exactly is being serialized when you perform serialization?
Serialization is the process of converting an object into stream of bytes. We perform it at the time of trans port an object in remoting. Interview Success Kit – Free Edition: If you like this preview, you’ll love the full version
34. What is a Manifest?
An assembly manifest contains all the metadata needed to specify the assembly’s version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE (Portable Executable) file (an .exe or .dll)
with Microsoft intermediate language (MSIL) code or in a standalone PE (Portable Executable) file that contains only assembly manifest information. The following table shows the information contained in the assembly manifest. The first four items — the assembly name, version number, culture, and strong name information — make up the assembly’s identity.
Assembly name: A text string specifying the assembly’s name. Version number: A major and minor version number, and a revision and build number. The common language runtime uses these numbers to enforce version policy. Culture: Information on the culture or language the assembly supports. This information should be used only to designate an assembly as a satellite assembly containing culture- or languagespecific information. (An assembly with culture information is automatically assumed to be a
satellite assembly.) Strong name information: The public key from the publisher if the assembly has been given a strong name. List of all files in the assembly: A hash of each file contained in the assembly and a file name. Note that all files that make up the assembly must be in the same
directory as the file containing the assembly manifest. Type reference information: Information used by the runtime to map a type reference to the file that contains its declaration and
implementation. This is used for types that are exported from the assembly. Information on referenced assemblies: A list of other assemblies that are statically referenced
by the assembly. Each reference includes the dependent assembly’s name, assembly metadata (version, culture, operating system, and so on), and public key, if the assembly is strong named.
35. Can you give an example of what might be best suited to place in the application_Start and Session_Start subroutines?
Application Start – We can place code to initialize variables once during application start. (e.g., db connection string) Session Start – We can place code to initialize variables specific to the session (e.g., USER ID and other specific info related to this session)
36. Briefly explain how server form post-back works ?
Post Back: The process in which a Web page sends data back to the same page on the server.
View State: View State is the mechanism ASP.NET uses to keep track of server control state
values that don’t otherwise post back as part of the HTTP form. View State Maintains the UI State of a Page View State is base64-encoded. It is not encrypted
but it can be encrypted by setting Enable View Stat MAC=”true” & setting the machine Key validation type to 3DES. If you want to NOT maintain the View State, include the directive < %@
Page Enable View State=”false” % > at the top of an .aspx page or add the attribute Enable View State=”false” to any control.
37. What is the purpose of DOTNET?
Dot Net Is a collection of products like C#, ASp.Net, Vb.Net, XML. The purpose of .Net is that we can easily upgrade and degrade our programs which is written in Microsoft visual studio
program. It provides user friendly environment.
38. What is the transport protocol you use to call a Web service SOAP?
Http is preferred for Soap while tcp for binary i.e. HTTP is used in web services and tcp works well in remoting.
39. Can you explain what inheritance is and an example of when you might use it?
The process of deriving a new class from an existing class is called Inheritance. The old class is called the base class and the new class is called derived class. The derived class inherits some or
everything of the base class. In Visual Basic we use the Inherits keyword to inherit one class
Public Class Base
Public Class Derived
40. What is strong-typing versus weak-typing? Which is preferred? Why?
Strong type is checking the types of variables as soon as possible, usually at compile time. While weak typing is delaying checking the types of the system as late as possible, usually to run-time.
Which is preferred depends on what you want. For scripts & quick stuff you’ll usually want weak Interview Success Kit – Free Edition: If you like this preview, you’ll love the full version
typing, because you want to write as much less (is this a correct way to use Ensign?) code as possible. In big programs, strong typing can reduce errors at compile time.
41. Whats wrong with a line like this?
DateTime.Parse(myString).The result returned by this function is not assigned to anything, should be something like var x = DateTime.Parse(myString)
42. What is CLR?
CLR(Common Language Runtime) is the main resource of .Net Framework. it is collection of services like garbage collector, exception handler, jit compilers etc. with the CLR cross language
integration is possible.
43. Explain Dataset Accept Changes and Data Adapter Update methods?
Data Adapter Update method Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the Data Set. Data Set Accept Changes method Commits all the changes made to this row since the last time
Accept Changes was called.
44. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
dataAdapter.Fill(ds). The beauty of this method is it automatically implicitly opens the connection to database and closes it once done.We dont need to worry about opening and
closing the connection to the database.
45. In what order do the events of an ASPX page execute. As a developer is it important to understand these events?
if you try to access it in Page_Load that is way earlier than Control’s own Render method. See ther Page/control lifecycle goes like this for the Page
and controls (being already in the controls collection, dynamic ones play catchup)
4. LoadViewState (postback)
5. Load postback data (postback, IPostBackDatahandler.LoadPostdata)
7. Load postback data for dynamical controls added on Page_Load (postback)
8. Raise Changed Events (postback, IPostBack Datahandler. RaisePost Data Changed)
9. Raise postback event (postback, IPostBackEventHandler.RaisePostBackEvent)
14. Dispose null
46. What is the root class in .Net ?
47. Which property of the textbox cannot be changed at runtime?
48. With respect to security, which one is the better choice?Net or J2EE? Explain.
As per majority programmers .NET is the best one whch have single vendor compare to ,the eace of use, more use friendly can send any problem ,it’ll be solved.
49. What is Delegation?
A delegate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.
Delegate is an entity that is entrusted with the task of representation, assign or passing on information. In code sense, it means a Delegate is entrusted with a Method to report
information back to it when a certain task (which the Method expects) is accomplished outside the Method’s class.
50.What is datagrid?
The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
51.How many languages .NET is supporting now?
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
52.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.
53.How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for this. We have Range Validator, Email Validator
54. How do you hide the columns?
One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s “Visible” property.
50. What is Reflection?
It extends the benefits of metadata by allowing developers to inspect and use it at runtime. For example, dynamically determine all the classes contained in a given assembly and invoke their methods. Reflection provides objects that encapsulate assemblies, modules, and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object,
or get the type from an existing object. You can then invoke the type’s methods or access its fields and properties. Namespace: System.Reflection
51. How is a property designated as read-only?
In VB.NET: Public Read-Only Property Property Name As Return Type Get ?Your Property
Implementation goes in here End Get End Property.
52. In what order do the events of an ASPX page execute. As a developer is it important to understand these events?
1. Object Initialization
2. Load View state Data
3. Load Post Data Processes Post back Data
4. Object Load
5. Raise Post Back Change Events
6. Process Client-Side Post Back Event
7. Prerender the Objects
8. View State Saved
9. Render To HTML
53. Describe session handling in a web farm, how does it work and what are the limits ?
In ASP.NET there are three ways to manage session objects. one support the in-proc mechanism and other two’s support the out-proc mechanism.
1) In-Proc (By Default)
2) SQL-Server (Out-proc) – Using SQL server or any other database for storing sessions regarding current logged in user.
3) State-Server (Out-Proc) – Using State Server, as one dedicated server for managing sessions. State Server will run as service on web server having dotnet installed.
54. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component?
A web service has the following characteristics:
1. It communicates using open protocols
2. Processes XML messages framed using SOAP
3. May be described using WSDL
4. Can be discovered using UDDI
Any application which is supposed to reach a wide customer base should be written as a web service, as opposed to customized applications for specific customers. For example, services which help in stock trading by providing analysis of market trends could
best be implemented as a web service. The reasons are
1. Such a web service would be easily discovered by potential customers when they need it.
2. It will require minimal setup on the client machines
3. The updates to the system will be automatically available to all its consumers, without any need to deploy the updates on their machines.
56. How does output caching work in ASP.NET?
Output caching is a powerful technique that increases request/response throughput by caching the content generated from dynamic pages. Output caching is enabled by default, but output
from any given response is not cached unless explicit action is taken to make the response cacheable. To make a response eligible for output caching, it must have a valid expiration/validation policy
and public cache visibility. This can be done using either the low-level Output Cache API or the high-level @ Output Cache directive. When output caching is enabled, an output cache entry is
created on the first GET request to the page. Subsequent GET or HEAD requests are served from the output cache entry until the cached request expires. The output cache also supports variations of cached GET or POST name/value pairs.
The output cache respects the expiration and validation policies for pages.
57. What is the difference between proc. sent BY VAL and By Ref?
BY VAL: changes will not be reflected back to the variable.
By REF: changes will be reflected back to that variable.( same as & symbol in c, c++)
58. How to Creating a Key Pair ?
You can create a key pair using the Strong Name tool (Sn.exe). Key pair files usually have an .snk
To create a key pair At the command prompt, type the following command:
sn –k <file name>
In this command, file name is the name of the output file containing the key pair.
The following example creates a key pair called sgKey.snk.
sn -k sgKey.snk
59 . NET is Compile Time OR RunTime Environment?
.Net’s framework has CLS,CTS and CLR.CTS checks declartion of types at the time when u write code and CLS defines some rules and restrictions.and CLR comile everything at runtime with
i.Vastly simplified development
ii.Seamless integration of code written in various languages
iii.Evidence-based security with code identity
iv.Assembly-based deployment that eliminates DLL Hell
v.Side-by-side versioning of reusable components
vi.Code reuse through implementation inheritance
vii.Automatic object lifetime management
viii.Self describing objects
60. What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why.
In a interface class, all methods are abstract without implementation where as in an abstract class some methods we can define concrete. In interface, no accessibility modifiers are allowed.
An abstract class may have accessibility modifiers. Interface and abstract class are basically a set of rules which u have to follow in case you are using them (inheriting them).
61. What is an Interface?
An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the
methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their
arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn?t support multiple
inheritance, interfaces are used to implement multiple inheritance.
62. How many types of assemblies are there , wat are they?
Private, Public/Shared, Satellite. A private assembly is normally used by a single application, and is stored in the application’s directory. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Satellite assemblies are often used to deploy language-specific resources for an application. These language-specific assemblies work in side-by-side execution because the application has a
separate product ID for each language and installs satellite assemblies in a language-specific subdirectory for each language.
63. What are Attributes?
Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Predefined attributes such as Assembly Version, which already exist and are accessed through the Runtime Classes; and custom
attributes, which you write yourself by extending the System. Attribute class.
64. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component?
Webservice: Appropriate, when exposing the functionalitiss across different Platforms
(windows/Linux/Solaris..etc.,) or.NET to J2EE.
.NET Component: Appropriate, when exposing the functionalities within propritory O/S(.Net-.Net, or Java-Java platform)
65. What does WSDL stand for?
WSDL stands for Web Services Description Language. It is an XML representation of the web service interface. There are two types of the operations specified in the WSDL file, as represented by the <soap:binding> attribute of the file.
1. Document oriented operations — are the ones which contain XML documents as input and output
2. Result oriented operations — are the ones which contain input parameters as the input message and result as the output message
66. How can you provide an alternating color scheme in a Repeater control?
AlternatingItemTemplate Like the ItemTemplate element, but rendered for every otherrow (alternating items) in the Repeater control. You can specify a different appearancefor the
AlternatingItemTemplate element by setting its style properties.
67. What are the features of ADO.Net ?
1. Disconnected Data Architecture
2. Data cached in Datasets
3. Data transfer
in XML format
4. Interaction with the database is done through data commands
68. What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why?
Abstract classes are closely related to interfaces. They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented. One key difference between abstract classes and interfaces is that a class may implement an unlimited number of
interfaces, but may inherit from only one abstract (or any other kind of) class. A class that is derived from an abstract class may still implement interfaces. Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some
methods, but leave the implementation of other methods until a specific implementation of that class is needed. They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code.
69. Where on the Internet would you look for Web services?
UDDI.org-Universal Description, Discovery Integration .
70.What is role based security?
By default, ASP.NET will store the session state in the same process that processes the request, just as ASP does. If cookies are not available, a session can be tracked by adding a session identifier to the URL
71.What is the difference between Asp and Asp.net?
ASP (Active Server Pages) and ASP.NET are both server side technologies for building web sites and web applications, ASP.NET is Managed compiled code – asp is interpreted. and ASP.net is fully Object oriented.ASP.NET has been entirely re-architected to provide a highly productive programming experience based on the .NET Framework, and a robust infrastructure for building reliable and scalable web applications.
72. What is the base class of Asp.net?
73.what is use of web.config?
Web.config is used connect database from front end to back end.Web.config is used to maintain the Appsettimgs instead of static variables.
74. What is RangeValidator?
RangeValidator – checks whether a value falls within a given range of number, date or string.
75.What is a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents.
76.What is the differences between Server-side and Client-side code?
Server-side code executes on the server.Client-side code executes in the client’s browser.
77.What is ViewState?
ViewState is a .Net mechanism to store the posted data among post backs. ViewState allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required.
78.What is Authentication and Authorization?
Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication.
Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.
79. What are the types of Authentication?
There are 3 types of Authentication. Windows, Forms and Passport Authentication.
Windows authentication uses the security features integrated into the Windows NT and Windows XP operating systems to authenticate and authorize Web application users.
Forms authentication allows you to create your own list/database of users and validate the identity of those users when they visit your Web site.
Passport authentication uses the Microsoft centralized authentication provider to identify users. Passport provides a way to for users to use a single identity across multiple Web applications. To use Passport authentication in your Web application, you must install the Passport SDK
80. What is encapsulation?
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.
81. Does c# support multiple inheritance?
No,its impossible which accepts multi level inheritance.
82.What is Method Overriding? How to override a function in C#?
An override method provides a new implementation of a member inherited from a base class. The method overridden by an override declaration is known as the overridden base method. The overridden base method must have the same signature as the override method.Use the override modifier to modify a method, a property, an indexer, or an event. You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override.
83. How can we check if all validation and controls are valid or proper?How can we force to run all validation control to run?
By using Page.IsValid() property we can check if all validation and controls are valid or proper by using Page.Validate we can force to run all validation control to run
84.What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client’s browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user’s browser to another page or site. This performas a trip back to the client where the client’s browser is redirected to the new page. The user’s browser history list is updated to reflect the new address.
85. What is a Constructor?
A special Method Always called whenever an instance of the class is created.
86.How many web.config files can I have in an application?
You can keep multiple web.config files in an application. You can place a Web.config file inside a folder or wherever you need (apart from some exceptions) to override the configuration settings that are inherited from a configuration file located at a higher level in the hierarchy.
87.I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy?
By setting the element’s Override attribute to false.
88.What is Cross Page Posting? How is it done?
By default, ASP.NET submits a form to the same page. In cross-page posting, the form is submitted to a different page. This is done by setting the ‘PostBackUrl’ property of the button(that causes postback) to the desired page. In the code-behind of the page to which the form has been posted, use the ‘FindControl’ method of the ‘PreviousPage’ property to reference the data of the control in the first page.
89.Can you change a Master Page dynamically at runtime? How?
Yes. To change a master page, set the MasterPageFile property to point to the .master page during the PreInit page event.
90.What are the differences between user and custom controls?
User controls are easier to create in comparison to custom controls, however user controls can be less convenient to use in advanced scenarios.
User controls have limited support for consumers who use a visual design tool whereas custom controls have full visual design tool support for consumers.
A separate copy of the user control is required in each application that uses it whereas only a single copy of the custom control is required, in the global assembly cache, which makes maintenance easier.
A user control cannot be added to the Toolbox in Visual Studio whereas custom controls can be added to the Toolbox in Visual Studio.
User controls are good for static layout whereas custom controls are good for dynamic layout.
91.What is the difference between Server.Transfer and Response.Redirect?
Response.Redirect involves a roundtrip to the server whereas Server.Transfer conserves server resources by avoiding the roundtrip. It just changes the focus of the webserver to a different page and transfers the page processing to a different page.Response.Redirect can be used for both .aspx and html pages whereas Server.Transfer can be used only for .aspx pages.Response.Redirect can be used to redirect a user to an external websites. Server.Transfer can be used only on sites running on the same server. You cannot use Server.Transfer to redirect the user to a page running on a different server.Response.Redirect changes the url in the browser. So they can be bookmarked. Whereas Server.Transfer retains the original url in the browser. It just replaces the contents of the previous page with the new one.
92. What is the good practice to implement validations in aspx page?
Client-side validation is the best way to validate data of a web page. It reduces the network traffic and saves server resources.
93. What are the event handlers that we can have in Global.asax file?
Application Events: Application_Start , Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache
Session Events: Session_Start,Session_End
94. Which protocol is used to call a Web service?
95. Can we have multiple web config files for an asp.net application?
96. What is the difference between web config and machine config?
Web config file is specific to a web application where as machine config is specific to a machine or server. There can be multiple web config files into an application where as we can have only one machine config file on a server.
97. Explain role based security ?
Role Based Security used to implement security based on roles assigned to user groups in the organization.
Then we can allow or deny users based on their role in the organization. Windows defines several built-in groups, including Administrators, Users, and Guests.
<AUTHORIZATION>< authorization >
< allow roles=”Domain_NameAdministrators” / > < !– Allow Administrators in domain. — >
< deny users=”*” / > < !– Deny anyone else. — >
< /authorization >
98. What is Cross Page Posting?
When we click submit button on a web page, the page post the data to the same page. The technique in which we post the data to different pages is called Cross Page posting. This can be achieved by setting POSTBACKURL property of the button that causes the postback. Findcontrol method of PreviousPage can be used to get the posted values on the page to which the page has been posted.
99. How can we apply Themes to an asp.net application?
We can specify the theme in web.config file. Below is the code example to apply theme:
<pages theme=”Windows7″ />
100: What is RedirectPermanent in ASP.Net?
RedirectPermanent Performs a permanent redirection from the requested URL to the specified URL. Once the redirection is done, it also returns 301 Moved Permanently responses.
101. What is tracing? Where is it used?
Tracing displays the details about how the code was executed. It refers to collecting information about the application while it is running. Tracing information can help you to troubleshoot an application. It enables you to record information in various log files about the errors that might occur at run time. You can analyze these log files to find the cause of the errors.In .NET, we have objects called Trace Listeners. A listener is an object that gets the trace output and stores it to different places, such as a window, a file on your locale drive, or a SQL Server.The System.Diagnostics namespace contains the predefined interfaces, classes, and structures that are used for tracing. It supplies two classes, Trace and Debug, which allow you to write errors and logs related to the application execution. Trace listeners are objects that collect the output of tracing processes.
102. How do you turn off cookies for one page in your site?
By setting the Cookie. Discard property false.
103. How to get the column count of a report?
SY-LINSZ system variable gives the column count (line size) and SY-LINCT for line count.
104. What is Full Trust?
Your code is allowed to do anything in the framework, meaning that all (.Net) permissions are granted. The GAC has Full Trust because it’s on the local HD, and that has Full Trust by default,
you can change that using caspol .
105. Should validation (did the user enter a real date) occur server-side or client-side? Why?
Validation will be done in both sides i.e., at the server side and client side. Server side validation will be done even though client side validation performed on the code because of proper