.Net Interview Questions

.Net Interview Questions


1 What are the advantages of Informatica?

NET Framework is an important integral component in NET software

Net Framework is a runtime environment, which we can use to run net applications

2 What is Visual StudioNet?

AVisual Studio NET is a Microsoft-integrated development environment (IDE)that can be used for developing console applications, Windows Applications, Web Applications, Windows Service, Web service And so on

3 Difference between Net Framework and VisualStudioNet?

NET FRAMEWORK VISUAL STUDIO NET

1 It is a run- time environment; which we can use to run applications1 It is a development environment, which we can use to developapplications2 It is required for net developer’s andnet application end users2 It is required for only net developers3 It is a free ware which we can download from Microsoft Website3 It is not free way which we have to purchase from Microsoft

4 What is CLR?

CLR 

Stands for

Common Language Runtime

,it is net execution

CLR is a common execution engine for all NET Languages that means every NET language application has to execute with the help of CLR

5 Explain net application Execution process?

Diagram for net application execution process:

Net application Execution process can be divided into 2 steps:

 

 Step1

 Converting HIGH level language code into MSIL (Microsoft Intermediate Languagewith the help of language compilers because Net execution engine(CLRcan understand only MSIL code

Step2

 JIT (JUST-IN-TIME compiler will convert MSIL code to NATIVE code because operating system can understand only NATIVE code or MACHINE code

6 What is JIT Compiler?

AJIT (JUST-IN-TIME Compiler will convert MSIL (Microsoft Intermediate Language code to Native code because operating system can understand only Native code or machine code

7 What is CLS?

1 CLS (Common Language Specifications is a set of common language standard defined by the Microsoft for all NET Languages2 Every NET Language has to follow CLS Standards3 Whenever a Programming Language wants to recognize as NET Language then it has to follow CLS

 8 What is CTS? 

CTS (Common Type Systemic a subset of CLS It is a set of common based data types defined by Microsoft for all NET Languages

2 Every NET Language has to map their data types with CTS types

9What is MSIL Code?

A Microsoft Intermediate Language (MSIL), is one of the Core component of theNET Framework Any NET source codes written in any net supportive language(C#, VBnet etc), when compiled are converted to MSIL This MSIL, when installed or at the Runtime, gets converted to machine code The Runtime conversion of MSIL code to the machine code is handled by a component called as the Just In Time (JITCompiler

10 Explain the role of Garbage collector?

AIn NET, MEMORY MANAGEMENT is handling by GARBAGECOLLECTOR (GC) GC is an integral part of CLRTo perform memory Management GC will do 2 duties

1 Allocating the Memory

->When new object is created by application garbage collector will allocatememory for that object with in Managed heap

11 Why C#Net?

ATo develop any type of application by using NET we require one NETLANGUAGE to write the business logic of that application

12 Explain about primitive data types?

AIn C#NET, according to the type of the data and size of the data, data types areclassified into

5 types

They are

 1 Numerical Data types

 Assigned Numerical data types: byte, short, int, long unsigned Numerical data types;- byte, short, unit, long

 2 Floating

  Float, double, decimal

 3 Character related Data types

Char

4Logical Data Types

 abool

5 General data Types

astring bobjectThese data types are called as

PRIMITIVE DATA TYPES

13 What is the MaxValue and MinValue?

 A Max Value and Min Value are predefined constants, which are members of every primitive data type structure except bool Using this Constant we can get the MINIMUM value and MAXIMUM value of a data type

14 Difference between value types and Reference types?

 VALUE TYPES REFERENCE TYPES

 1In value types, data will storing inSTACK MEMORY1 In this, Data will be storing in HEAPMEMORY2 Value type variable can contain theactual data2 Reference type variable will containthe address of the data3 In primitive data types except Generaldata types are called VALUE TYPESThey are Numerical, Floating, Characterand LogicalEx: Int, Long, Char3 In primitive data types only Generaldata types will come underREFERENCE TYPEEX: String, Object4 Structures and Enums are value types 4 Class, interface, delegates come underthis

5 When we will go for signed data types and when we will go forunsigned data types?For Example:-When we will go for sbyteWhen we will go for byte

AWhenever we want to allow both positive and negative values then we will gofor signed data typesWhenever we want to allow only positive values then we will go for unsigned datatypesHere sbtye is a signed data type and byte is an unsigned data type

15 What is the output?

static void Main (string [] args){Char  c='a';int j=c;ConsoleWriteLine (j);ConsoleReadLine ();

}

Output: 97

16 Can I assign 1 or 0 into bool variable?

static void Main(string[] args){ bool b = 1;ConsoleWriteLine(b);ConsoleReadLine();}

ANo

17 What is the output ?

static void Main(string[] args){ bool b =true;ConsoleWriteLine(b);ConsoleReadLine();}

OUTPUT: True

18What is Managed Code and Unmanaged Code?Net application may contain 2 types of codesAManaged Code BUnmanaged Code

 Managed code:

The code which is taking the help of CLR for execution is called as managedcodeExample for Managed Code:-All net languages code is managed codeVBNet code,

C#Net code…etc

BUnmanaged code: -

The code which is not taking the help of CLR for execution is called asUnmanaged codeExample for Unmanaged Code:-In net application non net code is unmanaged codeVB Code,

VC++ Code…

Note: - net application can contain non net code

19 Can we assign null value into value type variable?

No but we can assign null values into reference type variable

20 How to assign null value into value type variable?

AWe have to go for NULLABLE VALUE TYPESSyntax:

<ValueType> ? <VariableName>=NULL;

21 When we will declare particular variable as nullable type?

Whenever an input is an optional that means not compulsory then we candeclare particular variable as NULLABLE TYPES

22 What is implicit typed variable when we will go for implicittyped variable?

Using

var

 keyword we can declare IMPLICIT TYPED VARIABLE

IMPLICIT TYPED VARIABLE can have any data type value and thisvariable will be converting into particular data type based on the valuewhich is assigningWhenever we r unable to expect the type of value which is going to assign

23 What is the difference between GetType(and typeof()?

typeof(GetType()

1

It will return the given data type base type1

It will return the given variabledata type base type2

It is a operator 2

It is a method

24 What is the output?

static void Main(string[] args){var  a = 10;var  b = 105;ConsoleWriteLine(aGetType());ConsoleWriteLine(bGetType());ConsoleReadLine();}

25 What is implicit type casting? When we will go for explicit typecasing?

IMPLICIT TYPE CASTING: -

 Converting from Smaller size data type to bigger size data type is called as IMPLICIT TYPE CASTING

When EXPLICIT TYPE CASTING:

 - The type casting which is not possible byusing implicit type casting then we have to go for EXPLICIT TYPE CASTING

26 Difference between Parsing and Converting?

Parsing Converting

1

Using parsing we can convert fromonly string data type to any other datatype except object data type2

Using converting we can convertfrom any data type to any otherdata type

27 What is the output?

static void Main(string[] args){string s1 ="1234";string s2 ="12345";string s3 ="rama";string s4 =null;string s5 ="12321321321323232132132332";int res;res =intParse(s1);ConsoleWriteLine(s1);//res = intParse(s2); //res = intParse(s3); //res = intParse(s4); //res = intParse(s5); ConsoleReadLine();}

 

 

28 Difference between intParse(and ConvertToint32()?

IntParse(ConvertToInt32()

1Using this we can convert from onlySTRING to INT1Using this we can convert from anydata type value into INT2When we are parsing if the stringvariable contains NULL value then this parsing technique will throw argument NULL EXCEPTION2When we are converting if the stringvariable contains NULL value then itwill convert that NULL as ZERO

29 What is Boxing and Unboxing?

BOXING: -

 It is the process of converting from VALUE type toREFERENCE typeEx: converting from int to object

UNBOXING: -

It is the process of converting from REFERENCE type toVALUE typeEX: converting from object to int

30 What is the difference between ConvertToString(andTostring()?

AConvertToString(handles NULL values even if variable value become NULLTostring(will not handles NULL values it will throw a NULL referenceexception error

31 What is the difference between string and StringBuilder?

STRING STRING BUILDER

1 When we implement modifications tothe existing String object withinmemory it will create a new objectBecause string is IMMUTABLE1 When we implement modifications tothe existing StringBuilder object will notcreate new copy of object instead of thatit will modify the existing objectBecause StringBuilder is MUTABLE2 String will allocate a new memorywhenever we concatenate the stringvalue

EX: String s1=‖sathya‖;

S1=s1+‖Tech‖;

 ConsoleWriteLine(s1);2 StringBuilder class will have amethod Append(this method is used toinsert the new value on the existingvalueso the usage of string builder is moreefficient in case of large amount ofstring

 EX: StringBuilder s1=new

StringBuilder(―sathya‖);

S1Append(―Tech‖);

 ConsoleWriteLine(s1);3 It will occupy more memory, it willdecrease the performance ofapplications3 It will occupy less memory, it willimprove the performance ofapplications

For Example:-

static void Main(string[] args){string s1 ="Hydera";ConsoleWriteLine(s1GetHashCode());s1 = s1 +"bad";ConsoleWriteLine(s1GetHashCode());ConsoleWriteLine(s1);StringBuilder  s2 =new StringBuilder ("Hydera");ConsoleWriteLine(s2GetHashCode());s2Append("Bad");ConsoleWriteLine(s2GetHashCode());ConsoleReadLine();}

32 What is Error, Bug and Defect?

Error

--> Which comes at the time of development

Bug

 --> Which comes at the time of testing (Pre-Release)

Defect

 --> Which comes in Production (Post-Release)

33 Why class and object?

CLASS:

 To achieve ENCAPSULATION, as well as for modularity

OBJECT:

 To allocate memory for instance variables & to store the address ofinstance method

34 When we will go for instance variable?

AWhenever we required a filed for multiple objects with the different values,then particular variable we will declare as INSTANCE VARAIBLE

35 When we will go for static variable?

AAccording to the requirement whenever the value is common for all the objectsthen particular variable will declared as STATIC

36 Difference between instance variable and static variable?

INSTANCE VARIABLE(or)NON-STATIC VARIABLE

STATIC VARIABLE(or)CLASS VARIABLE

1 A variable which is declared with in the class and outside the method WITHOUT using STATIC keyword is called as INSTANCE VARIABLE1 A variable which is declared insidethe class and outside the method by using STATIC keyword is called as STATIC VARIABLE2 Instance variable will create multiple times for every object creation2 Static variable will create only once when the class is loading3 Instance variable value will bediffers from one object to anotherobject3satic variable value will be same for every object

37 When we will go for readonly?

AWhenever filed is required for every object with the different value, but thevalue not required changeEx: - EmpNo

38 When we will go for static readonly? Difference between staticvariable and static read only?

AWhenever we want to have common value for every object and value shouldnot be changed forever we will go for static readonly

39When we will go for instance method?

ATo perform operations on Instance variables

40When will go for static method?

AWhile defining method if that method is not required to access instancevariables we will define particular method as static method

41If a class is having one static constructor and one instanceconstructor which constructor will call first?

AFirst control will execute STATIC constructor because CLASS will load firstthen OBJECT will create

42Why static constructor is a parameter less constructor?

AStatic constructor executes at the time of class loading There is no need to passvalues explicitly, so it doesn't have parameters

43What are the default access modifiers?

ADefault access modifier of class members is privateDefault access modifier of a class is internal

44What is the super class for allnet classes?

AOBJECT Class

45When object class constructor is calling?

AWhen we call instance constructor first it will call object class constructor

46How constructor calling mechanism will work?

AConstructor is calling from BOTTOM to TOP, but it is executing TOP toBOTTOM

47What is this and base?

this: 

It is a keyword which is representing current class object or instanceUsing this we can invoke current class instance members

Base:

It is a keyword which is representing the super class instanceUsing base keyword we can access super class instance members from derivedclass or sub class

48How to invoke super class constructor?

Abase()

49How to invoke current class constructor?

this()

50What is constructor overloading?

AImplementing multiple constructors within a single class with differentsignature

(

Different no of parameters or Type of parameters or Order of parameters

)

 is called

CONSTRUCTOR OVERLOADING

52What is constructor chaining?

AWhenever one class constructor is invoking another class constructor which iscalled as constructor chainingFor this we can use Base()

53Why Main(is static?

AWhen we run the application CLR has to invoke the Main() If the Main(is ainstance method again it requires objectTo overcome this Main(is defined as static method

54Main(and static constructor in same class which one willexecute first?

ASTATIC CONSTRUCTOR

55What is passing parameter mechanism? How many types?

APassing a value to a function is called as PASSING PARAMETERMECHANISM

 C#Net will support passing parameter mechanism in 3 ways1 Call by value (orPass by value2 Call by reference (orpass by reference3 Call by Out (orpass by out

56When call by value, call by reference, call by out?

CALL BY VALUE:

 Whenever we want to pass some value to a function andthe modifications are not expecting to reflect back to actual parameter then we will pass it as CALL BY VALUE

CALL BY REFERENCE

: Whenever we want to pass some value and we areexpecting the modifications should be reflected back to actual paramer then wewill pass it as CALL BY REFERENCE

CALL BY OUT:

Whenever we don’t want to pass any values but we are

expecting back the modifications then we will pass particular parameter as CALLBY OUT

57Difference between call by ref and call by out?

CALL BY REFERENCE CALL BY OUT

1Ref keyword is used 1Out keyword is used2 Ref parameter should have somevalue2 Out parameter is not required to havevalue3 Whenever we want to pass somevalue and we are expecting themodifications should be reflected backthen we will pass it as CALL BYREFERENCE3

Whenever we don’t want to pass any

values but we are expecting back themodifications then we will pass particular parameter as CALL BY OUT

58What are oops principles?

1 Encapsulation2 Abstraction3 Inheritance4 Polymorphism

59What is Encapsulation? How can we achieve?

AWrapping STATES and BEHAVIOURS are called as ENCAPSULATION

Or

Binding VARIABLES and METHODS is called as ENCAPSULATIONBy implementing class we can achieve ENCAPSULATION

60What is abstraction? How can we achieve?

AAbstraction means HIDINGAbstractions are 2 types

1)

data abstraction:-

Hiding unwanted data is called as data abstraction

2)

Method abstraction:-

Invoking required method and hiding unwanted method is called as methodabstractionWith the help of FUNCTION OVERLOADING we can achieve MethodABSTRACTION

61What is Inheritance? Types of Inheritance?

AInheriting or deriving members from one class to another class is called asINHERITANCEC#Net will support

5 types of Inheritance

 They are1

Single Inheritance2

Multi-level Inheritance3 

Multiple Inheritance4

Hierarchical Inheritance5

Hybrid Inheritance

62Is C#Net will support multiple Inheritance?

AIn C#NET multiple inheritances is not possible by using classes, which is possible with the help of INTERFACES

63What is sealed class? When we will go for sealed class?

AWhile defining a class, if we have used ―sealed‖ keyword then that class can be

called as SEALED CLASS It cannot be inheritedWhenever we want to restrict to inherit a class we can go for sealed class

64Difference between static class and sealed class?

STATIC CLASS SEALED CLASS

1 It can contain only STATICmembers1 It can contain both STATIC andINSTANCE members2 It cannot be instantiated 2 It can be instantiated(we can createobject for sealed class)3 STATIC keyword is used 3 SEALED keyword is used

4Can’t be inherited

 4

Can’t be inherited

65Difference between class and structure?

CLASS STRUCTURE1 It is reference type 1 It is value type2 When we create an object for class itwill be allocated into HEAPMEMEORY2 When we create an object forstructure it will be allocated intoSTACK MEMEORY3To define a CLASS, class keyword isused3 To define a STRUCTURE, structkeyword is used4 It will support inheritance 4 It will not support inheritance5Instance field intailzers are allowed 5 Instance field intializers are notallowed

6It can contain explicit defaultconstructor

6It can’t contain

explictit defaultconstructor7 W

e can’t create an object for class

with out using new keyword7 We can create an object for structurewith out using new key word if it is nothaving instance varibles8 We can have static, abstract, sealedclass8 W

e can’t have static,

 abstract, sealedstructure9We can implement overloading andoverrding with in class9 We can implement overloading within structure,

 but we can’t implement

overriding with in structure

66Why property?

A1To assign value to a class level variable after creating object to retrieve thevalue from class level variable individually

2 Property will provide SECURITY to variable data3 Property will provide VALIDATION FACILITY for variable data at the timeof Assigning

67Difference between constructor and property?

CONSTRUCTOR PROPERTY

1 It is used to initialize the instancevariables at the time of creating anobject1 It is used to assign value to class levelvariables as well as can retrieve thevalue from class level variables

68What is polymorphism? Types of polymorphism?

APolymorphism means one name many forms Implementing multiplefunctionalities with the same name is called POLYMORPHISMIt is of 2 types:1

Static Polymorphism (orCompile Time Polymorphism2

Dynamic Polymorphism (orRuntime Polymorphism

69What is static polymorphism and dynamic polymorphism?

STATIC POLYMORPHISM:

 A method which will bind at compile time will execute in runtime is called asstatic polymorphism or early binding or compile time polymorphism

DYNAMIC POLYMORPHISM:

A method which will bind at compile time will not execute, instead of that amethod which will bind at runtime will execute is called as RUNTIMEPOLYMORPHISM (orDYNAMIC POLYMORPHISM is nothing but LATEBINDING

70What is function overloading? When we will go for functionoverloading?

FUNCTION OVERLOADING:

 Having multiple methods with the samename but a different no of arguments or different type of arguments or differentorder of arguments in a single class or in a combination of base and derived class

WHEN:

 Whenever we want to implement same method with the differentfunctionalities then we have to go for FUNCTION OVERLOADING

71Can we overload static methods?

AYES

72What is function overriding? When we will go for functionoverriding?

FUNCTION OVERRIDING:

 Having multiple methods with the same nameand with the same signature in a combination of base and derived class

WHEN:

Whenever we want to implement a method in multiple classes with the different behavior we can go for method overloading=

73What is method hiding?

AHiding the SUPER CLASS method within the SUB CLASS by using newkeyword as called as METHOD HIDING

74Can we override static methods?

ANO We cannot define static method as VIRTUAL, OVERRIDE andABSTRACTBecause FUNCTION OVERRIDING is depending on OBJECT or INSTANCE

75What is the output?

class  bc {internal virtual void display(){ConsoleWriteLine("bc display");}}class dc : bc {internal override void display(){ConsoleWriteLine("dc display");}}class tc : bc {internal new void display(){ConsoleWriteLine("tc display");}}class Program {static void Main(string[] args){

  bc b =new dc(); bdisplay(); b =new tc(); bdisplay();ConsoleReadLine();}}

76Difference between function overloading and functionoverriding?

FUNCTION OVERLOADING FUNCTION OVERRIDING

1 Multiple methods with the same nameand different signature1 Multiple methods with the same nameand same signature2 It can implement in a single class andcombination of base and derived class2 To implement override we should gofor base and derived class, we cannotimplement in single class3 No keywords are used 3 virtual in base class and override inderived class4 Both functions return types can besame or differ4 Both functions return types should besame5 It is a compile time polymorphism 5 It is a Run time polymorphism6 We can overload static methods 6 We cannot override static methods7 Constructors can be overload 7 Constructors cannot be overload

77When we will go for abstract class?

AWhenever we want to implement some methods in current class and somemethods we want declare in current class which we want to implement in futureclasses then we have to declare that class as abstract class


78When we will go for interface?

AWhenever we want to declare all the members in current class and want toimplement all the members in future classes then we will declare particular class asinterface

79Why we can

’t create object for abstract class and interface?

ANot requiredBecause is abstract class is a partial implemented class and interface has noimplementationEven though these abstract class abstract members and interface members shouldimplement within the derived classes

Due to that reason we don’t required to create object for abstract class and

interfaceWe will create an object for derived class and using that object we can accessabstract members and interface members

80Difference between abstract class and interface?

ABSTRACT CLASS INTERFACE

1 It is a collection of abstract membersand non-abstract members1 It is collection of abstract members,that means by default interface membersare abstract2 While defining an abstract class,abstract keyword is used2 While defining an interface, interfacekeyword is used3 It is partially implemented 3 No implementation4we can implement with in a method, property(Normal method or Normal property)4 W

e can’t implement a prop

erty andmethod5it can contain fields

5it can’t contain fields

 6it can contain constructor

6it can’t contain constructor

7 While implementing abstract classmembers with in the derived class wehave to use override keyword7 While implementing interfacemembers with in the derived class we

don’t required to user override key

word

81Benefits of oops?

A1 Reusability2 Extensibility3 Re-implementation4 Modularity5 Easy to modify6 Easy to implement real world programming7 Security

82What is an exception?

ARun time error is nothing but and exception

83Why exception handling mechanism?

ATo handle runtime error, when a runtime error is occurred to avoid abnormaltermination by displaying user-friendly error messages

84What code we will write within try, catch and finally blocks?

TRY BLOCK:

We have to write the statements which may throw an error

CATCH BLOCK:

We will write the statements to display user friendly messagesto the user to give more clarity to the user regarding error

FINALLY BLOCK:

We will write ERROR FREE code or CLEAN UP code thatmeans the statements which we want to execute irrespective of error occurrence

85Can we have multiple catch blocks and if yes when we will go formultiple catch blocks?

AYes Whenever we want to handle multiple errors we have to go forMULTIPLE CATCH BLOCKS

86What is super class for all net exception classes?

AException class

87What is a delegate? Types of delegates?

AIt is similar like C++ function pointer Delegate object can hold the address of afunction and can invoke a function Delegates are reference typesDelegates are of

2 types

1 Single cast Delegate and2 Multi Cast Delegate

88In C# which is called as type safe function pointers? Why?

AIn C#Net, DELEGATES are called as TYPE SAFE FUNCTION POINTERS because Delegate declaration should follow the method declaration which isholding by the delegate object

89What is language Independency? Is NET language independenttechnology?

Net is supporting for multiple languages While developing an application byusing one net language we can use another net language component

For example:-

While developing C#Net application we can use vbnet component As well aswhile developing VBNet application we can use C#Net componentDue to that reason we can say that net is a language independent technology

90What is an assembly? Types of assemblies?

AAn Assembly is a unit of code which provides versioning and deploymentAssemblies are of 2 types:-

1 Private Assembly

and

 2 Shared Assembly

91Difference between dll and exe?

exe dll

1

exe stands for EXECUTABLE 1 dll stands for DYNAMIC LINKLIBRARY2File extension will be exeEx;-helloexe2File extension will be dllHellodll3exe file will have an ENTRY point 3dll file will not have an ENTRY point

92 What Are The New Data Controls In Aspnet 20?

Data access in ASPNET 20 can be accomplished completely declaratively (no codeusing the new data-bound and data source controls There are new data source controls to represent different data backends such as SQL database, business objects, and XML, and there are new data-bound controls for rendering common UI for data, such as gridview, detailsview, and formview

93 What Are The New Navigation Controls In Aspnet 20?

The navigation controls provide common UI for navigating between pages in your site, such as treeview, menu, and sitemappath These controls use the site navigation service in ASPNET 20 to retrieve the custom structure you have defined for your site

94 What Are The New Login Controls In Aspnet 20?

The new login controls provide the building blocks to add authentication and authorization-based UI to your site, such as login forms, create user forms, password retrieval, and custom UI for logged in users or roles These controls use the built-in membership and role services in ASPNET 20 to interact with the user and role information defined for your site

95 What Are The New Web Part Controls In Aspnet 20 ?

Web parts are an exciting new family of controls that enable you to add rich, personalized content and layout to your site, as well as the ability to edit that content and layout directly from your application pages These controls rely on the personalization services in ASPNET 20 to provide a unique experience for each user in your application

96 What Are Master Pages?

Master Page feature provides the ability to define common structure and interface elements for your site, such as a page header, footer, or navigation bar, in a common location called a "master page", to be shared by many pages in your site In one simple place you can control the look, feel, and much of functionality for an entire Web site This improves the maintainability of your site and avoids unnecessary duplication of code for shared site structure or behavior

97 What Are Themes And Skins In 20, Explain Usage Scenario?

The themes and skins features in ASPNET 20 allow for easy customization of your site's look-and-feel You can define style information in a common location called a "theme", and apply that style information globally to pages or controls in your site Like Master Pages, this improves the maintainability of your site and avoid unnecessary duplication of code for shared styles

98 What Is A Profile Object, Why Is It Used?

Using the new personalization services in ASPNET 20 you can easily create customized experiences within Web applications The Profile object enables developers to easily build strongly-typed, sticky data stores for user accounts and build highly customized, relationship based experiences At the same time, a developer can leverage Web Parts and the personalization service to enable Web site visitors to completely control the layout and behavior of the site, with the knowledge that the site is completely customized for them Personalizaton scenarios are now easier to build than ever before and require significantly less code and effort to implement

99 What Is Configuration Api?

ASPNET 20 contains new configuration management API's, enabling users to programmatically build programs or scripts that create, read, and update Webconfig and machineconfig configuration files

100 What Is Mmc Admin Tool?

ASPNET 20 provides a new comprehensive admin tool that plugs into the existing IIS Administration MMC, enabling an administrator to graphically read or change common settings within our XML configuration files

101 Explain The Use Of Pre-compilation Tool?

ASPNET 20 delivers a new application deployment utility that enables both developers and administrators to precompile a dynamic ASPNET application prior to deployment This precompilation automatically identifies any compilation issues anywhere within the site, as well as enables ASPNET applications to be deployed without any source being stored on the server (one can optionally remove the content of aspx files as part of the compile phase), further protecting your intellectual property

102 How Is Application Management And Maintenance Improved In Aspnet 20?

ASPNET 20 also provides new health-monitoring support to enable administrators to be automatically notified when an application on a server starts to experience problems New tracing features will enable administrators to capture run-time and request data from a production server to better diagnose issues ASPNET 20 is delivering features that will enable developers and administrators to simplify the day-to-day management and maintenance of their Web applications

103 What Are Provider-driven Application Services? Explain In Detail?

ASPNET 20 now includes built-in support for membership (user name/password credential storageand role management services out of the box The new personalization service enables quick storage/retrieval of user settings and preferences, facilitating rich customization with minimal code The new site navigation system enables developers to quickly build link structures consistently across a site As all of these services are provider-driven, they can be easily swapped out and replaced with your own custom implementation With this extensibility option, you have complete control over the data store and schema that drives these rich application services

104 Explain Server Control Extensibility With Reference To Aspnet 20 ?

ASPNET 20 includes improved support for control extensibility, such as more base classes that encapsulate common behaviors, improved designer support, more APIs for interacting with client-side script, metadata-driven support for new features like themes and accessibility verification, better state management, and more

105 What Are The Data Source Controls?

Data access in ASPNET 20 is now performed declaratively using data source controls on a page In this model, support for new data backend storage providers can be easily added by implementing custom data source controls Additionally, the SqlDataSource control that ships in the box has built-in support for any ADONET managed provider that implements the new provider factory model in ADONET

106 What Are Compilation Build Providers?

Dynamic compilation in ASPNET 20 is now handled by extensible compilation build providers, which associate a particular file extension with a handler that knows how to compile that extension dynamically at runtime For example, resx files can be dynamically compiled to resources, wsdl files to web service proxies, and xsd files to typed DataSet objects In addition to the built-in support, it is easy to add support for additional extensions by implementing a custom build provider and registering it in Webconfig

107 What Is Expression Builders, Why Would You Use It?

ASPNET 20 introduces a declarative new syntax for referencing code to substitute values into the page, called Expression Builders ASPNET 20 includes expression builders for referencing string resources for localization, connection strings, application settings, and profile values You can also write your own expression builders to create your own custom syntax to substitute values in a page rendering

108 Is Aspnet 64-bit Enabled? How?

ASPNET 20 is now 64-bit enabled, meaning it can take advantage of the full memory address space of new 64-bit processors and servers Developers can simply copy existing 32-bit ASPNET applications onto a 64-bit ASPNET 20 server and have them automatically be JIT compiled and executed as native 64-bit applications (no source code changes or manual re-compile are required)

109 Explain How Caching In Aspnet 20 Is Different From Caching In Aspnet 11?

ASPNET 20 also now includes automatic database server cache invalidation This powerful and easy-to-use feature allows developers to aggressively output cache database-driven page and partial page content within a site and have ASPNET automatically invalidate these cache entries and refresh the content whenever the back-end database changes Developers can now safely cache time-critical content for long periods without worrying about serving visitors state data

110 Can We Bind Data To A Server Control Without Writing Code In net?

Yes, that is possible ASPNET 20 has the feature of declarative solution for data binding which requires no code at all for the most common data scenarios, such as:

*Selecting and displaying

*Data Sorting

*Paging and Caching

*Data Updating

*Inserting and Deleting Data

111 What Is A Nested Masterpage In Aspnet 20? Can There Be A Master Page Inside A Masterpage?

When a master page is placed inside the contentplaceholder of a masterpage, then the masterpage is said to be nested In other words, there is one parent masterpage, and the child masterpage is inside the content placeholder of the parent masterpage

112 How To Sort The Contents Of A Gridview Control?

The ASPNET 20 GridView control is a powerful control, the enables sorting of the rows based on a column, all this possible, without writing code Well thats what we call power

The GridView control relies on the underlying data source control to whom this is bound for the sorting capability The GridView needs to have an AccessDataSource or an SQlDataSource or an ObjectDataSource (if the SortParameterName property is set to a value allowed

The AllowSorting property of the GridView control, when set to true, enables sorting of the GridView A sortable GridView has the Header column represented as a LinkButton control When this Link Button is clicked, the Sorting event of the GridView is raised server-side, which causes a postback and in turn, sorts the GridView control's records

113 What Does The Hotspot Class In net Do? What Is An Imagemap In Aspnet?

An ImageMap is an ASPNET control that allows clicks inside a polygon like (called Hotspotregion in a webpage Well, that actually means you may create a star-shaped or diamond shaped button

There are several pre-defined shapes allowed inside an ImageMap for which templates may be used For example, for a rectangle, an asp:RectangularHotSpot may be used For a circle, an asp:CircleHotSpot may be used And for creating stars & diamonds, an asp:PolygonHotSpot may be used An image may also be put in an ImageMap which may be specified by its ImageUrl property

In order to invoke an event, the HotSpotMode property needs to be set to PostBack Further, if several HotSpots are placed inside an ImageMap, the event of the ImageMap may be passed a value using the PostBackValue property

Code below shows how to create a Polygon HotSpot using an ImageMap

<asp:ImageMap ID="ImageMap1" Runat="Server"

ImageUrl="Photogif" OnClick="SomeEvent"

AlternateText="Click Here"

HotSpotMode="Navigate">

<asp:PolygonHotSpot

AlternateText="Click Here Too!"

Coordinates="100,150, 250,350, 210,290, 90,350, 60,240"

NavigateUrl="http://wwwaspnet"

Target="_blank"/>

</asp:ImageMap>

114 How Do We Update And Delete Data In A Gridview? Datakeynames Property In net?

The best way to Update or Delete a record in a GridView control is to include a CheckBox column and a Submit Button

The GridView has its own Delete and Edit functionality If the GridView is populated with data using an SqlDataSource, checkout the wizard that comes along with the SqlDataSource It may be used to automatically create an SQL Delete command and specify the delete parameters

The DataKeyNames property of the GridView is set to a field name of the Table

115 What Is Aspnet?

ASPNET is a programming framework built on the common language runtime that can be used on a server to build powerful Web applications

116 Why Does My Aspnet File Have Multiple Tag With Runat=server?

This means that ASPNet is not properly registered with IIS Net framework provides an Administration utility that manages the installation and uninstallation of multiple versions of ASPNET on a single machine You can find the file in C:WINNTMicrosoftNET Frameworkv**aspnet_regiisexe

use the command: aspnet_regiisexe -u ---> to uninstall current aspnet version

use the command: aspnet_regiisexe -i ---> to install current aspnet version

For Windows Server 2003, you must use aspnet_regiis -i -enable This is because of the "Web Service Extensions" feature in IIS 6 (if you install VSNET or the framework without IIS installed, and then go back in and install IIS afterwards, you have to re-register so that ASPNET 'hooks' into IIS properly"

117 How To Find Out What Version Of Aspnet I Am Using On My Machine?

VBNET

ResponseWrite(SystemEnvironmentVersionToString())

C#

ResponseWrite(SystemEnvironmentVersionToString());

118 Is It Possible To Pass A Querystring From An asp Page To Aspx Page?

Yes you can pass querystring from asp to ASPNET pageasp <%responseredirect "webform1aspx?id=11 " %> aspx

VBNET

ResponseWrite (Request("id")ToString())

C#

ResponseWrite (Request["id"]ToString());

119 How To Comment Out Aspnet Tags?

<%--<asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 48px" runat="server"> Label</asp: Label>--%>

120 What Is A Viewstate?

In classic ASP, when a form is submitted the form values are cleared In some cases the form is submitted with huge information In such cases if the server comes back with error, one has to re-enter correct information in the form But submitting clears up all form values This happens as the site does not maintain any state (ViewState)

In ASPNET, when the form is submitted the form reappears in the browser with all form values This is because ASPNET maintains your ViewState ViewState is a state management technique built in ASPNET Its purpose is to keep the state of controls during subsequent postbacks by the same user The ViewState indicates the status of the page when submitted to the server The status is defined through a hidden field placed on each page with a <form runat="server"> control

<input type="hidden" name= "_VIEWSTATE"  value="dDwyNTA 3OTU0NDM7Oz 7t5Tntzk OUeB0QVV6FT2hvQwtp"  Pw =="/>

If you want to NOT maintain the ViewState, include the directive <%@ Page Enable View State="false"%> at the top of an aspx page If you do not want to maintain Viewstate for any control add the attribute Enable View State="false" to any control

 

121 Where Can I Get The Details On Migration Of Existing Projects Using Various Technologies To Aspnet?

Microsoft has designed Migration Assistants to help us convert existing pages and applications to ASPNET It does not make the conversion process completely automatic, but it will speed up project by automating some of the steps required for migration Below are the Code Migration Assistants

•ASP to ASPNET Migration Assistant

•PHP to ASPNET Migration Assistant

•JSP to ASPNET Migration Assistant

122 What Is The Equivalent Of Date(And Time(In Aspnet?

VBNET

SystemDateTimeNowToShortDateString()

SystemDateTimeNowToShortTimeString()

C#

SystemDateTimeNowToShortDateString();

SystemDateTimeNowToShortTimeString();

123 How To Prevent A Button From Validating It's Form?

Set the CauseValidation property of the button control to False

124 How To Get The Ip Address Of The Host Accessing My Site?

VBNET

ResponseWrite (RequestUserHostAddressToString ())

C#

ResponseWrite (RequestUserHostAddressToString ());

125 How To Access The Parameters Passed In Via The Url?

Call the RequestQueryStringmethod passing in the key The method will return the parameter value associated with that key VBNET

RequestQueryString("id")

C#

RequestQueryString["id"];

126 How To Display A Wait Page While A Query Is Running?

Refer Asynchronous Wait State Pattern in ASPNET

127 How To Implement Form Based Authentication In Aspnet Application?

For

•VBNET

•C#

128 Is There A Method Similar To Responseredirect That Will Send Variables To The Destination Page Other Than Using A Query String Or The Post Method?

ServerTransfer preserves the current page context, so that in the target page you can extract values and such However, it can have side effects; because ServerTransfer doesnt' go through the browser, the browser doesn't update its history and if the user clicks Back, they go to the page previous to the source page

Another way to pass values is to use something like a LinkButton It posts back to the source page, where you can get the values you need, put them in Session, and then use ResponseRedirect to transfer to the target page (This does bounce off the browserIn the target page you can read the Session values as required

129 What Are The Differences Between Html Versus Server Control?

Refer

•ASPNET Server Controls Recommendations

•Introduction to ASPNET Server Controls

130 How Can I Change The Action Of A Form Through Code?

You cannot change it The action attribute is owned by ASPNET Handle Events and Transfer

131 Is There Any Control That Allows User To Select A Time From A Clock - In Other Words Is There A Clock Control?

Peter Blum has developed some controls Check out Peter's Date Package: TimeOfDayTextBox and Duration Text Box Controls

132 How To Work With Timespan Class?

VBNET

Dim adate As DateTime = DateTimeParse("06/24/2003")

Dim bdate As DateTime = DateTimeParse("06/28/2003")

Dim ts As New TimeSpan(bdateTicks - adateTicks)

ResponseWrite(tsTotalDays & "")

ResponseWrite(tsTotalHours & ":" & tsTotalMinutes & ":" & tsTotal Seconds & ":" & tsTotalMilliseconds)

C#

DateTime adate = DateTimeParse("06/24/2003");

DateTime bdate = DateTimeParse("06/28/2003");

TimeSpan ts = new TimeSpan (bdateTicks - adateTicks);

ResponseWrite(tsTotalDaysToString (+ "");

ResponseWrite(tsTotalHoursToString(+ ":" + tsTotal Minutes ToString(+ ":" + tsTotal SecondsToString(+ ":" + tsTotal Milli secondsToString();

133 Where Can I Get Information On Cookies In Aspnet?

 

Refer Mike Pope's article Basics of Cookies in ASPNET

134 Does Aspnet Still Recognize The Globalasa File?

ASPNet does not recognize the standard ASP globalasa file Instead it uses a file named globalasax with the same - plus additional - functionality

135 How Should I Destroy My Objects In Aspnet?

ASPNet actually has very solid internal garbage collection So this is not an issue as it was in previous versions of Active Server Pages

136 Are There Resources Online With Tips On Asp To Aspnet Conversions?

Microsoft has deisnged The ASP to ASPNET Migration Assistant help us convert ASP pages and applications to ASPNET It does not make the conversion process completely automatic, but it will speed up project by automating some of the steps required for migration The following Code Migration Assistants are discussed in the link below

•ASP to ASPNET Migration Assistant

•PHP to ASPNET Migration Assistant

•JSP to ASPNET Migration Assistant

137 How Do I Publish My Aspnet Application To My Isp's Web Server?

Your ISP must first create an IIS application and apply the Front Page Server Extensions to it Then in Visual StudioNET, select the "Project | Copy Project" menu Then enter the URL and select the FrontPage web access method The "Copy Project" feature copies all of the necessary files to your ISP's machine for your ASPNET application to run

You can also FTP your files to your ISP web server But you must know which files to upload

138 Why Do I Get Error Message "could Not Load Type" Whenever I Browse To My Aspnet Web Site?

Your code-behind files for either your aspx or the globalaspx page have not been complied Use Visual Studio NET's "Build | Build Solution" menu, or run the command line compiler

139 Will The Webmatrix Sqldatasourcecontrol Work With A Mysql Connection?

SqlDataSourceControl lets you connect and work with MS SQL DB, while AccessDataSourceControl do the same thing but for MS Access DB Therefore SqlDataSourceControl can't help you in your MySql connectivity

For Connectivity with MySql refer Accessing MySQL Database with ASPNET

140 Can I Combine Classic Asp And Aspnet Pages?

No

ASP pages can run in the same site as ASPNET pages, but you can't mix in a page Also ASP and ASPNET won't share their session

141 What Is The Difference Between Src And Code-behind?

Src attribute means you deploy the source code files and everything is compiled JIT (just-in-timeas needed Many people prefer this since they don't have to manually worry about compiling and messing with dlls -- it just works Of course, the source is now on the server, for anyone with access to the server -- but not just anyone on the web

CodeBehind attribute doesn't really "do" anything, its just a helper for VSNET to associate the code file with the aspx file This is necessary since VSNET automates the pre-compiling that is harder by hand, and therefore the Src attribute is also gone Now there is only a dll to deploy, no source, so it is certainly better protected, although its always decompilable even then

142 How Can I Get The Value Of Input Box With Type Hidden In Code-behind?

You can set the runat= server for the hidden control and you can use ControlNameValue to get its value in CodeBehind file

143 I Have Created A net User Control Page (ascxBut I Cannot Compile And Run It

User control (ascxcan't be run on it own, but you can drag it onto any web page (aspxand then run it

144 What Is A resx File?

The resx resource file format consists of XML entries, which specify objects and strings inside XML tags This is useful for localization

145 Is It Possible To Use A Style Sheet Class Directly On A Control Instead Of Using Inline Or Page-level Formatting ?

Every WebControl derived control has a CssClass property which allows you to set it's format to a style sheet

146 Can I Recieve Both Html Markup For Page And Code In The Aspnet Web Page's Source Code Portion In The Web Browser?

No

The Web browser recieves only HTML markup,No source code or web control syntax is passed back to the web browser

147 Why Can't I Put <%@ Page Language="c " %> Where At The Top Of An Aspx File And Write My Server-side Scripts In C ?

The parsers ASPNET uses to extract code from ASPX files understand C#, Visual BasicNET, and JScriptNET You can write server-side scripts in any language supported by a NET compiler

148 Asp Pages That Worked Pefectly On Windows 2000 Server And Iis 50 Do Not Work On Windows 2003 Server With Iis 60 Aspnet Pages Work Fine Why?

Start -> Settings -> Control Panel -> Administrative Tools -> and double clicking IIS Manager

Go to the Web Service Extensions tab, click Active Server Pages, then press the "Allow" button on the left

149 Why Do I Get Error Message "error Creating Assembly Manifest: Error Reading Key File 'keysnk' -- The System Cannot Find The File Specified"?

Check the location of the keysnk file relative to the assembly file Provide an explicit path or a relative path

<Assembly: AssemblyKeyFileAttribute("Drive:keysnk")>

150 How To Get Url Without Querystring?

VBNET

Dim stringUri As String = "http://wwwsyncfusioncom/?id=1&auid=16" Dim weburi As Uri = New Uri(stringUri)

Dim query As String = weburiQuery

Dim weburl As String = stringUriSubstring(0, stringUriLength - queryLength)

ResponseWrite(weburl)

C#

string stringUri = "http://wwwsyncfusioncom/?id=1&auid=16"; Uri weburi = new Uri(stringUri);

string query = weburiQuery;

string weburl = stringUriSubstring(0, stringUriLength - queryLength);

ResponseWrite (weburl);

 

151 What Is The Best Way To Output Only Time And Not Date?

Use DateTime as follows VBNET

ResponseWrite(DateTimeNowToString("hh:mm:ss"))

C#

ResponseWrite(DateTimeNowToString("hh:mm:ss"));

61 Do I Have To Compile Code If I Am Changing The Content Of My Aspxcs File?

Yes if you have used Codebehind="myaspxcs"

if not  you used src="myaspxcs" in your page declaration

152 How To Grab The Referring Url?

VBNET

ResponseWrite ( RequestUrlReferrerToString())

C#

ResponseWrite ( RequestUrlReferrerToString());

153 My Asp Code Gives An Error "compiler Error Message: Bc30289: Statement Cannot Appear Within A Method Body End Of Method Assumed" When Changed To aspx?

Use a <script runat="server" type="text/javascript"> block instead of the <% %> syntax to define SubsMake sure you have proper events associated with the code and have start and end of procedure or function wirtten properly

154 How Can I Save Images ?

You need a stream to read the response, WebResponse GetResponse Stream(), and a stream to write it to the hard drive FileStream should do the trick You'll have to write to the filestream what you read from the response stream

155 How Can I Logout When Using Formsauthentication?

FormsAuthenticationSignOut()

156 Why Do I Get A Blank Page When I Use Servertransfer("page1htm"To Transfer To A Different Page?

ServerTransfer only works with aspx pages You can't use Transfer method with HTML pages

157 How To Detect The User's Culture?

VBNET

Dim sLang As String

sLang = RequestUserLanguages(0)

ResponseWrite(sLang)

C#

string sLang ;

sLang = RequestUserLanguages[0];

ResponseWrite (sLang);

158 What Is The Difference Between Currentculture Property And The Currentuiculture Property?

CurrentCulture property : affects how the NET Framework handles dates, currencies, sorting and formatting issues

CurrentUICulture property : determines which satellite assembly is used when loading resources

159 Can I Read The Hard Disk Serial # Of The Client Computer Using Aspnet?

No Such information is not passed to the server with a http request

160 What Is Xxx(src As Object, E As Eventargs)?

xxx is an event handler src is the object that fires the event e is an event argument object that contains more information about the event An event handler is used when one object wants to be notified when an event happens in another object

161 What Is The Difference Between Absolute Vs Relative Urls?

Absolute /Fully Qualified URLs:

Contain all information necessary for the browser(or other client programto locate the resource named in the URL

This includes protocol monitor used( ie http://, ftp://etc), Server's Domain name or IP address and the file path

Absolute URL looks as http://localhost/megasolutions/page1aspx Relative URLs:

Only provide information necessary to locate a resourcerelative to the current document(document relativeor current server or domain(root relative)

Document relative URL - page1aspx

Root Relative URL - /megasolutions/Admin/pagelogaspx

162 What Is The Difference Between Url And Uri?

A URL is the address of some resource on the Web, which means that normally you type the address into a browser and you get something back There are other type of resources than Web pages, but that's the easiest conceptually The browser goes out somewhere on the Internet and accesses something

A URI is just a unique string that uniquely identifies something, commonly a namespace Sometimes they look like a URL that you could type into the address bar of your Web browser, but it doesn't have to point to any physical resource on the Web It is just a unique set of characters that, in fact, don't even have to be unique

URI is the more generic term, and a URL is a particular type of URI in that a URL has to uniquely identify some resource on the Web

163 How To Convert Milliseconds Into Time?

VBNET

dim ts as TimeSpan = TimeSpanFromMilliseconds(10000ResponseWrite (tsToString ())

C#

TimeSpan ts = TimeSpanFromMilliseconds(10000);

ResponseWrite (tsToString ());

164 How To Include Multiple Vb/cs Files In The Source?

You can do this using assembly directives

<%@ assembly src="test1vb" %>

<%@ assembly src="test2vb" %>

or

<%@ assembly src="test1cs" %>

<%@ assembly src="test2cs" %>

However, note that each source file will be compiled individually into its own assembly, so they cannot have dependencies on each other

165 How To Convert A String To Proper Case?

Use the namespace SystemGlobalizationVBNET

Dim myString As String = "syncFusion deVeloPer sUppOrt" 'Creates a TextInfo based on the "en-US" culture

Dim TI As TextInfo = New CultureInfo("en-US", False)TextInfo

ResponseWrite(TIToTitleCase(myString))

C#

string myString = "syncFusion deVeloPer sUppOrt";

// Creates a TextInfo based on the "en-US" culture

TextInfo TI = new CultureInfo("en-US",false)TextInfo;

ResponseWrite (TIToTitleCase( myString ));

166 How Can I Ensure That Application-level Variables Are Not Updated By More Than One User Simultaneously?

 

Use the HttpApplicationState's Lock and UnLock methods

167 Why Do I Get The Error Message "systeminvalidoperationexception: It Is Invalid To Show A Modal Dialog Or Form When The Application Is Not Running In Userinteractive Mode Specify The Servicenotification Or Defaultdesktoponly Style To Display A "?

You can't use MsgBox or MessageBoxShow in ASPNET WebForm You maybe use:

VBNET

ResponseWrite("<script>alert('Hello');</script>")

C#

ResponseWrite("<script>alert('Hello');</script>");

168 How To Validate That A String Is A Valid Date?

VBNET

Dim blnValid As Boolean = False

Try

DateTimeParse(MyString)

blnValid = True

Catch

blnValid = False

End Try

 

C#

bool blnValid=false;

try

{

DateTimeParse(MyString);

blnValid=true;

}

catch

{

blnValid=false;

}

169 Are Namespaces And Class Names Are Case Sensitive?

Namespaces and Class names are case Sensitive Namespaces imported using the @ Import Directive will cause an error if the correct case is not used

170 How To Get The Url Of Page Dynamically?

Use RequestUrl property

171 How To Convert User Input In Dmy Format To Mdy?

VBNET

Dim dt As DateTime = DateTimeParseExact("0299", New String({"My", "M/y"}, Nothing, System Globalization Date Time StylesNone)

C#

 

DateTime dt = DateTimeParseExact("0299", new string[] {"My","M/y"}, null,System Globalization Date Time StylesNone);