0% found this document useful (0 votes)
72 views7 pages

What Is Page Directives? What Is Master Page? What Is Design Pattern? What Is Adrotator?

The document discusses various topics related to ASP.NET including the ASP.NET page lifecycle, types of authentication in ASP.NET, differences between Windows, Forms and Passport authentication, application state vs caching, and how to read data from a database table using ADO.NET.

Uploaded by

Vipin Jain
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views7 pages

What Is Page Directives? What Is Master Page? What Is Design Pattern? What Is Adrotator?

The document discusses various topics related to ASP.NET including the ASP.NET page lifecycle, types of authentication in ASP.NET, differences between Windows, Forms and Passport authentication, application state vs caching, and how to read data from a database table using ADO.NET.

Uploaded by

Vipin Jain
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 7

Q1. ASP.

NET Page Cycle

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

1)Page_PreInit
2)Page_Init
3)Page_InitComplete
4)Page_PreLoad
5)Page_Load
6)Page_LoadComplete
7)Page_PreRender
8)Page_PreRenderComplete
9)Page_Unload
-----------------------------------------------------------------------------------------------------------------
Q. How many types of authentication is there in ASP.NET

There are 3 type of Authentication Levels


Windows Authentication
Forms Authentication
Passport Authentication.

-------------------------------------------------------------------------------------------------------------------

Q2. How we can set Different levels of Authentication in .Net? What are the difference between
Windows Authenticatin, Passport Authentication and Form Authentication?

Windows authentication enables you to identify users without creating a custom page.
Credentials are stored in the Web server s local user database or an Active Directory domain.
Once identified you can use the user s credentials to gain access to resources that are protected
by Windows authorization.

Forms authentication enables you to identify users with a custom database such as an
ASP.NET membership database. Alternatively you can implement your own custom database.
Once authenticated you can reference the roles the user is in to restrict access to portions of your
Web site.

Passport authentication relies on a centralized service provided by Microsoft. Passport


authentication identifies a user with using his or her e-mail address and a password and a single
Passport account can be used with many different Web sites. Passport authentication is primarily
used for public Web sites with thousands of users.

Anonymous authentication does not require the user to provide credentials.

------------------------------------------------------------------------------------------------------------------------------

Using Dataset.clone() creates new instance of the same object.


Using Dataset.copy() copies content of data to another object wihtout creating new instance.
---------------------------------------------------------------------------------------------------------------------------------
-----------

What is page directives?


What is master page?
What is ADO.NET?
What is Design Pattern?
What is Adrotator?\
What is ASP.NET Server Controls?
What is ViewState?

---------------------------------------------------------------------------------------------------------------------------------
--------

what is the difference between application state and caching?

Application Object and Cached Object both falls under Server side State Management.

Application variables exist as long as the application is alive. Whereas the cache has the Property
of timeout which allows us to control the duration of the Objects so cached.
Another usefulness in caching is that we can define the way we cache our output since caching
can be done in 3 ways -
a) Full Page - defined in page directrive
b) Partial Page - Eg - .ascx control
c) Data / Programatic caching. using the Properties of Cache object such as Cache.Insert .

NOTE:
Caching variable is specifc to page and time out
Application variable is the global variable specific to application

-----------------------------------------------------------------------------------------------------------------

Write a program to read data from any table

Imports Microsoft.VisualBasic
Imports System.Collections
Imports System.Collection.Generic
Imports System.Data
Imports System.Data.sqlClient

Public Class SelectingData


Public Function GetCompanyNameData() As List (Of String)
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim cmdString As String = "Select CompanyName from Customers"
conn = New
SqlConnection("Server=localhost;uid=sa;pwd=;database=Northwind")
cmd = New SqlCommand(cmdString, conn)
conn.Open()

Dim myReader As SqlDataReader


Dim returnData As List (Of String) = New List(Of String)
myReader = cmd.ExecuteReader(CommandBehaviour.CloseConnection)

While myreader.Read()
returnData.Add(myReader(CompanyName).ToString())
EndWhile

return returnData
EndFunction
EndClass
For Insert use ExecuteNonQuery in place of ExecuteReader

---------------------------------------------------------------------------------------------------------------------------------
-------------------------------

What is MSIL, IL, CTS and, CLR ?


MSIL: (Microsoft intermediate language)
When compiling to managed code, the compiler translates your source code
into Microsoft intermediate language (MSIL), which is a CPU-independent set
of instructions that can be efficiently converted to native code. MSIL includes
instructions for loading, storing, initializing, and calling methods on objects,
as well as instructions for arithmetic and logical operations, control flow,
direct memory access, exception handling, and other operations. Before code
can be executed, MSIL must be converted to CPU-specific code, usually by a
just-in-time (JIT) compiler. Because the common language runtime supplies
one or more JIT compilers for each computer architecture it supports, the
same set of MSIL can be JIT-compiled and executed on any supported
Satish Marwat Dot Net Web Resources [email protected] 53 Page
architecture.
When a compiler produces MSIL, it also produces metadata. Metadata
describes the types in your code, including the definition of
each type, the signatures of each type's members, the members that your
code references, and other data that the runtime uses at
execution time. The MSIL and metadata are contained in a portable
executable (PE) file that is based on and extends the published
Microsoft PE and Common Object File Format (COFF) used historically for
executable content. This file format, which accommodates
MSIL or native code as well as metadata, enables the operating system to
recognize common language runtime images. The
presence of metadata in the file along with the MSIL enables your code to
describe itself, which means that there is no need for type libraries or
Interface Definition Language (IDL). The runtime locates and extracts the
metadata from the file as needed during
execution.
IL: (Intermediate Language)
A language used as the output of a number of compilers and as the input to a
just-in-time (JIT) compiler. The common language
runtime includes a JIT compiler for converting MSIL to native code.
CTS: (Common Type System)
The specification that determines how the common language runtime
defines, uses, and manages types
CLR: (Common Language Runtime)
The engine at the core of managed code execution. The runtime supplies
managed code with services such as cross-language
integration, code access security, object lifetime management, and
debugging and profiling support.

--------------------------------
What is JIT and how is works ?
An acronym for "just-in-time," a phrase that describes an action that is taken
only when it becomes necessary, such as just-in-time compilation or just-intime
object activation
--------------------------------------
What is difference between constants, readonly and, static ?
Constants: The value can’t be changed
Read-only: The value will be initialized only once from the constructor of the
class.
Static: Value can be initialized once.
-----------------------------------------
What are the types of authentication in .net?
We have three types of authentication:
1. Form authentication
2. Windows authentication
3. Passport
This has to be declared in web.config file.
--------------------------------------------
How do you initiate a string without escaping each backslash?
Put an @ sign in front of the double-quoted string.
---------------------------------------------
Explain encapsulation ?
The implementation is hidden, the interface is exposed.
------------------------------------------------
How do you convert a string into an integer in .NET?
Int32.Parse(string)
--------------------------------------------------
What's the advantage of using System.Text.StringBuilder over
System.String?
StringBuilder is more efficient in the cases, where a lot of manipulation is
done to the text. Strings are immutable, so each time it's being operated on,
a new instance is created.
-------------------------------------------------------
What's the difference between the System.Array.CopyTo() and
System.Array.Clone()?
The first one performs a deep copy of the array, the second one is shallow.
-----------------------------------------------------------
How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.
-------------------------------------------------------
What's a delegate?
A delegate object encapsulates a reference to a method. In C++ they were
referred to as function pointers.
-----------------------------------------------
What are three test cases you should go through in unit testing?
Positive test cases (correct data, correct output), negative test cases (broken
or missing data, proper handling), exception test
cases (exceptions are thrown and caught properly).
---------------------------------------------------
What's the top .NET class that everything is derived from?
System.Object.
----------------------------------------------------
How's method overriding different from overloading?
When overriding, you change the method behavior for a derived class.
Overloading simply involves having a method with the same name within the
class.
---------------------------------------------------
What does the keyword virtual mean in the method definition?
The method can be over-ridden.
--------------------------------------------
Can you declare the override method static while the original method
is non-static?
No, you can't, the signature of the virtual method must remain the same,
only the keyword virtual is changed to keyword override.
--------------------------------------------
Can you override private virtual methods?
No, moreover, you cannot access private methods in inherited classes, have
to be protected in the base class to allow any sort of access.
--------------------------------------------------
Can you prevent your class from being inherited and becoming a
base class for some other classes?
Yes, that's what keyword sealed in the class definition is for. The developer
trying to derive from your class will get a message: cannot inherit from
Sealed class WhateverBaseClassName. It's the same concept as final class in
Java.
--------------------------------------------------
Can you allow class to be inherited, but prevent the method from
being over-ridden?
Yes, just leave the class public and make the method sealed.
---------------------------------------------
Why can't you specify the accessibility modifier for methods inside
the interface?
They all must be public. Therefore, to prevent you from getting the false
impression that you have any freedom of choice, you are not allowed to
specify any accessibility, it's public by default.
---------------------------------------------------
What's an abstract class?
A class that cannot be instantiated. An abstract class is a class that must be
inherited and have the methods overridden. An abstract class is essentially a
blueprint for a class without any implementation.
--------------------------------------------------
What's an interface?
It's an abstract class with public abstract methods all of which must be
implemented in the inherited classes.
-------------------------------------------------
What's the difference between an interface and abstract class?
In the interface all methods must be abstract, in the abstract class some
methods can be concrete. In the interface no accessibility modifiers are
allowed, which is ok in abstract classes.
---------------------------------------
What is GAC?
Global Assembly Cache in .NET Framework acts as the central place for
registering assemblies. GAC is used to avoid the DLL Hell problem. To avoid the
name conflict “Strong name” is used with each and every assembly to store
them GAC. Global Assembly Cache contain following components
a. Assembly name
b. Assembly version
c. Culture info
d. Public Key
“Sn.exe” is used to create the strong name of an assembly. Gacutill Tool
used to store the assembly into GAC.
GAC is located under :\Windows\Assembly folder
-----------------------------------------------------------------------------
What is sealed class?

Sealed class is a class which can’t inherited any more. “Sealed” keyword is used
to make class Sealed. So, once we define a class using Sealed that can’t be
inherited.

General Syntax for Sealed Class is:

sealed class DemoSealedClass

// Implementation of the Class

}
--------------------------------------------------------------------------------
How is .NET able to support multiple languages?
- a language should comply with the Common Language Runtime standard to
become a .NET language. In .NET, code is compiled to Microsoft Intermediate
Language (MSIL for short). This is called as Managed Code. This Managed code is
run in .NET environment. So after compilation to this IL the language is not a
barrier. A code can call or use a function written in another language.
------------------------------------------------------------------------------
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.
---------------------------------------------------------------------------------
What is ADO .NET and what is difference between ADO and ADO.NET?
- ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-
memory database where in I can use relationships between the tables and select
insert and updates to the database. I can update the actual database as a batch.
----------------------------------------------------------------------------------
How do you separate business logic while creating an ASP.NET
application?
-use code behind (general answer)
----------------------------------------------------------------------------------
What are the XML files that are important in developing an ASP.NET
application?
-Web.config is the most important. Specific configuration determines which
others might be important.

You might also like