Thursday, 4 October 2012

Asp.net Interview question and Answer


What is the Pre-Compilation feature of ASP.NET 2.0?

ANS--

  • App_Code: stores classes
  • App_Themes: stores CSS files, Images, etc.
  • App_Data: stores XML files, Text Files, etc.
  • App_GlobalResources: stores all the resources at global level E.g. resx files, etc
  • App_LocalResources: stores all the resources at local/Page level
Dynamic Store procedure for insert in sql server ?

usp_InsertIntoTable('tablename','col1,col2,col3','value1,value2,value3')
Create Procedure usp_InsertIntoTable
@TableName as varchar(100),
@ColumnNames as varchar(1000),
@Values as varchar(1000)
As
Begin
Declare @Query as varchar(5000)
Set @Query = 'Insert Into ' + @Tablename + '(' + @ColumnNames + ') values (' + @Values + ')'

Execute(@Query)
End 




What is Fragment Caching in ASP.NET? 

Fragment caching does not cache a WebForm, rather it allows for caching of individual user controls within a Web Form, where each control can have different cache duration and behavior.
E.g.: If you have a User Control, then add the following line in Aspx page
<%@ OutputCache Duration="20" VaryByParam="none"%>
Similarly you could have another usercontrol with duration set to 10 and have both these controls on a single Web Form 


No comments:

Post a Comment