asp

186
ASP.NET Interview Questions (594) Submit | .NET Interview FAQs | Interview Home | Exclusive Interview Home | Search | Now you don't need go anywhere to get the best interview questions on Microsoft technology. We are trying to gather all real interview questions asked from MNCs and put them here. You can also assist us in doing so by submitting .net interview questions. These questions are generally different from certification questions however it may help you in that too. What is the use of DataSet.CaseSensitive property? Posted by: Tripati_tutu If the CaseSensitive property of a DataSet is set to true, then the string comparisons DataTables within dataset will be case sensitive. By default the CaseSensitive propert false. How you can roll back all the changes made to a DataSet when it was created? Posted by: Tripati_tutu By invoking the DataSet.RejectChanges() method, you can undo or roll back all the chang DataSet when it was created. What is Screen Scraping ? Posted by: Chvrsri It means reading the contents of the Let us assume www.rediff.com website. If we browse into that site the interface which includes different controls but we cannot see what is the URL of those links and w properties of those controls What Screen Scraping does is that it will pull the HTML related data into the webpage. What is the use of DIAGNOSTICS namespace in C#.Net? Posted by: Chvrsri It is a collection of classes which makes two options available to the developm application they are 1) It will enable to Debug the 2) It will allow to follow the execution of the application.

Upload: kulandaivel-al-kanagasabai

Post on 01-Dec-2014

127 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: ASP

ASP.NET Interview Questions (594)

  Submit  |    .NET Interview FAQs  |    Interview Home  |    Exclusive

Interview Home |    Search  |   

Now you don't need go anywhere to get the best interview questions on Microsoft technology. We are trying to gather all real interview questions asked from MNCs and put them here. You can also

assist us in doing so by submitting .net interview questions. These questions are generally different from certification questions however it may help you in that too.

What is the use of DataSet.CaseSensitive property?Posted by: Tripati_tutu

If the CaseSensitive property of a DataSet is set to true, then the string comparisons for all the DataTables within dataset will be case sensitive. By default the CaseSensitive property is always false.

How you can roll back all the changes made to a DataSet when it was created?Posted by: Tripati_tutu

By invoking the DataSet.RejectChanges() method, you can undo or roll back all the changes made to a DataSet when it was created.

What is Screen Scraping ?Posted by: Chvrsri

It means reading the contents of the WebPage.Let us assume www.rediff.com website. If we browse into that site the interface which we could see includes different controls but we cannot see what is the URL of those links and what are the properties of those controls .

What Screen Scraping does is that it will pull the HTML related data into the webpage.

What is the use of DIAGNOSTICS namespace in C#.Net?Posted by: Chvrsri

It is a collection of classes which makes two options available to the development of any application they are ...

1) It will enable to Debug the application

2) It will allow to follow the execution of the application.

When were Partial Methods intorduced ? (FrameWork )Posted by: Chvrsri

NOTE: This is objective type question, Please click question title for correct answer.

Which of the following is false regarding Constructors? a)There can be only one static constructor in the class b)The Static constructor should be without parameters c)Static constructor can be used to intialize both Static members and nonStatic members d)There should be no access modifier in static constructor definitionPosted by: Chvrsri

NOTE: This is objective type question, Please click question title for correct answer.

Page 2: ASP

Where does Static variables store ?Posted by: Chvrsri

Static variables are stored on the Heap of the memory. It is not dependent on whether it is declared within a reference type or a value type.

These variables will be in the memory till the time program ends.

What is the Difference between Internal and Protected Internal Access Modifiers?Posted by: Chvrsri

Internal :

It can be accessed by any code in the same assembly but cannot be accessable in another assembly

Protected Internal :

It can be accessed by any code in the same assembly, or by any derived class in another assembly. For a particular project.

What is the co-relation and difference between HTTP handlers and HTTP modules?Posted by: Tripati_tutu

The co-relation between HTTP handler and HTTP module is both are an integral part of the ASP.NET application. For each request is being send by the user for processing, the request will process by multiple HTTP modules and after that the request is processed by a single HTTP handler. When a request is processed by HTTP handler, then the request goes back to the user through HTTP modules.

The handlers are used to process individual endpoint requests made by the user. It returns a response to a request that is identified by a file name extension. It also enables ASP.NET application to process the HTTP URL extensions and is implementing the IHttpHandler interface, which is located in the System.Web namespace. These are analogous to Internet Server Application Programming Interface (ISAPI) extensions.

The modules are used to invoke all requests and responses made by the user. It is executed before and after the handler executes. It also enables user to modify each individual request. These modules implementing IHttpModule interface, which is located in the System.Web namespace.

What is the difference between Named skins and Default skins?Posted by: Tripati_tutu

When you are applying any theme to a page, then by default the Default skin applies to all controls of same type to that page. This skin is default for a control if it does not have SkinID attribute. Suppose you create a default skin for a Calendar control, then the control skin applies to all Calendar controls on pages that use the theme.

But the named skin controls have their SkinID property. It is not applying skin attributes automatically for controls by type, but it facilitates to apply explicitly a named skin to a control by changing the control's SkinID property. It allows you to set different skins for different instances of the same control in an application.

Explain 3 levels at which a theme can be applied for a web application?Posted by: Tripati_tutu

• At page level - Use the Theme or StyleSheetTheme attribute of the @ Page directive.

• At application level - It can be applied to all pages in an application by setting the <pages> element in the

Page 3: ASP

application configuration file.

• At web server level - It define the <pages> element in machine.config file. This will apply the theme to all the web applications on that web server.

What is the difference between themes and CSS?Posted by: Tripati_tutu

• In case of CSS you can define only style properties but a theme can define multiple properties of a control not just style properties such as you can specify the graphics property for a control, template layout of a GridView control etc.

• The CSS supports cascading but themes does not support. The CSS cannot override the property values defined for a control but any property values defined in a theme, the theme property overrides the property values declaratively set on a control, unless you explicitly apply by using the StyleSheetTheme property.

• You can apply multiple style sheets to a single page but you cannot apply multiple themes to a single page. Only one theme you can apply for a single page.

What is the difference between Synchronous and Asynchronous HTTP Handlers?Posted by: Tripati_tutuWhen you call for a HTTP request, unless until it finished the processing of assigned task, the Synchronous HTTP handler doesn't return any value. It will return a value after successful execution of sent request.

But in case of asynchronous handler, it will run a process independently and it will send a response to the end user. When you are working with some lengthy application processes, then it is advisable to use Asynchronous handler. Here the user doesn't need to wait until it finishes before receiving a response from the server.

How can you create your own custom HTTP handler factory class?Posted by: Tripati_tutuYes, with the help of class by implementing the IHttpHandlerFactory interface, you can create your own custom HTTP handler factory class.

How to follow the best way to secure connection strings in an ASP.NET web application?Posted by: Tripati_tutu• When you are working with ASP.NET applications, you should always store the connection strings in Web.config file. This is very secure. No user has rights to access web.config file from the browser.

• Store the connection strings as encrypted format in the configuration file. 

• Don't store the connection strings in .aspx page. 

• It is not recommended to set connection strings as declarative properties of the SqlDataSource control or some other data source controls.

Page 4: ASP

What's the use of "Connecting to SQL Server using Integrated Security"?Posted by: Tripati_tutuThis is best suited to use instead of using an explicit user name and password, which helps us to avoid the possibility of the connection string being compromised and your user ID and password being exposed.

Why we are storing an XML file in the applications App_Data folder?Posted by: Tripati_tutuThe use of storing an XML file in App_Data folder is not to return the contents of the App_Data folder in response to direct HTTP requests.

Write the steps to avoid Script Injection attacks?Posted by: Tripati_tutuStep-1: First encode the user input with the HtmlEncode methods so that the method will return HTML into its text representation. 

Step-2: When you are using bound fields of a Data controls, then set the BoundField object's HtmlEncode property to true which causes the Data control to encode input given by the user when you are in edit mode of that Data control.

What is an HTTP Handler?Posted by: Tripati_tutuThis is a process which runs in response to a request made by an ASP.NET Web application. This is also referred to as endpoint. The ASP.NET page handler processes .aspx files. When a user requests an .aspx file, then the request is processed by the page through the page handler. It is also possible to create an HTTP handler that render custom output to the browser.

What is HTTP module?Posted by: Tripati_tutuThese are the assemblies, and when you are sending any requests to your application then this assembly will call. This is also a part of the ASP.NET request pipeline and has access to life-cycle events throughout the request. HTTP modules are examining the incoming and outgoing requests and it takes action based on the request made by user.

What is the interface that you have to implement to create a Custom HTTP Handler?Posted by: Tripati_tutu• Implement IHttpHandler interface to create a synchronous handler. • Implement IHttpAsyncHandler to create an asynchronous handler.

Page 5: ASP

What is the use of MaintainScrollPositionOnPostBack property?Posted by: Tripati_tutuWhen a page is posted back to the server, at that time the user is at top position of the page rather it is not redirecting to that location where the user is before redirect of the webpage. So the use of MaintainScrollPositionOnPostBack property for a Page is to set the value as true or false for scroll position in the browser after the page is postback. When the property is set to true then the user will at that position at which the user is present before redirect. So we can say the user will redirect to the same position before redirect to another page. 

<asp:Page MaintainScrollPositionOnPostBack="True/False" />

In which way you can retrieve original request URL when using URL rewriting or Server.Transfer in ASP.NET?Posted by: Tripati_tutuThe way to retrieve original request URL is Request.ServerVariables("HTTP_X_REWRITE_URL")will work on all types of URL rewriting methods like ISAPI filters, HTTP Handlers or Http Modules and on Server.Transfer. Before any URI modifications, the original Request URI is saved into the HTTP header i.e. X-Rewrite-URL. This can also be retrieved in ASP.NET by using the above method.

What is difference between “Common Type System” and “Type Safe”?Posted by: LaghaterohanCTS define all of the basic types that can be used in the .NET Framework and the operations performed on those types. 

Type safe means preventing programs from accessing memory outside the bounds of an object's public properties. Type-safe code accesses only the memory locations which is authorized to access.

Can you programmatically store and retrieve data from ViewState?Posted by: Tripati_tutuYes, you can programmatically store and retrieve data from ViewState in an ASP.NET application.

Example: To save the value in ViewState object 

ViewState("Name") = txtName.text;

Retrieve the value from ViewState object 

Page 6: ASP

String strName = ViewState("Name").ToString();

Is the ViewState of one page available to another page?Posted by: Tripati_tutuNo, the ViewState of a Page is available only in that page. You cannot access ViewState of one page to another page.

Can the HTML controls retain State across postbacks? If no, can you make HTML controls retain State across postbacks?Posted by: Tripati_tutuNo, by default the HTML controls doesn't retain any state across postbacks. But yes, if you are converting HTML controls to Server Controls then you can retain HTML control State across postbacks. 

There are 2 ways to convert HTML control to Server Control. • Right click on the HTML Control and then click "Run As Server Control" • Set runat="server" attribute for the Control.

When a ViewState restoration happens and is it encoded?Posted by: Tripati_tutuThe ViewState restoration happens during the Page_Init event. Yes, the ViewState is base-64 encoded.

What are the three Register directive attributes used to add custom controls to a Web form?Posted by: Tripati_tutuTagPrefix: The TagPrefix defines a unique namespace for an user control. If multiple user controls are present on the page having same name, then they can be differentiated with them by using this directive. It determines the group that the user control belongs to. 

Namespace: It is nothing but the project name and namespace within the custom control assembly that contains the controls to register. The .NET applications use the project name as an implicit namespace for controls present in the application. 

Assembly: This defines the name of the created assembly (.dll) that contains the custom controls. The control assembly is referenced by the Web application and it maintains a copy in the web applications 'Bin' directory.

What are composite custom controls?Posted by: Tripati_tutu

Page 7: ASP

Creating an extreme powerful control that is composite custom control which requires the combination of several server or HTML controls with in a single control class, and which can compiled with other control classes to create an assembly. That created assembly (.dll) contains custom control library. After creating, you can load into Visual Studio .NET and can use as how you are using standard controls. 

These controls are functionally similar to user controls, but they present in their own assemblies, so you can share the same control in different projects without copying the control. However it’s difficult to create custom controls because you can’t draw them visually with the help of Visual Studio .NET.

How a validation group works when the Page is posted?Posted by: Tripati_tutuWhen the page postbacks, then the IsValid property of Page class is set based on the validation controls present in the validationGroup. This group determines the caused validation occurred by the control. For example, if a button control with a validation group, let's say login group is clicked, then the IsValid property will return true if all validation controls whose ValidationGroup property is set to login group are valid.

Can a DropDownList fire validation controls?Posted by: Tripati_tutuYes, a DropDownList control can fire validation control when the CausesValidation property of that validation control is set to true and the AutoPostBack property is set to true.

Why SetFocusOnError property is used for a validation control?Posted by: Tripati_tutuWith the help of this property, you can specify the focus whether that is automatically set to the control specified by the ControlToValidate property or not or else by using the focus feature, the validators can be configured to set focus to their associated control to be validated when a validation error occurs. It will set when the validation control unable to validate. It allows us to update the appropriate control present in the control property. It will always move focus back to the field with the error after you tab out and an error occurs.

What is InitialValue property of a RequiredFieldValidator?Posted by: Tripati_tutuThis property assigns the starting value for a input control. The default value is String.Empty. The validation control fails to validate, if the value of the associated input control is same as the InitialValue upon focus. With the help of this control you can make the input control as a mandatory field.

Page 8: ASP

How you can invoke programmatically all validation controls on a page?Posted by: Tripati_tutuYou can invoke validation controls programmatically with the help of CallPage.Validate() method. These properties invoke the validation logic for each validation control in the defined validation group. When this method is invoked, it does through the validation controls associated with the Page.

What’s the difference between System.String and System.Text.StringBuilder classes?Posted by: [email protected] is immutable. 

System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

What is a validation group and how do you create a validation group?Posted by: Tripati_tutuThis is a group which allows you to combine different validation controls in a single group on a page. With this, each validation group will going to perform its independent validation property as compared to other validation groups present on that page. 

You can create a validation group by changing the ValidationGroup property to the same name for all the controls that you want to group. You can define a name to validation group, but you must have to use the same name for all controls of the group.

How long the instance of a web form is available on the web server?Posted by: Tripati_tutuWhen we will request a webpage from the browser, it will create an instance of that requested Webpage, which generates HTML to response to the request, and posts it on the browser. After post, it destroys the instance of that Webpage. 

Let’s say at client side the browser has an HTML, in that the user can enter some text in textboxes, can select some required options, and perform other tasks until it fires any postback event, such as button click event. This causes the browser to send the submitted data back to the server for event processing. When the server receives client request, it will create a new instance of the Webpage and it fills supplied data, and processes requested event by the client. As server finishes task, it posts the resulting HTML back to the browser and destroys the instance of the Webpage.

Explain the ways to format output of an ASP.NET Web application?Posted by: Tripati_tutuThere are two different ways to format the output of an ASP.NET web application. 

Page 9: ASP

Cascading style sheets (CSS): This is used to control the appearance of elements on a Web form. It also organizes all of the formatting information applied to HTML elements on a Web form which make easy to adjust the look and feel of Web applications. These styles can set the size, font, color and behavior of each specified HTML elements on the Web page. 

Extensible Style sheet Language Transformations (XSLT): This is used to convert the mentioned data from an Extensible Markup Language (XML) file to HTML output and shows that information on the Web form. This XSLT puts data into HTML element from the XML file and applies styles on that element.

In which levels we can apply formatting to a web application?Posted by: Tripati_tutu• You can define styles in a style sheet file and that can be applied to all webforms referencing to the style sheet.

• You can also initialize styles in a page’s head element and that can be applied to all elements on the current page. 

• You can also define styles inline in the HTML tag. These styles are applicable only to the HTML element in which these styles are defined.

Write the advantages of storing style definitions in a style sheet file (.css)?Posted by: Tripati_tutu• Easily you can maintain formatting i.e. when you will make change in style properties then it will reflect to the entire application. 

• The sets of parallel formatting rules can be maintained in separate style sheets for formatting the output according to the user requirement. For example, an application may provide standard, enlarged-type, and printer-friendly style sheets which can be select by the user at run time. 

• If you want to override the global styles then you should use page and inline styles. It depends on page and inline styles which is difficult to maintain the formatting in a Web application.

What is the use of Style Builder and how you can modify a style sheet using style builder?Posted by: Tripati_tutuThis is used to change the appearance of any styles in a style sheet. The changes to the style sheet will change the appearance of Web form that references that style sheet. 

To modify a style sheet using style builder, you need to follow these steps: 

• First open the style sheet in Visual Studio which displays the style definitions in the Document window

Page 10: ASP

and also in the Tool window. 

• Then select the style from Tool window to modify the definition of style property which will also display in the Document window. 

• When you will right click on the style definition, a menu will appear. From that menu when you will select Build Style it displays the Style Builder Wizard. 

• By using Style Builder you can compose the formatting which you want to add or modify in the selected style, and then click ok. 

• After completion of above steps, you will get new or modified style attributes to the style definition.

Can you apply styles using class names and can you change it at run time?Posted by: Tripati_tutuYes, you can apply style to different elements or different style to a single element in a class depending on the elements used. With the help of element IDs, you can also apply style to the element on a Web form.

Suppose you have created a style for a class, and then it automatically add a style definition to the style sheet using .classname identifier. 

You can apply style to HTML elements by using the class attribute and to server control elements by using the CssClass attribute. 

Yes, we can change the style sheet at runtime.

What are different application level events?Posted by: Tripati_tutuApplication_Start: It occurs when the user visits a page within your Web application. 

Application_End: It occurs when there are no users of that application. 

Application_BeginRequest: It occurs at the beginning of each request to the server. A request begins when a user navigates to some pages in the application. 

Application_EndRequest: It occurs at the end of each request to the server. 

Session_Start: It occurs when a new user visit a page within the application. 

Session_End: It occurs when a user stops requesting to the pages in Web application and their sessions time out. It specifies the period mentioned in Web.config file. 

Page 11: ASP

Application_Error: It occurs when there is an unhandled exception in application.

In which levels, the events can occur in an ASP.NET web application?Posted by: Tripati_tutuIn a Web application, the events can occur at the application level, page level, and server control level.

What is the difference between Application and Session Events?Posted by: Tripati_tutuBy considering the application level you can have both Application and Session events. To initialize objects and to make data available to all the current sessions of your Web application we can use Application event. With the help of Session events you can initialize data that you want to share throughout all individual sessions but not in between the sessions.

Explain steps to optimize a web application for better performance?Posted by: Tripati_tutuStep-1: Turn off the debug option for a compiled application that is code compiled with release option runs faster than code compiled with debug option. 

Step-2: Avoid postback of data between the client and server. Design the Web form in a way that it will complete the data on the Web form before user posts the data to the server. You can also use validation control to know the data complete on the client side before the page is submitted. 

Step-3: Turn on or off the Session state according to the requirement i.e. you are designing your code to use some other techniques like cookies which is used to store client data etc. 

Step-4: Make ViewState as off for server controls so that it needn't to retain their values. Saving ViewState information which leads to transmit data back to the server with each request. 

Step-5: Use stored procedures with databases to execute more quickly. 

Step-6: Use SqlDataReader rather than data set for data retrieval i.e. it is faster and consumes less memory than a data set.

What is Optimization?Posted by: Tripati_tutuThe Optimization is a structured, systematic process for accessing codes and usually refers to writing code in such a way so that it executes more quickly and consumes fewer resources. It simply reflects to the good programming practices.

Page 12: ASP

What are the three different types of Server Control Events?Posted by: Tripati_tutuThe Server controls such as a Label, Button and Textbox each have their own sets of events that occur in response to the user requests. There are three types of server control events as mentioned below.

Postback events: This event occurs when a Web page is sent back to the server for further processing. These events effect on performance because they trigger a reverse back request to the server. A dropdown list can fire a post back if the AutoPostBack property of that dropdown list is set to true, else a cached event will fire. 

Cached events: The Cache events are saved in view state of a processed page when a postback event occurs. If the AutoPostBack property is set to false then the server controls can trigger a cached event.

Validation events: These events can be enabled in configuration level or in page level. These types of events are handled on the page without any post back or caching. For security, this feature verifies that arguments to postback or callback events that originate from the server control.

What is ASP.NET Process recycling and how to configure it in machine.config file?Posted by: Tripati_tutuThis technique helps you to configure the ASP.NET application, so that the application will automatically shut down and restart after a given period of time requested by the user or by the client. Also it has an ability to repair them through process recycling. You can also handle how the ASP.NET processes are recycled through attributes in the processModel element in the Machine.config file or else in web.config file. 

To configure the process model you have to set some properties in machine.config file according to your requirement. 

<configuration>

<system.web>

<processModel enable="true" timeout="60" requestLimit="Infinite" username="machine" password="AutoGenerate" />

</system.web>

</configuration>

Page 13: ASP

Mention the different levels of events for Event Viewer?Posted by: Tripati_tutuThere are 3 different levels of events for Event Viewer 

• Informational events. • Warning events. • Error events.

Why it is required to monitor a deployed Web application?Posted by: Tripati_tutuWhen you have deployed a Web application, then you need to monitor that Web application because you have to know how it performs on the server. Many issues can crop up for your application at this point because of 

• The number of users accessing that Web application. • The changeable nature of user interaction. • The possibility of malicious attack by the user.

Write three major steps which involves in maintaining a deployed web application?Posted by: Tripati_tutuThere are three major steps involved in maintaining a deployed web application: 

• Monitoring the application for clearing errors, performance, and security issues. • Make change in the application as issues are arising. • Setup the application to respond to user traffic.

How do you run the Event Viewer to view application, system, and security events as they happen?Posted by: Tripati_tutuFor running of Event Viewer, let’s choose the Event Viewer from the Administrative Tools sub-menu of Windows Start menu. (You can get the Administrative Tools menu in Windows XP Professional by right click on Start button, then select Properties and click the customize button on the Start Menu tab. The Administrative Tools option will appear on the Advanced tab of the customize Start Menu dialog box). After that when you will click on the Event Viewer shortcut, and then the windows will display the Event Viewer snap-in in the MMC (Microsoft Management Console).

How you can make change in deployed ASP.NET web application without restarting the server or IIS?Posted by: Tripati_tutuYes, after copying the new assembly files and the content files to the application folder, you can make change in deployed web application on the server without restarting the server or IIS. It automatically

Page 14: ASP

restarts the application when you replace the assembly. You needn't to install or register the assembly on the server.

List the different ProcessModel attributes which relates to process recycling in machine.config file?Posted by: Tripati_tutuTimeout attribute: It automatically recycles the process after a certain number of requests sent by the user or we can say the amount of time before the process is shut down and restarted. 

Shutdown Timeout attribute: It determines each process will take how much time to shut down. After that time, the process is terminated by the system. 

RequestLimit attribute: This attribute has the number of queued requests to serve before the process is shut down and restarted. 

RestartQueueLimit attribute: This attribute specifies the number of queued requests to retain while the process is shut down and restarted. 

MemoryLimit attribute: The percentage of physical memory the ASP.NET process is allowed to consume before that process is shut down and a new process is started. This helps to prevent memory leaks before it causes a breakdown in the server. 

ResponseRestart - DeadlockInterval: It specifies the amount of time to wait before restarting a process because it was deadlocked. This helps to prevent applications with serious errors in the server. 

ResponseDeadlockInterval: This is the time to wait before restarting a process that is a situation in which no progress can be made.

Explain the ways, so that you can modify the additional permissions required by an application?Posted by: Tripati_tutuThere are 3 different ways to modify the additional permissions required by an application. That is

• Permit the ASP.NET user access to the required files. To access this option, the server must have Windows NT file system (NTFS). • Change the group of ASP.NET user. • Use impersonation to run the process as another user.

In which 3 levels we have a configuration file for an ASP.NET web application?Posted by: Tripati_tutuWeb server level: At this level the Machine.config file is located in Windows\Microsoft.NET\Framework\version\config directory. This helps to set the base configuration for all .NET assemblies that is running on

Page 15: ASP

the server. 

Application or Web site level: At this level the Web.config file located in the IIS root directory. It helps to set the base configuration for all Web applications and overrides the settings that are in Machine.config file. 

In the sub directory of an application root folder: This override the settings in the root folders of web.config file.

Write the steps to host a web application on a web server?Posted by: Tripati_tutuStep-1: Use IIS to set up a virtual folder for a physical folder in an application. 

Step-2: Copy all the web application to the virtual directory location. 

Step-3: Then add a shared .NET component to the server’s global assembly cache (GAC). 

Step-4: Set the security permission on the server that allows the application to access required resources.

What is Profile Based State in ASP State Management ?Posted by: ChvrsriA profile based state is nothing but the state changes is saved permanently for a particular profile. That means the state is saved manually by the user. If there was no saving done the Default settings will be applied . 

For Example . If we login into igoogle.com, there if we have our customized page set once, untill and unless we change it delibrately it will be the same page.

What are Shallow Copy and Deep Copy in .NET?Posted by: Tripati_tutuThe terms "Shallow Copy " and "Deep Copy " which refer to the way the objects are copied, for example, during the invocation of a copy constructor or assignment operator. The deep copy can also be called as member wise copy and the copy operation respects object semantics. For example, copying an object that has a member of type standard string ensures that the corresponding standard string in the target object is copy-constructed by the copy constructor of class string. 

Shallow copy: This is nothing but creating a new object, and then copying the nonstatic fields of the current object to the new object. If a field is a value type then a bit-by-bit copy of the field is performed. If it is a reference type then the reference is copied but not the referred object. Therefore, the original object and its

Page 16: ASP

clone refer to the same object. 

Deep copy: Deep copy is partially same as shallow copy, but the difference is deep copy copies the whole object and makes a different object, it means it do not refer to the original object while in case of shallow copy the target object always refer to the original object and changes in target object also make changes in original object. It serializes the objects and deserializes the output.

What are the Difference between Compiler and Debugger?Posted by: Tripati_tutuCompiler is software or we can say it is a set of software that translates one computer Language to another computer language. Most of the cases the High level Programming Language are converting to low level Programming Language. 

Most of the time the Programs analyze and examine error, so for that Debugger is used. Debugger is another program that is used for testing and debugging of other programs. It is also able to tell where the error occurred in your application.

What is Debugger and what are the types of Debugger?Posted by: Tripati_tutuDebugger is a program that is used for testing and debugging purpose for the programs. Mainly it is used to analyze and examine error conditions in the application. With the help of this we can able to find where the error occurred in your application. 

There are two types of Debugger that is: 

• CorDBG (command-line debugger) - To use this CorDbg, you must compile the original C# file using the debug switch. 

• DbgCLR (graphic debugger) - The Visual Studio .NET uses this DbgCLR debugger.

What is the difference between Cookie and Session in Asp.Net?Posted by: Tripati_tutu• The basic and main difference between cookie and session is that cookies are stored in the user's browser but sessions can't store in user's browser. This specifies which is best used for. 

• A cookie can keep all the information in the client's browser until deleted. If a person has a login and password, this can be set as a cookie in their browser so they do not have to re-login to your website every time they visit. You can store almost anything in a browser cookie. 

• Sessions are not reliant on the user allowing a cookie. They work like a token in the browser which

Page 17: ASP

allowing access and passing information while the user has opened his browser. The problem in sessions is when you close the browser the session will automatically lost. So, if you had a site requiring a login, this couldn't be saved as a session but it can be saved as a cookie, and the user has to re-login every time they visit.

Define and describe different File Name Extensions in Asp.net?Posted by: Tripati_tutuApplications written in Asp .net have different files with different extension. Native files generally have .aspx or .ascx extension. File name containing the business logic depend on the language that you are using. For Example c# files have extension aspx.cs. 

.asax: Default.asax, used for application-level logic 

.ascx: Web UserControls i.e. custom controls can be placed onto web pages. 

.ashx: for custom HTTP handlers. 

.asmx: web service pages that are Code behind page of an asmx file is placed into the app_code folder.

.axd: when enabled in web.config requesting trace.axd outputs application-level tracing. It is also used for special webresource.axd handler which allows control or component developers to package a component or control complete with images, script, css etc. for deployment in a single file. 

.config: web.config is the only file in a Web application. This is the by default extension (machine.config similarly affects the entire Web server and all applications on it). Also ASP.NET facilitates to create and consume other config files. These are stored in XML format. 

.cs/vb: Code files (cs indicates C#, vb indicates Visual Basic). Code behind files predominantly has the extension ".aspx.cs" or ".aspx.vb" for the two most common languages. Other code files can also exist in the web folders with the cs/vb extension. These are placed inside the App_Code folder where they are dynamically compiled and available to the whole application. 

.dbml: LINQ to SQL data classes file 

.master: Master page file 

.resx: resource files for localization. Resource files can be global (e.g. messages) or "local" which means specific for a single aspx or ascx file. 

.sitemap: sitemap configuration files. The default file name is web.sitemap. 

.skin: theme skin files. 

Page 18: ASP

.svc: Windows Communication Foundation service file.

Describe the different properties of cookie in Asp.Net?Posted by: Tripati_tutuThe different properties of a cookie are: 

• Domain: This property defines the domain of Web servers to which this cookie should be made available. When the Web server matches the defined domain then that web browser will send a cookie back to a Web server. It specifies the domain for which the cookie is valid. The domain associated with the cookie for example, aspx.superexpert.com 

• Expires: It specifies the expiration date for a persistent cookie. It sets the current state of the cookie. Also it gets and sets the expiration date and time for the cookies. 

• HasKeys: This is a Boolean value which indicates whether the cookie is a cookie dictionary or not.

• Name: The name of the cookie. 

• Path: It defines a Web server path to which the cookie should be made available. The path associated with the Cookie that is it sets the URI's to which the cookie applies. The default value is /. 

• Secure: A value that indicates whether the cookie should be sent over an encrypted connection only. It sets the Secure attribute of any SESSIONID cookies associated with the web application. It allows values as: true — Sets Secure to true. false — Sets Secure to false. dynamic — The SESSIONID cookie inherits the Secure setting of the request that initiated the session. The default value is False. 

• Value: The value of the Cookie that is it sets the value for the cookie. 

• Values: It is a NameValueCollection that represents all the key and value pairs stored in a Cookie dictionary.

Describe about HttpContext Class ?Posted by: ChvrsriHttpContext class:

• The HttpContext class encapsulates HTTP-specific information about an HTTP request. 

Page 19: ASP

• This includes response/request headers, server variables, session variables, user information, and so on. Of particular interest is a property called Current, which returns an instance of the HttpContext class that represents the current HTTP request. 

• Another important property in the HttpContext class is User, which contains security information about the user who made the Web request. The User property returns a type the implements the IPrincipal interface

Write the code which will create a cookie containing the user name DotnetFunda and the current date to the user computer. Set the cookie as that remains on the user computer for 10 days?Posted by: Tripati_tutuHttpCookie cookieWebInfo = new HttpCookie("WebInfo");

CookieWebInfo["Name"] = "DotnetFunda";

// here CookieWebInfo is an object of class HttpCookie

CookieWebInfo["Time"] = DateTime.Now.ToString();

cookieWebInfo.Expires = DateTime.Now.AddDays(10);

Response.Cookies.Add(cookieWebInfo);

Here the HttpCookie class is under the System.Web namespace. Here 'Expires' sets the duration, when cookie expires.

Describe the difference between Web and Window applications?Posted by: Tripati_tutuWeb Forms: These are used for server controls, HTML controls, user controls, or custom controls that is created especially for the Web forms. Web applications are displayed in a browser only. These are instantiated on the server; it sent to the browser and destroys immediately. These can run in any machine if that machine supports browser. 

Windows Forms: Windows applications can run on the same machine as they are displayed only on that machine. It displays their own windows and has more control over how those windows are going to display. These are instantiated and it exists for as long as needed and is destroyed.

What are Button HTML control and the Button Server control? What is the main difference between

Page 20: ASP

them?Posted by: Tripati_tutuThe Button HTML control is used to work as a control in forms, and it can also be used to performs actions anywhere on the form through scripts. It is used to display a button like push button. These buttons may be a submit button or a command button. 

The Button control allows you to create a push button on the Web Forms page. Here you can dynamically add a Button web server control to a page by writing certain codes. 

The Button HTML control triggers the event procedure defined in the button onclick event attribute, which runs at the client side. When clicked on the button, the Button server control triggers an ASP.NET Click event procedure on the server that is written on the asp.net code behind page.

What are the two different levels of variables that are supported by Asp.net?Posted by: Tripati_tutuThere are two levels of variables supported in ASP.NET. 

• Page level variable: int, float, char, string and all other .net data type whose scope is limited to that particular page only. 

• Object level variable: Application Level, Session Level that is used to access the data throughout the application.

Explain what is the purpose of using EnableViewState property?Posted by: Tripati_tutu• When a page is postback, then it allows the page to save the users input on a form. • It also saves all the server side values as a hidden value on the page before sending that page to the clients for a particular given control in the ViewState. • When a page is posted back to the server, at the same time the server control is recreated within the state stored in ViewState.

What are the different types of Caching in ASP.Net ?Posted by: ChvrsriTypes of Caching 

Caching in ASP.NET can be of the following types 

• Page Output Caching • Page Fragment Caching • Data Caching

Page 21: ASP

What are the properties and methods of cache Class ?Posted by: ChvrsriCahe Class ::

The Add/Insert method of the Cache class is used to add/insert an item into the cache. The Remove method removes a specified item from the cache. The Cache class contains the following properties and methods.

Properties

• Count • Item 

Methods 

• Add • Equals • Get • GetEnumerator • GetHashCode • GetType • Insert • Remove (Overloaded) • ToString

What is Application Pooling and what is its advantage ?Posted by: ChvrsriApplication Pooling ::

An Application Pool can contain one or more applications and allows us to configure a level of isolation between different Web applications. 

For example, Advantage :

if you want to isolate all the Web applications running in the same computer, you can do this by creating a separate application pool for every Web application and placing them in their corresponding application pool. Because each application pool runs in its own worker process, errors in one application pool will not affect the applications running in other application pools. Deploying applications in application pools is a primary

Page 22: ASP

advantage of running IIS 6.0 in worker process isolation mode because you can customize the application pools to achieve the degree of application isolation that you need.

What is the default expiration period for Session and Cookies, and maximum size of ViewState?Posted by: Tripati_tutuThe default Expiration Period for a Session is 20 minutes. 

The default Expiration Period for a Cookie is 30 minutes. 

The maximum size of the viewstate is 25% of the page size.

Describe about Server Side State Management?Posted by: Tripati_tutuThe Sever side state management technique provides better security and reduces bandwidth. Basically this option is for storing page information that tends to have security than client side options, but they can use more web server resources which may lead to scalability issues when the size of the information is large.

ASP.Net provides several options to implement Server Side State Management are explained below.

Application State: This State information is available to all pages, regardless of which user requests a page. The Application State variables are the global variables for an ASP.NET application. The ASP.NET provides application state via the HttpApplicationState class. You can also store your application specific values in application state, which is managed by the server. 

Session State: The Session State information is available to all pages opened by a user during a single visit. This method stores the session specific information (that is values and objects in session state) which is managed by the server and that is visible only within the session. This session state is available as the HttpSessionState class. The Session State which identifies the requests from the same browser during a limited time and it provides the ability to persist variable values for the duration of that session.

Profile properties: It allows you to store user specific data. Unlike session state, the profile data is not lost when a user's session expires. This allows you to manage the user information without requiring, creating and maintaining your own database. It can be used in both multi-computer and multi-process configurations. This property provides a generic storage system that allows you to define and maintain any kind of data while making the data available in a type-safe manner. 

Database support: It is also used for database support to maintain the state on your web site. This is used basically with the help of cookies or session state. The Database Support to maintain state information by using a relational database for different reasons like security, personalization, consistency, and data mining.

Page 23: ASP

What are the advantages and disadvantages of using Session State?Posted by: Tripati_tutuThe advantages of using session state are: 

• It is easy to implement and is just similar to using View State. • Accessing of data is very fast as it stores session data in memory object of the current application domain.• It ensures platform scalability and it works in the multi-process configuration. • Also it ensures data durability, since the session state retains data even if ASP.NET work process restarts (in outproc session). 

The disadvantages of using session state are: 

• As the session state data is stored in server memory, it is not advisable to use session state when you are working with large sum of data. • With the use of Session state, it will affect the performance of memory, because session state variable stays in memory until you destroy the state. • If the worker Process or application domain recycles all session data will be lost. • We can't use it in web Garden scenarios and is not suitable for web farm scenarios also.

Explain what are the different Session State Modes that supports ASP.NET?Posted by: Tripati_tutuASP.NET supports three Session State modes. Those are 

InProc: This mode is faster among all the storage modes and it stores the session data in the ASP.NET worker process. It also effects on performance of data if the amount of data to be stored is large.

StateServer: This mode is basically for serialization and de-serialization of objects. State Server mode is slower than InProc mode as it stores data in an external process. State Server mode is maintained on different systems and the session state is serialized and stored in memory in a separate process.

SQLServer: Basically this mode can be used in the web form which secures the session state and it is reliable for the storage of a session state. In this storage mode, the Session data is serialized and stored in a database table in the SQL Server database.

In which way you identify a Master Page and how you can bind a Content Page to a Master Page? Can a master page be nested?Posted by: Tripati_tutuThe master page is identified by @Master directive and that replaces the @Page directive which is used for ordinary .aspx or content page pages. 

Page 24: ASP

The MasterPageFile attribute of a content page's @Page directive is used to bind a Content Page to a Master Page. 

Yes, the master pages can be nested.

How can you dynamically assign a Master Page?Posted by: Tripati_tutuYou can assign a master page dynamically in the PreInit event of the content page by using the Page class MasterPageFile property. Below is the code snippet to assign a master page dynamically. 

void Page_PreInit(Object sender, EventArgs e)

{

this.MasterPageFile = "MasterPage.master";

}

Explain what are the different ways to globalize the web applications?Posted by: Tripati_tutuThere are three different ways to globalize the web applications: 

Detect and redirect approach: In this approach the applications have lots of text file content which requires translation and few are some executable components. In this we can create a separate Web application for each supported culture present in that application and then identify the user’s culture and then redirect the request to the appropriate application. 

Run-time adjustment approach: This approach is best for that kind of applications where limited amounts of content are present. For this kind of approach we can create a single Web application that detects the user’s culture and that adjusts output at run time using format specifiers and other tools. 

Satellite assemblies approach: With this approach we create a single Web application which stores culture-dependent strings in resource files and that are compiled into satellite assemblies. It identifies the user’s culture and load strings from the appropriate assembly at run time. This approach is best for applications which generates content at run time or that have large executable components.

What's the advantage of using Windows authentication in a Web application?Posted by: Tripati_tutuThe advantage of using Windows authentication in a Web Application is: 

Page 25: ASP

• Web application can use the same security that applies to your windows application which will authenticate to your window like user names, passwords, and permissions. 

• To access the Web application, users logged on to the network. It is important that user doesn’t logged on again because when window is opened then it will automatically authenticate the user to use web application.

How will you get a User Identity in an application?Posted by: Tripati_tutuWith the help of User object’s Identity property you can be able to get User Identity. The Identity property which returns an object that includes the user name and the role information. 

Sample Code Snippet: 

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

Label1.Text = User.Identity.IsAuthenticated.ToString();

Label2.Text = User.Identity.Name;

Label3.Text = User.Identity.AuthenticationType;

}

}

What is the difference between ReadOnly and Const?Posted by: Tripati_tutuReadOnly: A ReadOnly field can be initialized either at the declaration time or in the constructor. The ReadOnly fields can have different values depending on the constructor used. The ReadOnly fields can be used for run time constants. It marks the field as unchangeable but the property can be changed inside the constructor of the class. 

Const: A Const field can only be initialized at the declaration of the field. The Const fields can be used for

Page 26: ASP

compile time constants and it can’t change at run time. In a program where ever we are using Const, then that value will be replaced by the compiler. 

Code Snippet: 

namespace ClassLibrary

{

public class Test

{

public const int ConstValue = 10;

public static readonly int ReadonlyValue = 20;

}

}

By looking to the above code snippet, we can say ConstValue is declared as literal and it has an int value assigned to it whereas ReadonlyValue is declared as initonly and it has not been assigned any value to it.So we can say that if a type is declared as Const, its value is known as compile time, but when the value that is declared as static readonly field, that cannot be known at compile time.

What is the meaning of neutral cultures in ASP.NET?Posted by: Tripati_tutuA neutral culture is a culture which represents general languages like English or Spanish and a specific language and region. The ASP.NET application which assigns that culture to all the threads running for that Web application and those Threads are the basic units where the server allocates the process time. When user set culture attribute for a Web application in Web.config, then it will maintain multiple threads for a Web application within the aspnet_wp.exe worker process.

What is using statement versus using directive?Posted by: Tripati_tutuYou can create an instance in a using statement to ensure that Dispose is called on the object when the using statement is closed or else we can say Using automatically calls the stream object’s Dispose method when the Using statement is closed. A using statement can be exited either when the end of the using statement is reached or if an exception is thrown and control leaves the statement block before the end of

Page 27: ASP

the statement. 

The using directive has two uses: • Create an alias for a namespace (a using alias). • Permit the use of types in a namespace, such that, you do not have to qualify the use of a type in that namespace (a using directive).

Describe the Managed Execution Process?Posted by: Tripati_tutuIt includes the following steps that are as follows: 

• First you choose a compiler. To get the benefits provided by the common language runtime, you must use one or more language compilers that target the runtime. 

• You can compile your code to Microsoft intermediate language (MSIL) and when compiling, it translates your source code into MSIL and generates the required metadata. 

• When you are compiling the code from MSIL to native code, then at that execution time, a just-in-time (JIT) compiler translates the MSIL into native code. During this compilation, code passes a verification process which examines the MSIL and metadata to find out whether the code can be determined to be type safe or not. 

• Executing your code. The common language runtime provides the platform that enables execution to take place as well as a different type of services that can be used during execution.

What is Active Directory? Explain the steps to configure ActiveDirectoryMembershipProvider(ADMP)?Posted by: Tripati_tutuIt is a programmatic interface for Microsoft Windows directory. It enables your applications to interact with diverse directories on a network, using a single interface. Visual Studio .NET and the .NET Framework that makes it easy to add ADSI functionality with the DirectoryEntry and DirectorySearcher components. Using this, you can create applications that perform common administrative tasks, such as backing up databases, accessing printers, and administering user accounts etc. 

The ActiveDirectoryMembershipProvider is a membership provider that is included in ASP.NET Framework. You can use this provider to store the user information in Active Directory or ADAM (Active Directory Application Mode). This is a light weight version of Active Directory. If you want to use ASP.NET membership with ADAM, then you need to follow these steps: 

• Create an ADAM instance and create the required classes. • Configure your application to use the ActiveDirectoryMembershipProvider and connect to the ADAM instance. 

Page 28: ASP

For more details, read http://msdn.microsoft.com/en-us/library/hsxk2787(VS.71).aspx

What is Access Control Lists? How to add a rule to the Access Control List?Posted by: Tripati_tutuThese are the way resources such as directories and files are secured in the NTFS file system which is commonly used file system in all windows. You can also view this file by selecting the security tab from the file’s properties dialog. To get this security tab follow the steps that is mentioned below... Step-1: Create a text file. Step-2: Right click on that file and click on properties. Now you will get that security tab. 

Code snippet to add a rule to the Access Control Li st: 

System.Security.AccessControl.FileSecurity sec =

System.IO.File.GetAccessControl (Server.MapPath(“Test.txt”));

sec.AddAccessRule (new System.Security.AccessControl.FileSystemAccessRule (

@”WIN7\TestUser”,

System.Security.AccessControl.FileSystemRights.FullControl,

System.Security.AccessControl.AccessControlType.Allow

)

);

System.IO.File.SetAccessControl (Server.MapPath (“Test.txt”), sec);

What are different classes that are present in .Net framework?Posted by: Tripati_tutuBelow are few classes that are present in .Net framework... 

Page 29: ASP

A) File class- It enables you to represent a file on your hard drive. You can use the file class to check whether a file exist or not, create a new file, delete a file, and also can perform many other file related tasks. 

B) Graphics class- It enables you to work with different types of images such as GIF, PNG, BMP and JPEG images. You can use the Graphics class to draw rectangles, arcs, ellipse and other elements on an image.

C) Random class- It enables you to generate a random number. 

D) SmtpClient class- It enables you to send email. You can use SmtpClient class to send emails that contain attachments and HTML content. 

These are only four examples of classes in the framework. The .Net framework contains almost 13,000 classes that you can use when building applications.

How do you implement the custom output caching?Posted by: Tripati_tutuCreate a custom output-cache provider as a class that derives from the new System.Web.Caching.OutputCacheProvider type. You can then configure the provider in the Web.config file by using the new providers subsection of the outputCache element, as shown below: 

<caching>

<outputCache defaultProvider="AspNetInternalProvider">

<providers>

<add name="DiskCache"

type="Test.OutputCacheEx.DiskOutputCacheProvider, DiskCacheProvider"/>

</providers>

</outputCache>

</caching>

Then specify the newly created and configured custom cache provider as below: 

<%@ OutputCache Duration="60" VaryByParam="None" providerName="DiskCache" %>

Page 30: ASP

How do you implement ViewState for a control in ASP.Net 4.0?Posted by: Tripati_tutuIn ASP.NET 4.0, Web server controls include a ViewStateMode property that lets you disable view state by default and then enable it only for the controls that require it in the page. 

The ViewStateMode property takes an enumeration that has three values: Enabled, Disabled, and Inherit. 

Enabled enables view state for that control and for any child controls that are set to Inherit or that have nothing set. Disabled disables view state, and Inherit specifies that the control uses the ViewStateMode setting from the parent control. 

<asp:PlaceHolder ID="PlaceHolder1" runat="server" ViewStateMode="Disabled">

Disabled: <asp:Label ID="label1" runat="server" Text="[DeclaredValue]" /><br />

<asp:PlaceHolder ID="PlaceHolder2" runat="server" ViewStateMode="Enabled">

Enabled: <asp:Label ID="label2" runat="server" Text="[DeclaredValue]" />

</asp:PlaceHolder>

</asp:PlaceHolder>

What is View Control? How it relates ActiveViewChanged?Posted by: Tripati_tutuThe View Control is the part of the MultiView control and it does not support any special properties or methods. Its primary purpose is to act as a container for other controls. However, the view control does support the following two events: 

Activate- It raises when the view becomes the selected view in the MultiView control. Deactivate- It raises when another view becomes the selected view in the MultiView control. 

The multiview control which supports this event. This event is raised when a new view control is selected.

What a Wizard control can contain?

Page 31: ASP

Posted by: Tripati_tutuA Wizard control contains one or more WizardStep controls that represent steps in the wizard. The WizardStep control supports the following properties: 

AllowReturn- It enables you to prevent or allow a user to return to this step from a future step.

Name- It enables you to return the name of the WizardStep control. 

StepType- It enables you to get or set the type of wizard step. In this the possible values are Auto, Complete, Finish, Start, and Step. 

Title- It enables you to get or set the title of the WizardStep. The title is displayed in the wizard sidebar.

Wizard- It enables you to retrieve the Wizard control containing the WizardStep. 

The WizardStep also supports the following two events: 

Activate- Raised when a WizardStep becomes active. 

Deactivate- Raised when another WizardStep becomes active.

How will you specify what version of the framework your application is targeting?Posted by: Tripati_tutuIn Asp.Net 4.0 a new element "targetFramework" of compilation tag (in Web.config file) lets you specify the framework version in the web.config file as 

<?xml version="1.0"?>

<configuration>

<system.web>

<compilation targetFramework="4.0" />

</system.web>

</configuration>

It only lets you target the .NET Framework 4.0 and later versions.

Page 32: ASP

What is App_Data Folder?Posted by: Tripati_tutuThe App_Data folder holds the data stores utilized by the application. The App_Data folder can contain Microsoft SQL Express file (.mdf files), Microsoft Access files (.mdb files), XML files and any other file you want to keep.

What are the different ASP.Net controls?Posted by: Tripati_tutuThe ASP.Net framework contains over 70 controls. These controls can be divided into 7 groups:

1) Standard Controls: The standard controls enables you to render standard form elements such as buttons, input fields and labels. 

2) Validation Controls: The validation controls enable you to validate form data before you submit the data to the server. For example, you can use a RequiredFieldValidator control to check whether a user entered a value for a required input field. 

3) Rich Controls: The Rich controls enable you to render things such as calendars, file upload buttons, rotating banner advertisements and multi-step wizards. 

4) Data Controls: The data controls enable you to work with data such as database data. For example, you can use these controls to submit new records to a database table or display a list of database records.

5) Navigation Controls: The navigation controls enable you to display standard navigation elements such as menus, tree views, and bread crumb trails. 

6) Login Controls: The login controls enable you to display login, change password, and registration forms.

7) HTML Controls: The HTML controls enable you to convert any HTML tag into a server-side control.

What are the different types of server controls present in ASP.Net? When you will use them?Posted by: Tripati_tutuASP.Net provides two distinct types of server controls i.e. HTML server controls and Web server controls.HTML Server: When converting traditional ASP 3.0 web pages to ASP.Net web pages. When you want to explicitly control the code that is generated for the browser. 

Web Server: When you require a richer set of functionality to perform complicated page requirements.When you are developing web pages that will be viewed by a multitude of browser types and that require different code based upon these types.

Page 33: ASP

Explain about the readystate property in ASP.NET?Posted by: Tripati_tutuReadystate property is a property that can hold the responses of the server to the query that is generated from the client side. Each time when the readystate property changes, then the onreadystatechange function will be executed. Some of the values for the readystate property are as below... 

• If the status is zero the request is not initialized 

• If the status is one the request has been set up 

• If the status is two the request has been sent 

• If the status is three the request is in process 

• If the status is four the request is complete.

What are new things with ASP.Net 4 WebForms?Posted by: Tripati_tutuSome of the Features are: 

• Ability to set Metatags. • More control over viewstate. • Added and Updated browser definition files. • ASP.Net Routing. • The ability to Persist Selected rows in data Control. • More control over rendered HTML in FormView and ListView Controls. • Filtering Support for datasource Controls.

What is RedirectPermanent in ASP.Net 4.0?Posted by: Tripati_tutuIn earlier Versions of .Net, Response.Redirect was used, which issues an HTTP 302 Found or temporary redirect response to the browser (meaning that asked resource is temporarily moved to other location) which inturn results in an extra HTTP round trip. ASP.NET 4.0 however, adds a new RedirectPermanent that Performs a permanent redirection from the requested URL to the specified URL. and returns 301 Moved Permanently responses. E.g . RedirectPermanent("/newpath/foroldcontent.aspx");

A theme can contain how many Default and Named skin for each control ?Posted by: Santosh.impossible

Page 34: ASP

A theme can contain only one Default Skin for each type of control. However, a theme can contain as many Named skins as you please. Each Named Skin must have a unique name. 

Please find the below sample code: 

TextBox.Skin: <asp:TextBox SkinID="DashedTextBox" BorderStyle="Dashed" BorderWidth="5px" runat="server" /><asp:TextBox BorderStyle="Double" BorderWidth="5px" runat="server"/> 

ShowNamedSkin: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowNamedSkin.aspx.cs"Inherits="TracingDemo.ShowNamedSkin" Theme="SimpleTheme" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Show Named Skin</title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="txtFirstName" runat="server" SkinID="DashedTextBox"></asp:TextBox><br /> <br /> <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox> </div> </form> </body> </html>

What is the difference between web service and remoting?Posted by: Tripati_tutu• Web services may be accessed using HTTP only. Remoting objects may be accessed over any protocol like TCP, SMTP and HTTP etc. • Web services are stateless whereas Remoting supports for both stateless and with state environment which is achieved using singleton and singlecall activation. • ASP.Net provides good support to create web services. They are easy to deploy. In comparison, Remoting is little bit complex. • Web services may be considered very reliable due to the fact that they are hosted on IIS. But in Remoting if IIS is not used then methods like plumbing have to be used to ensure the application reliability.• Using Web services only a limited number of types may be serialized (XML). Using Remoting, objects like

Page 35: ASP

SOAP object, Binary objects and XML objects may be serialized. • In .Net when we create an application that consumes a web service, the web service may or mayn’t be built using .Net. But while implementing Remoting in .Net both the applications must be built in .Net.

What is the use of @Page Directive?Posted by: Vpramodg@Page Directive is used to specify attributes that affect the page in the .aspx page (content page).

<%@Page Language=”C#” Debug=”true” %> 

<%@ Page attribute="value" [attribute="value"...] %> Eg: MasterPageFile Theme Title Trace

What is DataPager control, describe it?Posted by: Tripati_tutuThe DataPager serves as an external control to provide paging features. The DataPager class is used to page data and to display navigation controls for data-bound controls that implements the IPageableItemContainer interface and also associates the DataPager control with the data bound control. It provides a navigation bar on top or on bottom of the page (or both) to navigate to other pages according to the user's requirement. Below there is a description about different page field types. 

NextPreviousPagerField -Enables users to navigate through pages one page at a time, or to jump to the first or last page. 

NumericPagerField - Enables users to select a page by page number. 

TemplatePagerField - Enables you to create a custom paging UI. 

Below is the sample code to create a datapager: 

<asp: datapager PageSize="10" ID="DataPager1" runat="server" PagedControlID="ListView1">

<fields>

<asp:nextpreviouspagerfield ButtonType="Link" ShowPreviousPageButton="True" ShowNextPageButton="False"/>

Page 36: ASP

<asp:numericpagerfield />

<asp:nextpreviouspagerfield ButtonType="Link" ShowPreviousPageButton="False" ShowNextPageButton="True" />

</fields>

</asp:datapager>

Explain briefly what is DataList control?Posted by: Tripati_tutuThe DataList control is a data bound list control that displays items using templates. The DataList control supports selecting and editing of data. The contents of the DataList control can be manipulated by using templates. It acts as a container of repeated data items. DataList and GridView Web controls can contain child controls that raise events. Therefore, a DataList control may have a child control as part of a template that raises an event. The child control event is "bubbled up” (sent up) to the control's container. The container control raises an event called RowCommand with parameter values. These values allow one to determine which control raised the original event. One is then able to respond to this event. Alternatively, one can write individual event handlers for the child controls. 

• Using the DataSourceID property, binding to data source controls, such as SqlDataSource, ObjectDataSource, and XmlDataSource, is supported • Using the DataSource property, binding to an object that implements the System.Collections.IEnumerable interface is supported • DataList supports selecting and editing. Typically, the Repeater is mostly used for displaying data records. However, because of event bubbling, one is able to implement more advanced behavior within a Repeater control. • The display direction of a DataList control can be vertical or horizontal. • The layout of the DataList control is controlled with the RepeatLayout property. 

List of templates available in DataList: AlternatingItemTemplate - Works in conjunction with the ItemTemplate to provide a layout for all the odd rows with in the layout. 

EditItemTemplate - Allows for a row or item to be defined on how it looks and behaves when editing.

FooterTemplate - Allows the last item in the template to be defined. 

HeaderTemplate - Allows the first item in the template to be defined. 

ItemTemplate - This is used to define a row or layout for each item in the display. 

Page 37: ASP

SelectedItemTemplate - It allows for a row or item to be defined on how it looks and behaves when selected. 

SeparatorTemplate - This template is used between the items in the template. 

Below there is a sample code to create DataList control. 

<asp:DataList ID=" dlMyCountry" runat="server">

<ItemTemplate>

<asp:Label ID="Label1" runat="server" Text='<%# Eval("Country_Code") %>'></asp:Label>

<asp:Label ID="Label2" runat="server" Text='<%# Eval("Country_Name") %>'></asp:Label>

</ItemTemplate>

</asp:DataList>

private void BindGrid()

{

string sql = "Select * from Country Order By Country_Name";

SqlDataAdapter da = new SqlDataAdapter(sql, “Yourconnectionstring”);

DataTable dt = new DataTable();

da.Fill(dt);

dlMyCountry.DataSource = dt;

dlMyCountry.DataBind();

}

Page 38: ASP

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

BindGrid();

}

}

What is hidden field control?Posted by: Tripati_tutuHidden fields technique is widely used in ASP.NET programming. This control enables a developer to store a non-displayed value in the rendered HTML of the page. The HiddenField control is used to store a value that needs to be persisted across multiple postbacks to the server. Hidden fields are html input control with hidden type that store hidden data in the html. An example for a hidden field can look like this in your Web Page as: 

<asp:HiddenField ID="MyHiddenField" runat="server" Value=”Hidden field value”/>

It will be hidden to the user that means you can store some value but user cannot able to see that value in a webpage. But you should not keep any sensitive information in hidden field because it is available in a webpage, but user cannot see it directly. You can see the hidden field value by right click on a web page and go to "View Source". There you can see the hidden field value along with html tag available in a web page, so it is not secure.

What are GridView and ListView in ASP.NET?Posted by: Tripati_tutuGrid View: 

The grid view control is a powerful data grid control that allows you to display an entire collection of data, and sorting, and paging, and perform inline editing. 

• DataGrid requires you to write custom code for handling common operations like sorting, paging and

Page 39: ASP

manipulation of data in DataGrid. 

• DataGrid when bound to DataSource control can only support select operation on DataSource. Updating DataSource through DataGrid can be done only through custom ADO.NET code. 

• DataGrid supports a restricted event model. 

• DataGrid does not support adaptive rendering on different platforms. 

Features of Grid View: 

• Enhanced data source binding capabilities (Direct interaction with DataSource without any ADO.NET code) • Built-in support for sorting and paging functionality • Improved Design time features(Smart Panel Tag) • Customized pager user interface with Pager Template property • Additional Column types(Image Field) • New Event model which support for pre-event and post-event operations 

List View: 

ListView is a new databound control. ListView control is similar to GridView, Repeater, and DataList which helps us to display a table of data with some additional features. The list view control is basically an advanced ListBox control which allows you to add rows of data, but it also supports large and small icons, multiple columns, automatic label edit, column re-order, hot-tracking. ListView control can be a hybrid control between GridView and Repeater control. ListView control gives us more control on the rendered HTML output with edit/update/delete feature. Also, ListView control has a built in support for adding new row, sorting, etc. 

The four main modes of ListView control are: 

Icon - Displays items with large icons and your main text Small Icon - Displays items with small icons and your main text List - Displays items with your main text Detail - Displays items with small icons, your main text, and any other data to be displayed in columns and much more... 

Features of List View: • Can define its own template/Layout/Structure for the data display. • Edit/Update/Delete capabilities on the data displayed. • Built-in support for inserting new row. • Built-in support for sorting • Supports databinding via DataSource Controls including LINQ DataSource controls.

Page 40: ASP

How do you begin and end secure communication via SSL?Posted by: Tripati_tutuTo begin secure communication, specify https in an address. For example: 

<a href="https://www.dotnetfunda.com/home.aspx">Secure page.

</a>

To end secure communication, specify http as, For example: 

<a href="http://www.dotnetfunda.com/welcome.aspx">Not secure.

</a>

What is the role of the ASP.NET worker process? What is aspnet_wp.exe?Posted by: Tripati_tutuFor faster execution of ASP.NET applications that are primarily based to be hosted on IIS server, the aspnet_wp.exe comes into picture. This file (aspnet_wp.exe) is actually the ASP.NET worker process. The worker process is introduced to actually share the load on the IIS, so that application domains and other services may be maintained by a single worker process. 

The aspnet_wp.exe worker process is a part of the Microsoft ASP.NET framework and it is responsible for most of the technical processes in the ASP.NET framework. There may be multiple instances of ASP.NET worker process running on IIS 6 depending on multiple application pools. The worker process handles all the requests passed to the ASP.NET framework, so we can say that it’s actually the main engine that handles all requests pertaining to ASP.NET. For example, when a request for an .aspx page is received by the IIS server, the dll called aspnet_isapi.dll passes this request to the aspnet_wp.exe worker process.

What is DataSet and DataView?Posted by: VpramodgDataSet- is an object used to store the data retrieved from the database. It can contain one or more tables .Each table in the dataset is known as Datatable. The constraints supported by the datatable are

1)UniqueConstraint. 2)ForeignKeyConstraint. 

DataView - is used for the customized view of data of datatable, with the help of dataview we can filtered, searched or sort the data.

Page 41: ASP

Explain Form level validation and Field level Validation?Posted by: Tripati_tutuForm level validation is the validation step that is done after the filling up of the form is done. It’s usually when the user submits the forms. 

Field level validation provides immediate validation of the input given by the user. The events associated with field level validation are KeyDown, KeyPress, textchange, etc.

Explain how to configure Trace switches in the application's .config file? Give the code snippet of config file.Posted by: Tripati_tutuSwitches are configured using .config file. Trace switches can be configured and the trace output can be enabled or disabled in an application with the help of .config file. Configuring involves changing the value of the switch from an external source after being initialized. The values of the switch objects can be changed using the .config file. 

TraceSwitch offers five levels of tracing from 0 to 4 i.e. it expose the following properties. 

• TraceOff • TraceError • TraceWarning • TraceInfo • TraceVerbose 

This class provides support for multiple levels instead of the simple on/off control offered by the BooleanSwitch class. 

• Off - 0 Outputs no messages to Trace Listeners. • Error - 1 Outputs only error messages to Trace Listeners. • Warning - 2 Outputs error and warning messages to Trace Listeners. • Info - 3 Outputs informational, warning and error messages to Trace Listeners. • Verbose - 4 Outputs all messages to Trace Listeners. 

Code Snippet of config file: 

<configuration>

<system.diagnostics>

<switches>

Page 42: ASP

<add name=”LevelSwitch” value=”3” />

</switches>

</system.diagnostics>

</configuration>

To construct a TraceSwitch: 

TraceSwitch tSwitch=new TraceSwitch (“LevelSwitch”, “Trace Levels”);

System.Diagnostics.Trace.WriteIf (tSwitch.TraceInfo, “The Switch is 3 or more!”);

Here the TraceSwitch class returns true if the switch is at the same level or at the higher level than the property’s value. Here the TraceInfo property will return true if the switch value is set to 3 or more than 3.

What are the different ways to handle exceptions in ASP.NET? Explain them briefly?Posted by: Tripati_tutuThere are three different ways to handle exceptions in ASP.NET. These are 

a) Try/catch/finally block: You can enclose your codes in Try/Catch/Finally block. You can catch all exceptions in the catch block. The third part of this block is finally. It is executed irrespective of the fact that an exception has been raised. 

b) Using Events like Page_Error and Application_Error: • Page_Error: This is page event and is raised when any unhandled exception occur in the page.• Application_Error: This is application event and is raised for all unhandled exceptions in the ASP.NET application and is implemented in global.asax 

c) Using Custom error page: The <customErrors> section in web.config has two attributes that affect what error page is shown: defaultRedirect and mode. The defaultRedirect attribute is optional. If provided, it specifies the URL of the custom error page and indicates that the custom error page is shown instead of the Runtime Error. The mode attribute is required and accepts three values: On, Off, and RemoteOnly. These values have the following behavior: On - indicates that the custom error page or the Runtime Error is shown to all visitors, regardless of whether they are local or remote. Off - specifies that the Exception Detail is displayed to all visitors, regardless of whether they are local or remote. 

Page 43: ASP

RemoteOnly - indicates that the custom error page or the Runtime Error that is shown to remote visitors, while the Exception Detail is shown to local visitors.

Explain the points that differentiate between login controls and Forms authentication?Posted by: Tripati_tutu• Forms authentication can be easily implemented using login controls without writing any code.• Login controls can perform different functions like prompting for user credentials, validating them and issuing authentication just as the Forms Authentication class. • The Forms Authentication class is used in the background for the authentication ticket and ASP.NET membership is used to validate the user credentials. • Login controls provides form authentication. If we implement authentication through Forms Authentication then we do it through code. On the other hand, login controls allows the easy implementation on the basis of Forms Authentication without writing any code. The class used for login controls are also Forms Authentication class. So instead of creating your own set of user credential validations and issuing of authentication ticket, it is simpler to use a normal login control.

What is Session Identifier?Posted by: Tripati_tutuSession Identifier is used to identify session. It has SessionId property. When a page is requested, browser sends a cookie with a session identifier. This identifier is used by the web server to determine if it belongs to an existing session or not. If not, a Session ID (120 - bit string) is generated by the web server and sent along with the response.

What are the advantages and disadvantages of using Outproc Session State?Posted by: Tripati_tutuThe advantages of using session state are: 

• It ensures data durability, since session state retains data even if ASP.NET work process restarts.• It works in multi-process configuration, thus ensures platform scalability. 

The disadvantages of using session state are: 

• Since data in session state is stored in server memory, it is not advisable to use session state when working with large amount of data. • Session state variable stays in memory until you destroy it, so too many variables in the memory that effects on the performance of the session state.

How do you provide secured communication in ASP.NET?Posted by: Tripati_tutu

Page 44: ASP

ASP.NET provides secured communication using Secure Sockets Layer. To use this SSL application we need to have an encryption key called a server certificate configured in IIS. 

When a user requests a secured page, the server generates an encryption key for the user’s session. The encrypted response is then sent along with encryption key generated. In the client side, the response is then decrypted using same encryption key.

How do we implement ASP.NET Globalization?Posted by: Tripati_tutu• Create a resource file and compile them into a binary resource file. • Create satellite assembly for each of the resource file for each culture. • Store them in separate folder for easy access and replacement. • Read the resources from the satellite assembly that is stored in different folders based on the location and culture.

Define Error Events?Posted by: Tripati_tutuASP.NET supports events. When any unhandled exception occurs in an application, an event occurs, that events are called as Error Events. 

ASP.NET is having two events to handle exceptions. • Page_Error: This is page event and is raised when any unhandled exception occur in the page.• Application_Error: This is application event and is raised for all unhandled exceptions in the ASP.NET application and is implemented in global.asax 

The Error events have two methods to handle the exception: • GetLastError: Returns the last exception that occurred on the server. • ClearError: This method clear error and thus stop the error to trigger subsequent error event.

Why the exception handling is important for an application?Posted by: Tripati_tutuException handling is used to prevent application from unusual errors occurrences at the time of execution. If the exceptions are handled properly, the application will never get terminated abruptly.

What is Shared (static) member?Posted by: Tripati_tutu# It belongs to the type but not to any instance of a type. # It can be accessed without creating an instance of the type. # It can be accessed using the type name instead of the instance name. 

Page 45: ASP

# It can't refer to any instance data.

Explain the aim of using EnableViewState property?Posted by: Tripati_tutuIt allows the page to save the users input on a form across postbacks. It saves all the server side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server, the server control is recreated with the state stored in viewstate.

What are the different types of Session state managements available with in ASP.NET?Posted by: Tripati_tutuASP.NET provides In-Process and Out-of-Process state management. 

In-Process stores the session in memory on the web server. 

Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. 

Out-of-Process state management requires that all objects stored in session are serializable.

What are resource files and explain the steps to generate a resource file?Posted by: Tripati_tutuThe resource files are those files which are in XML format. They contain all the resources needed by an application. These files can be used to store string, bitmaps, icons, fonts etc. 

Steps to generate a resource file: a. Open the web page in the design view. b. Click Tools c. Select generate local resource d. .resx file generated in the solution explorer e. Type in the resources. The file contains the key and value pairs. f. Save the file.

What is Absolute and Sliding expiration in .NET?Posted by: Tripati_tutuThese two are Time based expiration strategies. 

Absolute Expiration: In this case the Cache expires at a fixed specified date or time. E.g.: Cache. Insert ("ABC", ds, null, DateTime.Now.AddMinutes (1), Cache.NoSlidingExpiration);

Page 46: ASP

The cache is set to expire exactly two minutes after the user has retrieved the data. 

Sliding Expiration: The cache duration increases by the specified sliding expiration value every time the page is requested. E.g.: Cache.Insert ("ABC", ds, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes (1));Here ‘ds’ stands for Dataset.

What is Cache Callback in Cache?Posted by: Tripati_tutuThe cache object has dependencies e.g. it stores relationships to the file. Cache items remove the object when these dependencies change. For this we would need to simply execute a callback method whenever items are removed from the cache to add the items back in cache. 

E.g.: We have a string variable string var="hello" and store it in cache. This item would be removed from the cache if value is changed from "hello" to "bye". In such a case we need to simply write a callback function which would add updated var back in cache as it’s been removed as a result of its dependencies changing.

Is it possible to apply theme to a Master page?Posted by: Santosh.impossibleWith reference to the following link: http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx 

If we add the theme attribute to the @ Master directive, the page will raise an error when it runs.

But we can apply themes by using the following approaches:- 

1. As master pages is placeholder/templated and it is merged with the content page very early in the page execution life-cycle. The theme that is applied to the the content pageis applied to the master page as well.

2. If the site as a whole is configured to use a theme by including a theme definition in the pages element.

Hence there is no theme attribute in the @Master directive.

What are the validation controls available in asp.net?Posted by: Vpramodg1.RequiredFieldValidator - Helps in ensuring that a value has been entered for a field. 

2.CompareValidator - Checks if the value of a control matches the value of another controls or variable.

Page 47: ASP

3.RangeValidator - Checks if the value entered in a control is in specified range of values. 

4.RegularExpressionValidator - Checks if the value entered matches the regular expression that specified.

5.CustomValidator - The value entered is checked by a client-side or server side function created by us.

6.ValidationSummary - A List of all validation errors occurring in all the controls is created and can be displayed on the page.

What are the two levels of variable supported by Asp.net?Posted by: Vpramodg1.Page -Level Variables eg:-String,int,float. 2.Object-Level Variables eg:-Application Level,Session Level

Difference between Session object and Profile object in ASP.NET?Posted by: PeermohamedmydeenProfile 1.Profile object is persistent. 2.Profile object uses the provider model to store information. 3. Profile object is strongly typed. 4. Mostly used for anonymous users. 

Session 1.Session object is non-persistant. 2.Session object uses the In Proc, Out Of Process or SQL Server Mode to store information. 3. Session object is not strongly typed. 4. Used for authenticated users.

How many tables can we store in the dataset?Posted by: Shankul2784There is no limit for the storing of tables in the dataset. We can use many tables in a single dataset.

What is the maximum size of viewstate?Posted by: Shankul2784The maximum size of the viewstate is 25% of the page size.

What is the maximum Number of Tables Stored in Dataset?Posted by: Shankul2784

Page 48: ASP

The maximum size is limited by Int32. So 2^32 is the maximum number of DataTables you can hold inside a DataSet. So the max size is 2 billion.

Who calls the validation controls?Posted by: Shankul2784In ASP.NET 1.0 it was handled by webuivalidation.js script file. The scripts are now included in the page straight from the DLL. This is done through the special handler (/WebResource.axd), so you can't edit the javascript files.

If there is master page attached to the aspx page then which page load event will fire first?Posted by: Shankul2784NOTE: This is objective type question, Please click question title for correct answer.

If there are 5 rows in the datatable & it is bound to the gridview then how many times item_bound event will run?Posted by: Shankul2784for 7 times. 5 for the items, 1 for header & 1 for footer.

If there is one apllication, containing 10 folders, then how many maximum web.config can contain in that application?Posted by: Shankul2784NOTE: This is objective type question, Please click question title for correct answer.

Can we put web.config in sub folders & which will applicable for the application?Posted by: Shankul2784We can put one web.config in each subfolders but which is at the application root folder web.config will consider as the main web.config.

What is the maximum size of uploading file?Posted by: Shankul2784In the web.config.comments file, find a node called <httpRuntime> that looks like the following:<httpRuntime executionTimeout="110" maxRequestLength="4096" requestLengthDiskThreshold="80" useFullyQualifiedRedirectUrl="false" 

Page 49: ASP

minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="5000" enableKernelOutputCache="true" enableVersionHeader="true" requireRootedSaveAsPath="true" enable="true" shutdownTimeout="90" delayNotificationTimeout="5" waitChangeNotification="0" maxWaitChangeNotification="0" enableHeaderChecking="true" sendCacheControlHeader="true" apartmentThreading="false" /> 

A lot is going on in this single node, but the setting that takes care of the size of the files to be uploaded is the maxRequestLength attribute. By default, this is set to 4096 kilobytes (KB). Simply change this value to increase the size of the files that you can upload to the server. If you want to allow 10 megabyte (MB) files to be uploaded to the server, set the maxRequestLength value to 11264, meaning that the application allows files that are up to 11000 KB to be uploaded to the server.

What is the Default Expiration Period For Session and Cookies?Posted by: BangaruBabuSession The default Expiration Period for Session is 20 minutes 

Cookies The default Expiration Period for Cookie is 30 minutes

what is the default port for Http and Https ?Posted by: Deepak.pandey.net2008NOTE: This is objective type question, Please click question title for correct answer.

What is the use of Global.asax File in ASP.NET Application ?Posted by: SamanthajyestaThe Global.asax file is an optional file and can be stored in root directory. This File is in accesible for web-sites. This Global.asax file contained in HttpApplicationClass. In Global.asax file we can declare global variables like for 

Page 50: ASP

example the variables used in master pages because same variables can be used for different pages right.It provides more security than others. The Global.asax file is used to handle application-level and session-level events. we donot worry about configuring Global.asax because it is itself configured. Accessing the Global.asax file can not be possible. while one request is in processing it is impossible to send another request, we can not get response for other request and even we can not start a new session. while adding this Global.asax file to our application bydefault it contains five methods, Those methods are: 1.Application_Start. 2.Application_End. 3.Session_Start. 4.Session_End. 5.Application_Error.

what is yeild keyword in .net ?Posted by: PavanandeyWhen ever user want to return a value from an iterator block and again contine from in the iterator block we use yeild keyword it is used to return the value from a iterator block, it is not supported in vb.net

How can we Filter rows in a Datatable ?Posted by: PavanandeyA filter condition can be specified on a datatable to filter row based on the condition specfied 

datatable = datatable.select("Condition");

Can we have same method with same name and signature in a using partial class ?Posted by: PavanandeyPartial class is the concept of diving a class file in to different files or a single file to enhance the productivity . 

We cannot have the same method with same name and signature in partial class it give a compile time exception

what is the difference between garbage collection and Dispose MethodPosted by: Pavanandey

Page 51: ASP

if you want to delete resources(objects) those are not using you should not worry about that garbage collecter implicitly call finalize() method and remove all such object but if you want to delete object forcefully(The larger object you want to delete after completeing task) than you can explicitly call dispose() method.

What is the use of DataPager control?Posted by: RajaDataPager control is the new control introduced in the ASP.NET 4.0. This control is used to do pagination in the Data controls like ListView Server control. 

The typical syntax of DataPager control is 

<asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="5" QueryStringField="pageid">

<Fields>

<asp:NumericPagerField ButtonCount="5" />

</Fields>

</asp:DataPager>

Where PagedControlID is the id of the Listview, PageSize is the number of records to be displayed in the page, QueryStringField is the querystring for the current page number. 

The fields properties can be used to show how many pagination button you would like to have when asp.net creates the paging for your ListView control. 

More about DataPager control can be found at http://www.dotnetfunda.com/articles/article122.aspx

Name of some of the types of evidence in Dot Net in context of CASPosted by: Puneet208841) Site 2) Strong Name 3) Zone 4) URL etc. are few of the evidences in dot net CAS used while creating code groups

Page 52: ASP

What is the class for getting the information that is on Clipboard of your system in windows app ?Posted by: Puneet20884System.Windows.Clipboard is the class used to get what is on clipboard like text , mage etc.

What are the Security policy levels in Dot Net ?Posted by: Puneet208841) Enterprise 2) Machine 3) User and 4) Application Domain 

each of these are independent from each other and Each level has its own code groups and permission sets.

What is Security policy ?Posted by: Puneet20884The configurable set of rules that the CLR follows when determining the permissions to grant to code.

Main Difference between User groups and code groups.Posted by: Puneet20884User groups control the authorization only based on distributed Access Control Lists linked to each resource whereas code groups are using centralized permission sets.

What is Code group in Dot Net in context to CAS ?Posted by: Puneet20884It's a logical grouping of code that's having a specified condition for a membership. FOr Example code in an assembly can belong to one code group in another assembly , the code can bleong another group .

What is Nothing premission-set in dot net ?Posted by: Puneet20884It means for no premissions for the code against CAS.

What is FullTrust premission-set in dot net ?Posted by: Puneet20884It means for all the premissions for the code against CAS.

Page 53: ASP

Name few built in permission-sets in Dot NET !!Posted by: Puneet208841) FullTrust 2) LocalIntranet 3) Internet 4) Execution 5) Nothing 

as some of the premission-sets in dot net framework

What's the major role of CLR for CAS ?Posted by: Puneet20884The Common Language Runtime allows code to do only those tasks that the code has permission to perform. Hence CAS is CLR's security system that enforces security policies by preventing unauthorized access to protected resources and operations like File system , Printer etc

Elements of CAS ?Posted by: Puneet20884permission sets permissions policy evidence code groups

What's the Purpose of System.Collections.Generic ?Posted by: Puneet20884It's having the interfaces and classes which define generic collections, which enable users to create strongly typed collections that provide better type safety and performance.

Name the Namespace used for interfaces and classes that defines the various collections of objects like lists, queues, bit arrays, hash tables, dictionaries etc.Posted by: Puneet20884System.Collections

What is the root class of the object hierarchy ?Posted by: Puneet20884Object

Page 54: ASP

What are the types for floating numbers ?Posted by: Puneet20884Single (for 32 bit) and Double (for 64 bit)

Which namespace does the Color class comes under ?Posted by: Puneet20884It's System.Drawing

Which property need in the email functionality to set to send the content as HTML?Posted by: LakhangargIsBodyHTML=True

What is the Namespace of ForAuthentication class?Posted by: LakhangargSystem.Web.Security

Simple file extension for a dot net handler ?Posted by: Puneet20884.ASHX

Syntax example to add strong name to an assembly "C:\\aaaa.dll" i.e. to generate a strong name key value pair file.Posted by: Puneet20884sn -k "C:\\aaaa.dll"

Name the utility used for adding a strong name to an assembly.Posted by: Puneet20884sn.exe

What is GAC ?Posted by: Puneet20884its global assembly cache use to keep the public assemblies centralized to be used by any application on that machine (server)

Page 55: ASP

Name the utility used to add an assembly into the GAC.Posted by: Puneet20884gacutil.exe

Under which namespace does the Process class comes ?Posted by: Puneet20884System.Diagnostics namespace

Which namespace provides the classes to interact with system processes.Posted by: Puneet20884System.Diagnostics

How to Avoid the tempering of your page's viewstate ?Posted by: Puneet20884using EnableViewStateMac="true" in the page directive in the HTML !!

Difference between DropDownList and ListBox in ASP.NETPosted by: PosterThe basic difference between DropDownList and ListBox in ASP.NET are following 

1. Only one items of DropDownList is visible when it renders on the page. More than one item of the ListBox is visible when it renders on the page. 2. Only one item can be selected in DropDownList. More than one item can be selected in Listbox provided SelectionMode is Multiple as in the below code snippets. 

Both controls are rendered as "<select>" html tag in the HTML. 

DROPDOWNLIST 

<asp:DropDownList ID="drop1" runat="server">

<asp:ListItem Text="One" Value="1" />

<asp:ListItem Text="Two" Value="2" />

</asp:DropDownList>

Page 56: ASP

For more details on DropDownList click http://www.dotnetfunda.com/tutorials/controls/dropdownlist.aspx

LIST BOX 

<asp:ListBox ID="list1" runat="server" SelectionMode="Multiple">

<asp:ListItem Text="One" Value="1" />

<asp:ListItem Text="Two" Value="2" />

</asp:ListBox>

For more details on ListBox click http://www.dotnetfunda.com/tutorials/controls/listbox.aspx 

Thank you.

What is Multi-Targeting in .net?Posted by: KumarsuduIn the previous version of Visual Studio, each Visual Studio release supports to a specific version of the .NET Framework. For example, VS 2002 only worked with .NET 1.0, VS 2003 only worked with .NET 1.1, and VS 2005 only worked with .NET 2.0. 

Now with the major change in VS2008 is to support "Multi-Targeting " Visual Studio 2008 is used to create projects that target .NET Framework version 2.0, 3.0, or 3.5. is what we call as "Multi-Targeting".

To create a excel file using COM. Whether we need to change any dcom configuration?Posted by: NishithrajYes we need to give the proper rights to the ASPNET user

How do we change the configurations of com dcom obhectsPosted by: NishithrajThrough the tool Dcomcnfg.exe

Whether we can use vbscript and javascript combination for validation?Posted by: NishithrajNo, we can't use them together, since the compilers are different.

Page 57: ASP

Whether for each modifications of code behind files we need to have a compilationPosted by: NishithrajYes, its required.

Whether javascript in the aspx(inline javascript) requires to compile each time for every modification?Posted by: NishithrajNot necessary just saving the aspx file and refreshing the browser is enough to get the updations

how many type can maintain state at server side ?Posted by: SagarpNOTE: This is objective type question, Please click question title for correct answer.

What are the different states in ASP.NET?Posted by: Abhisekview state session state application state

What is the use of profiles in ASP.NET?Posted by: AbhisekASP.NET provides profile feature to keep track of user data. Although a profile is similar to session state object, it persists between user session as it is stored in a database. 

For example we can use profiles we can keep track of the products ordered by an user in an shopping application and when the user starts a new session, you can display those products in a "ordered items" listbox.

How ASP .NET different from ASP?Posted by: AbhisekIn ASP.NET Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.

How to manage pagination in a page?Posted by: AbhisekUsing pagination option in DataGrid control. We have to set the number of records for a page, then it takes

Page 58: ASP

care of pagination itself.

What is smart navigation?Posted by: AbhisekThe cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.It is called smart navigation.

How do you validate the controls in an ASP.NET page?Posted by: AbhisekUsing special validation controls such as Range Validator, Email Validator we can validate the controls in ASP.NET page.

ASP.Net pages are compiled and are not interpreted. True or False.Posted by: AbhisekTrue

What is Authentication and Authorization.Posted by: SagarpAn authentication system is how you identify yourself to the computer. The goal behind an authentication system is to verify that the user is actually who they say they are. Once the system knows who the user is through authentication, authorization is how the system decides what the user can do.

what is PrePageExecute() eventPosted by: BlessybabyBy overrriding the PrePageExecute Method you can subscribe to the page's InitComplete Event and inject dependencies into any UserControl's found on the page at that time. Since the MasterPage is a UserControl, this includes the MasterPage as well if there is one.

How do we enable tracing ?Posted by: Blessybaby<%@ Page Trace="true" %>

What is Tracing in ASP.NET ?Posted by: BlessybabyTracing allows us to view how the code was executed in detail.

Page 59: ASP

What namespaces are necessary to create a localized applicationPosted by: Puneet20884NOTE: This is objective type question, Please click question title for correct answer.

State True or False: C# supports multiple-inheritancePosted by: Puneet20884False

Bitwise OR operator in C# isPosted by: Puneet20884NOTE: This is objective type question, Please click question title for correct answer.

The keyword ‘int’ maps to one of the following .NET typesPosted by: Puneet20884NOTE: This is objective type question, Please click question title for correct answer.

The method that transfers ASP.NET execution to another page, but returns to the original page when it is done isPosted by: Puneet20884NOTE: This is objective type question, Please click question title for correct answer.

The RangeValidator control supports the following datatypePosted by: Puneet20884NOTE: This is objective type question, Please click question title for correct answer.

How will you prevent your Image not to come from caching (Issue generally when you have editted with new one).Posted by: Puneet20884Add a querystring with you imageurl or src which is a random number or simply datetime, url will be different everytime, so will not pick from cache !!

How the SQL Server Session state entry is in the Web Config ??Posted by: Puneet20884

Page 60: ASP

<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />

Whether Cookies is used for session?Posted by: NishithrajIf the attribute Cookiless has the value false in web.config means the session uses cookies.

How do we do paging in gridview?Posted by: NishithrajMake Allowpaging=true also specify the PageIndex as some value

Namespace and Assembly?Posted by: Puneet20884Namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.

Diff b/w dataset.clone and dataset.copyPosted by: Puneet20884dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.); however it doesn’t copy the data. On the other hand dataset.copy, copies both the dataset structure and the data.

Diff b/w Const and readonly?Posted by: Puneet20884A const can not be static, while readonly can be static. 

A const need to be declared and initialized at declaration only, while a readonly can be initialized at declaration or by the code in the constructor. 

A const’s value is evaluated at design time, while a readonly’s value is evaluated at runtime.

Page 61: ASP

Diversities between static or dynamic assemblies ?Posted by: Puneet20884Assemblies can be static or dynamic. 

Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). 

Static assemblies are stored on disk in portable executable (PE) files. 

You can also use the .NET Framework to create dynamic assemblies, which are run directly from memory and are not saved to disk before execution.You can save dynamic assemblies to disk after they have executed.

How can you show the number of visitors of your appPosted by: Puneet20884By havving an application variable and Incrementing it in every session start. TO Achieve it use the Global.asax file's Application_Start and Session_Start Events.

What is the namespace provides MVC pattern?Posted by: NishithrajSystem.Web.Mvc

What are all the navigation controls available with asp.net?Posted by: NishithrajMenus Site Maps Tree View

Where smart naviagation is used?Posted by: NishithrajSmart navigation is used to keep the cursor postions in post backs

Whether ASP.NET is compiled or interpretted?Posted by: NishithrajIt is compiled one.

Page 62: ASP

What is MVC Pattern? How it is involved in ASP.NET?Posted by: NishithrajMVC means Model View Controller. Microsoft has implemented MVC pattern in ASP.NET for the easy building of web applications. The seperation of UI part and codebehind part is based upon the MVC.

What data type does the RangeValidator control support?Posted by: BlessybabyInteger, String and Date

What are different types of directives in .NET?Posted by: Blessybaby@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .aspx files <%@ Page AspCompat="TRUE" language="C#" %> @Control:Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .ascx files. <%@ Control Language="VB" EnableViewState="false" %> @Import: Explicitly imports a namespace into a page or user control. The Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @Import directives. <% @ Import Namespace="System.web" %> @Implements: Indicates that the current page or user control implements the specified .NET framework interface.<%@ Implements Interface="System.Web.UI.IPostBackEventHandler" %> @Register: Associates aliases with namespaces and class names for concise notation in custom server control syntax.<%@ Register Tagprefix="Acme" Tagname="AdRotator" Src="AdRotator.ascx" %>@Assembly: Links an assembly to the current page during compilation, making all the assembly's classes and interfaces available for use on the page. <%@ Assembly Name="MyAssembly" %><%@ Assembly Src="MySource.vb" %> @OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a user control contained in a page<%@ OutputCache Duration="#ofseconds" Location="Any | Client | Downstream | Server | None" Shared="True | False" VaryByControl="controlname" VaryByCustom="browser | customstring" VaryByHeader="headers" VaryByParam="parametername" %> @Reference: Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.

What is different b/w webconfig.xml & Machineconfig.xmlPosted by: BlessybabyWeb.config & machine.config both are configuration files.Web.config contains settings specific to an application where as machine.config contains settings to a computer. The Configuration system first searches settings in machine.config file & then looks in application configuration files, Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. There is only Machine.config file on a web server.

Page 63: ASP

How can you provide an alternating color scheme in a Repeater control?Posted by: BlessybabyUsing the AlternatintItemTemplate

Which two properties are on every validation control?Posted by: BlessybabyWe have two common properties for every validation controls 1. Control to Validate, 2. Error Message.

Which method do you use to redirect the user to another page without performing a round trip to the client?Posted by: BlessybabyServer.transfer

How do you register JavaScript for webcontrols?Posted by: BlessybabyYou can register javascript for controls using <CONTROL -name>.Attribtues.Add(scriptname,scripttext) method.

When do you set "<IDENTITY impersonate="true" />“?Posted by: BlessybabyIdentity is a webconfig declaration under System.web, which helps to control the application Identity of the web applicaton. Which can be at any level (Machine, Site, application, subdirectory, or page), attribute impersonate with "true" as value specifies that client impersonation is used.

What is web.config file ?Posted by: BlessybabyWeb.config file is the configuration file for the Asp.net web application. There is one web.config file for one asp.net application which configures the particular application. Web.config file is written in XML with specific tags having specific meanings.It includes data which includes connections,Session States,Error Handling,Security etc.

What is validationsummary server control?where it is used?.

Page 64: ASP

Posted by: BlessybabyThe ValidationSummary control allows you to summarize the error messages from all validation controls on a Web page in a single location. The summary can be displayed as a list, a bulleted list, or a single paragraph, based on the value of the DisplayMode property. The error message displayed in the ValidationSummary control for each validation control on the page is specified by the ErrorMessage property of each validation control. If the ErrorMessage property of the validation control is not set, no error message is displayed in the ValidationSummary control for that validation control. You can also specify a custom title in the heading section of the ValidationSummary control by setting the HeaderText property. You can control whether the ValidationSummary control is displayed or hidden by setting the ShowSummary property. The summary can also be displayed in a message box by setting the ShowMessageBox property to true.

What are the various ways of securing a web site that could prevent from hacking etc .. ?Posted by: Blessybaby1) Authentication/Authorization 2) Encryption/Decryption 3) Maintaining web servers outside the corporate firewall. etc.,

Name the validation control available in asp.net?.Posted by: BlessybabyRequiredField, RangeValidator,RegularExpression,Custom validator,compare Validator

What is a PostBack?Posted by: BlessybabyThe process in which a Web page sends data back to the same page on the server.

What is the difference between in-proc and out-of-proc?Posted by: BlessybabyAn inproc is one which runs in the same process area as that of the client giving tha advantage of speed but the disadvantage of stability becoz if it crashes it takes the client application also with it.Outproc is one which works outside the clients memory thus giving stability to the client, but we have to compromise a bit on speed.

What is the COM available to access the internet explorer in winForm?Posted by: NishithrajMicrosoft Internet Controls from the COM components

Page 65: ASP

I need to remove all items from the session. Tell me the code?Posted by: NishithrajSession.Contents.RemoveAll()

Whether inline, embedded and external style sheets are same?Posted by: NishithrajNo, they are different. 

External Style Sheet : An external style sheet is a seperate style sheet file used by many pages. 

Internal Style Sheet : An internal style sheet used specifically for a single page within the page 

Inline Styles : This can be achieved by the style property of each control.

Whether azure supports all OS?Posted by: NishithrajNo it supports Windows 7, Vista, Windows 2008 server.

What is the difference between document.getElementById('<%= btnMakeUpdate.ClientID %>').name AND document.getElementById('<%= btnMakeUpdate.UniqueID %>')?Posted by: VirendradugarThere is no difference. Both will use control's id seperated using $ sign.

MaintainScrollPositionOnPostback will work in Ajax Postback.Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

You are going to deploy a website on live server. Which build option you will select while building the website? 1. Debug 2. ReleasePosted by: VirendradugarYou should select Release .

Page 66: ASP

Your site is deployed on testing server and you make some change in web.config file stored on the server. What will happen to the user's who are accessing site at that time?Posted by: VirendradugarWhen you make any change in web.config file then IIS restarts automatically so all the session and application variables get reset. This can affect user drastically as their session is lost.

Can you add title to browser history point?Posted by: BhaktiYes, we can add.

Can you hash state information of URL ?Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Can you have multiple form tags in a page?Posted by: BhaktiYES. Page can have multiple form tags but only one of them can contain runat=”server” atrribute at a time.

Can you diplay image with hyperlink field of gridview?Posted by: BhaktiYes, you can. You just need to set its text property to the desired image. Code below can make it clear: 

<asp:GridView ID="GridView1" runat="server">

<Columns>

<asp:HyperLinkField Text="<img src='1.gif'/>" />

</Columns>

</asp:GridView>

You need to combine two database fields: Employee id and Name (EmpID : Name) and display in a single column of DataGrid. How can you do it?

Page 67: ASP

Posted by: BhaktiThis can be achieved any of the two ways. You can combine these two database fields in the template column of the gridview as shown below:

<asp:GridView ID="GridView1" runat="server">

<Columns>

<asp:TemplateColumn HeaderText="Name">

<itemtemplate>

<%# Container.DataItem("EmpID") %>, <%# Container.DataItem("Name") %>

</itemtemplate>

</asp:TemplateColumn>

</Columns>

</asp:GridView>

Other way of doing the same is to perform operation at database side. Retrieve the combined value as some column and bind the same with the databound column of the gridview. Database side(SQL): Select empid + ‘ : ‘ + name as name from emps; 

<asp:GridView ID="GridView1" runat="server">

<Columns>

<asp:BoundField DataField="Name">

</Columns>

</asp:GridView>

More preferable way is the second one as it will be less combursome.

Suppose you have CausesValidation Property to False for a button and you are calling a javascript function onClientClick event of the button. Will your javascript function will be called?Posted by: Virendradugar

Page 68: ASP

Yes. It will be called. As CausesValidation property, if set to false then it will not perform any validations related to asp.net Validation controls. 

Thanks, Virendra Dugar

What is CausesValidation Property in ASP.NET?Posted by: VirendradugarCausesValidation property determines whether validation must be performed on button click or not, if asp.net validation control are used. It can be either true or false. By default it is true. 

It is mostly used for Cancel/Reset button, where we don't want to perform any kind of validations.

<asp:Button ID="btnCancel" runat="server" Text="Cancel"

Visible="false" CausesValidation="false" />

Select name of the file to which trace log is written?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

See below given code. Will it run? try { Response.Write("In Try block"); } finally { Response.Write("In Finally block."); }Posted by: VirendradugarYes, it will run. 

A try block can exists without a catch block if there is finally block. Try block is only valid when there is either a catch block or finally block.

Is it possible to place a try block without a catch or a finally block?Posted by: VirendradugarNo. 

We cannot place try block without catch or finally block. A try block can only exists if there is a catch block or finally block.

Can you access the master page control in content page without FindControl method of master page?

Page 69: ASP

Posted by: VirendradugarYes. There is another way of accessing the master page control other than findcontrol() method. See below code:

MyMasterPage objMasterPage = this.Master;

objMasterPage.MasterPageTextBox1.Text = "Text set from Content Page.";

Can you access controls placed in master page in content page?Posted by: VirendradugarYes. We can access it. Using FindControl method of Master Page class. 

Master.FindControl("Header")

Is it possible to assign Master Page Dynamically?Posted by: VirendradugarYes. It's possible. You can assign master page in Pre_Init method of content page.

At which event Master Page and Content Page's contents are merged to build a single page?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Can you place content of child page, outside the content place holder of Master Page?Posted by: VirendradugarNo. You can not.

Can you place more than one contentplaceholder in a master page?Posted by: VirendradugarYes. It's possible to have.

What do you mean by ContentPlaceHolder in Master Page?Posted by: VirendradugarMaster Page works as a parent page for all child pages. There will be some area in master page, which will be used to replace the content of master page with the child page's content. That area is called ContentPlaceHolder. 

Page 70: ASP

<asp:ContentPlaceHolder ID="Body" runat="server">

</asp:ContentPlaceHolder>

Over here, content of child page will be displayed.

What are the parts of Master Pages?Posted by: VirendradugarMainly there are two parts of Master Page. 

1. The area for Master Page content 2. Area for the child Page, which is replace by child pages content.

What is the extension for a Master Page file?Posted by: VirendradugarThe extension of Master Page file is .master.

Master Pages be nested.Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Session state variables are type safe.Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Suppose you have deployed the website at production server. Now you have to change one of the style in style sheet file? How will you do it? After making change do you think, you need to compile it again and deploy it?Posted by: VirendradugarYou can directly change the style at runtime at production server. And there is no need to compile and deploying the website again.

Tell us the different ways to apply CSS in web page?Posted by: VirendradugarThere are 3 different ways to apply CSS to any page. 

Page 71: ASP

1. Create a style sheet file and define all your styles and just provide the reference of the style sheet page in the head section using link tag. 

2. Define style in head element of your page and use that styles in your page. 

3. Define style inline. Inline style means add style attribute to particular HTML element.

What should be done to avoid Script Injection?Posted by: VirendradugarTo avoid script injection, following things can be done 

1. Don't allow user to enter < and > characters as input. 2. Always Encode user's input and then store in the database.

What you should do to avoid SQL Injection?Posted by: VirendradugarTo avoid or minimize attack of SQL Injection, always use stored procedures or Parameterized query.

Limitation of boxing nullable type.Posted by: BhaktiIf we try to box the object which has no value(which is null) the object reference is assigned to null instead of boxing.

DetailsView and FormView - Which is better?Posted by: BhaktiBoth the controls, DetailsView and FormView are almost similar with the functionalities. Both supports insert, edit and delete for the records. The only difference we can find is the layout they support. DetailsView is composed of DataFields while FormView is composed of templates which leads to tabular format and flow format consequently. Hence, with concern to layout and design, FormView is more flexible to use.

What is DetailsView?Posted by: BhaktiDetailsView is used when you need to display various fields of a single record in a tabular format.

is there any event "ModeChanged"?

Page 72: ASP

Posted by: BhaktiYes. The event "ModeChanged" is available with DetailsView Control. It take place whenever DetailsView attempts to change between mode of edit,insert and read-only.DetailsView also supports "ModeChanging" event.

How can you cancel update/cancel of gridview ?Posted by: BhaktiThe simplest way to do it is, 

e.cancel = true;

For gridview, data-binding expressions are resolved at,…Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

You can use ^ operator to perform logical exclusive-or with,Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

What is ?? operator ?Posted by: Bhakti?? is called null-coalescing operator. It is used to define default value of nullable types.

Performing binary operations with Double type can result,...Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

What is Value EqualityPosted by: BhaktiTo determine whether two objects contain the same value or values is called Value Equality.

What is Reference EqualityPosted by: BhaktiTo determine whether two variables refer to the same underlying object in memory is called Reference

Page 73: ASP

Equality. ObjectReferenceEquals() is used to make this happen.

What are the common security threats for any asp.net application?Posted by: VirendradugarCommon threats are: 

1. Cross side scripting 2. SQL Injection 3. Storing Password in simple format. 4. No validation for user input.

Is it possible to delete application level settings if you have not logged in to application?Posted by: BhaktiIf you are using DeleteSetting function to accomplish the requirement then it is not possible. As DeleteSetting function requires to access the HKEY_LOCAL_USER registry key, which is not active until a user logs on interactively.

Is it possible to delete application’s all setting?Posted by: BhaktiYes, it is possible with DeleteSetting function. The function can take 3 arguments of application name, section name and key name. If all of these are present then it deletes the specified key. But in case if you have specified only first argument of application name, it deletes all settings. DeleteSettings(“testApp”) ‘ Deletes all setting of testapp

Is there any difference between UCase and toUpper?Posted by: BhaktiWith concern of the functionality both of these works same. The most evaluated parameter has been performance - even with that it is minor of 5-7%. So unless, you have millions iterations to be performed with strings, you don't have to get worried about the performance of them. String functions are faster. The same is true with toLower and LCase.

All session content can be Removed ?Posted by: ChikulYes, All session content can be Removed using following codes : 

Page 74: ASP

Session.Contents.RemoveAll() 

it Removes all items from current Session.

How to print out all the variables in the Session?Posted by: ChikulYes, Using "Session.Keys" we can get all session variables 

In VB.NET 

Dim strSesVar as string For Each strSesVar In Session.Keys Response.Write(strSesVar + " : " + Session(strSesVar).ToString() + "<br>") Next 

In C# 

foreach (string strSesVar in Session.Keys) { Response.Write(strSesVar + " : " + Session[strSesVar].ToString() + "<br>"); }

What is the difference between Session.Abandon() and Session.Clear()?Posted by: ChikulSession.Abandon() will end current session by firing Session_End and in the next request, Session_Start will be fire.

Session.Clear( ) just clears the session data without killing it. With session.clear variable is not removed from memory it just like giving value null to this session. 

Session ID will remain same in both cases, as long as the browser is not closed.

How to Invoke the Server Code on the Click of Checkbox in a DataGrid column.Posted by: Puneet20884As there is no CommandName property of Checkbox so when in Datagrid or any databound control give the AutoPostBack to True and bind to its event "OnCheckedChanged" and define it in the Server Code, it will work.

Page 75: ASP

What will it result… CInt(1.8) CInt(-1.8) CInt(-1.2)Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Thumbrule for DirectCastPosted by: BhaktiOne type must inherit from or implement the other type DirectCast generates a compiler error if it detects that no inheritance or implementation relationship exists

Which one is faster – DirectCast or CTYpe.Posted by: BhaktiDirectCast. CType uses the Visual Basic run-time helper routines for conversion which makes it slower then DirectCast.

Is “var i = (i = “test”);” possible ?Posted by: BhaktiNo. It is not possible. Variabled declared with “Var” can not be used in its initialization statement as you can do with explicit data. (int i=(i=”test”);

This function returns character string representing the specified datepart of the specified date.Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

A textbox generally gets named as "ctl00$Body$txtClientName". Can you control naming of the same?Posted by: BhaktiWith the latest release of VS 2010, the answer gets changed to “Yes” from “No”. Runtime naming of the controls were generally handled by complex algorithms running behind with the application. But it was overhead with length of the control names. With the VS 2010, now user can define pattern of the control naming.

With wchich function you can get integer value for the specified part of the specified date ?Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Page 76: ASP

How to start NotePad file in AsP.NET with code ?Posted by: ChikulSystem.Diagnostics.Process.Start("Notepad.exe");

What method must be overridden in a custom control ?Posted by: ChikulThe Render() method

Where do you store the information about the user localePosted by: ChikulSystem.Web.UI.Page.Culture

What is the lifespan for items stored in viewstatePosted by: ChikulItem stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

Name two properties common in every validation control?Posted by: ChikulControlToValidate property and Text property.

What is the transport protocol you use to call a Web service?Posted by: ChikulSOAP (Simple Object Access Protocol)

Where are shared assemblies stored?Posted by: ChikulIn Global assembly cache.

What is the maximum number of cookies that can be allowed to a web sitePosted by: Chikul20 cookies

Which class can be used to perform data type conversion between .NET data types and XML types?Posted by: Chikul

Page 77: ASP

XmlConvert

What Type of Processing model asp.net simulates ?Posted by: ChikulEvent-driven

What is the size of the session ID ?Posted by: Chikul32 bit long integer

Client Sertificate is a collection of ___________ ? (Request / Response / Server)Posted by: ChikulRequest

What is PLINQPosted by: BhaktiPLIONQ stands for parallel LINQ. As the name clearly implies it is parallel implementation of LINQ to Objects. (Introduced with VS 2010)

Can you find label placed in footer template of repeater in itemdatabound event of the same?Posted by: BhaktiNo. You can’t find this item. Because the second argument of the event is RepeaterItemEventArgs, which doesn’t include footer items into them.

Can I make viewstate enabled for controls where Enableviewstate of the container page is set to false?Posted by: BhaktiNo. You can set it to true or false as per your requirement but in fact it will not have any effect to the controls. Because viewstate in ASP.NET has hierarchical nature. Hence, following code will not work if you have set EnableViewState = false; for page. 

protected void Page_Load(object sender, EventArgs e)

{

txtTest.EnableViewState = true;

Page 78: ASP

}

Is it possible to read Web.config or Global.asax files from browser?Posted by: VirendradugarNo. It is not possible . As Machine.Config file has configuration settings which has entries that maps to CONFIG files, ASAX file with an HTTP handler "HttpForbiddenHandler", which prevents to retrieve the associated file.

What is the difference between UniqueID and ClientID?Posted by: VirendradugarWell, both the properties are associated with asp.net control. The difference is Unique ID has '$'sign and Client ID adds '_' (hyphen) to the control, if master page is used. 

Let's say you have placed a text box called 'txtName' in content place holder. So client ID will be ct100_ContentPlaceHolder1_txtName where Unique ID will be ct100$ContentPlaceHolder1$txtName.

ClientID is used to access control in Java Script where using Unique ID you can make a post back using java script__doPostBack() function. 

Thanks, Virendra Dugar

Elements of jagged array are of…Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

How can we make file hidden ?Posted by: BhaktiWith C# or VB, we just need to set attribute of file as “Hidden” to make it hidden. 

f.Attributes = FileAttributes.Hidden ‘f is New FileInfo(filePath)

The capacity of the stringbuilder get increased,…Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Page 79: ASP

Using which property you can check on the server whether validators controls are satisfied or not?Posted by: VirendradugarThe answer is Page.IsValid . Always ensure that you check Page.IsValid before doing any kind of operation when working with Validator Controls.

How does ASP.NET store SessionIDs by default?Posted by: ChikulNOTE: This is objective type question, Please click question title for correct answer.

How will you make strings with TitleCase ?Posted by: BhaktiWith dynamic pages, sometimes you need to create titles dynamically. At such stage you can not go back to check whether they are stored in proper Title case or not. To make this task happen you can use string class provided toUpper() and toLower() methods but that would be much time consuming and tedious job. You can use, titlecase() method to make it single linear task. 

Dim strTest As String = "testing title case"

strTest = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strTest.ToLower()) ' will result Testing Title Case

How to redirect user to secure connection ?Posted by: BhaktiTo redirect user to https(to a secure connection), you can define uri scheme to UriSchemeHttps.

UriBuilder testuri = new UriBuilder(Page.Request.Url);

testuri.Scheme = testuri.UriSchemeHttps;

can we use session variable in App_code Class page ?Posted by: ChikulYes. By using "HttpContext.Current.Session("VarName") ", we can use current session variable in App_code Class page

What is capacity and length for StringBuilder ?Posted by: Bhakti

Page 80: ASP

By specifying capacity you can indicate number of characters the instance object of stringbuilder can hold while the length is the character count of the string the stringbuilder holds. Specifying lesser capacity and longer string will make capacity to get expanded to accommodate the supplied string. But specifying higher capacity and lesser length will shorten the string content.Unless specified, the default capacity of the stringbuilder is 16. 

Dim sb As New StringBuilder("Hi", 5) ' initial capacity is set to 5

Response.Write(sb.Capacity) ' will print 5

Response.Write(sb.Length) ' will print 2

sb.Append(" testing")

Response.Write(sb.Capacity) ' will print 10

Response.Write(sb.Length) ' will print 10

sb.Length = 5

Response.Write(sb) ' will print hi te

You need to prefix something with the retrieved amount (Positive, negative, zeros). How will you handle this?Posted by: BhaktiIn such case you can use, custom numeric format string. Example given below can make it clearer. 

Dim num As Double

num = 100

Dim MyString As String = num.ToString("Test positive : #,##0.00;")

num = -100

MyString = num.ToString(";Test negative : [ $#,##0.00 ]")

num = 0

Page 81: ASP

MyString = num.ToString(";;It's zero. :( :( ")

Does isMaxLengh work with multiline textbox ? How can you handle such situation?Posted by: BhaktiNo, isMaxLength doesn’t work with multiline textbox. You need to handle such situation some other way. Javascript can be an option to deal with this situation.You can use, following function to achieve the said functionality… 

function isMaxLength(txtBox, length)

{

if(txtBox)

return (txtBox.value.length <= length-1);

}

Which can be used with multiline textbox as below… 

<asp:TextBox ID="txtNotes" Width="92%" TextMode="MultiLine" Rows="6" runat="server" onkeypress='javascript:return isMaxLength(this,16);' ></asp:TextBox>

What namespace does the Web page belong in the .NET Framework class hierarchy?Posted by: ChikulSystem.Web.UI.Page

What is smart navigation in .NET?Posted by: ChikulSmartNavigation is the property used in <%@ Page %> tag. It works with 1.1 & versions before it. For Version 2.0 and next instead of it we can use "SetFocus" and "MaintainScrollPositionOnPostBack".

Smart Navigation basically enhances a web pages in the following way: 

1. The scroll position of a Web page is maintained after postback. 2. The element focus on a Web page is maintained during navigation. 

Page 82: ASP

3. Only the most recent Web page state is retained in the Web browser history folder. 4. The flicker effect that may occur on a Web page during navigation is minimized.

How do you send data through querystring to another page without displaying it in the URL?Posted by: VirendradugarUse Server.Transfer method to send user to another page.

What is Captacha Image and why it is used?Posted by: VirendradugarCAPTCHA =”Completely Automated Public Turing test to tell Computers and Humans Apart."

It means that it’s kind of test which a human can pass but a computer program cannot pass it. It is used almost in every site when you make a sign up. Captcha is an image with some distorted text. It can have only alphabets, numbers or both depend on the programmer. 

It is used to stop spamming as using web bots the process of sign up or submitting feedback can be made automatic. But having Captcha as additional level input stops web bots from doing successful spamming as web bots cannot read Captcha image content.

How many ViewState objects can be created on an aspx page ?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

how to handle EmptyDataTemplate with repeater ?Posted by: BhaktiUnlike gridview, you can’t find <EmptyDataTemplate> with repeater. You need to handle such situation some different way. One of the way to handle this is, to keep label(initially hidden) in the footer template of repeater. With ItemDataBound event, you can get item count of the repeater and from that count you can decide visibility of the label in footer.

How to assign class to htmltablerow runtime?Posted by: BhaktiWith htmltablerow, you cant find property like class/cssclass. With such situation, you need to add attribute of “Class” to the desired htmltablerow. With below code, I am adding class “NavyYellow” to found tablerow “trMain” 

Dim trMain As HtmlTableRow

Page 83: ASP

trMain = CType(e.Item.FindControl("trMain"), HtmlTableRow)

trMain.Attributes.Add("class", "NavyYellow")

How you can determine whether client is connected to server or not?Posted by: BhaktiWith some of the scenarions, you need to determine whether client has reset the connection or not. WithResponse.IsClientConnected, we can know whether client is connected to the server or not.

Garbage collector runs ?Posted by: MuhilanNOTE: This is objective type question, Please click question title for correct answer.

Which of the following does the actual .NET code execute ?Posted by: MuhilanNOTE: This is objective type question, Please click question title for correct answer.

You want to only get changed data in a dataset which of the below is the best way ?Posted by: MuhilanNOTE: This is objective type question, Please click question title for correct answer.

What is the fastest way to concat strings in ASP.NET ? What should you do?Posted by: MuhilanNOTE: This is objective type question, Please click question title for correct answer.

As a developer you are displaying product data from SQL Server. Product table has Productid and ProductName. You write ADO.NET code that uses a SqlDataAdapter object and a SqlCommand object to retrieve the product data from the database by calling a stored procedure. You set the CommandType property of the SqlCommand object to CommandType.StoredProcedure. You set the CommandText property of the object to procProductList. Your code successfully files a DataTable object with a list of products that is sorted by ProductID in descending order. You want the data to be displayed in reverse alphabetic order by ProductName. What should you do?Posted by: MuhilanNOTE: This is objective type question, Please click question title for correct answer.

Page 84: ASP

What concept does the above sample code demonstrate? internal class Piston {} internal class Engine { private Piston[] myPistons = new Piston[4]; public bool Ignition() { //some code } } public class Car { private Engine myEngine = new Engine(); public void Start() { //put in keys etc.. if (myEngine.Ignition()) { //some more code } } }Posted by: MuhilanNOTE: This is objective type question, Please click question title for correct answer.

Does defaultbutton of form tag works with ImageButton?Posted by: BhaktiNo. It does not. You need to handle such scenarios using code or JavaScript (This will be preferrable as defaultbutton doesn’t work also for FireFox)

In your asp page, HTML tag and CacheControl will be specified…Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

What is the difference between the Theme and StylesheetTheme?Posted by: VirendradugarThe StylesheetTheme attribute works same as the Theme attribute.The difference is that the when attributes are set locally on the page within a particular control, the attributes are overridden by the theme if you use the Theme attribute. They are kept in place, if you apply the page’s theme using the StylesheetTheme attribute. Suppose you have a text box control like the following: 

<asp:Textbox ID=”TextBox1” Runat=”server”

ForeColor=”#ffffff” />

In this example, the ForeColor settings is overridden by the theme if you have applied it using the Theme attribute in the Page directive. If, instead, you applied the theme using the StylesheetTheme attribute in the Page directive, the ForeColor settings remain in place, even if they are explicitly defined in the theme.

Default ContentType of Response.ContentType is…Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Page 85: ASP

What is the easiest way to bring down any website in ASP.NET?Posted by: VirendradugarThere is a simple way to bring down your ASP.NET 2.0 application. The only thing you have to do is to create simple html file called App_offline.htm and deploy it to your ASP.NET 2.0 web application root directory. The rest is handled by ASP.NET runtime internal routines. 

The way app_offline.htm works is that you put the file in the root directory of the application. When ASP.NET sees it, it will shut-down the app-domain for the application (and not restart it for requests) and instead send back the contents of the App_offline.htm file in response to all new dynamic requests for the application. When you are done updating the site, just delete the file and it will come back online.

What is the lifetime of ViewState?Posted by: VirendradugarViewState exists for the current requested page including post backs to the same page.

How will you set focus to the control?Posted by: BhaktiYou can do it either using JS, for attribute or control method. With JS, you will have to use focus method. 

function focustest()

{

document.getElementById("TextBox5").focus();

}

With form, you can add attribute called “defaultfocus” to the desired control. 

defaultfocus="TextBox5" sets focus to textbox5. And programatically, you can set it by : 

TextBox5.Focus()

Is it possible to maintain scroll bar positions during postbacks ?Posted by: Bhakti

Yes, it is.

Page 86: ASP

You just need to set “MaintainScrollPositionOnPostback” attribute value to “true”.

<%@ Page Language="vb" AutoEventWireup="false" … MaintainScrollPositionOnPostback="true" %>

Justify : Custom validator gets executed only at client side.Posted by: Bhakti

The answer is true and false both. Its as per specifications provided in the code. If you want to perform client side validation then it almost becomes browser specific. You can handle such situation by specifying server side validation with “OnServerValidate” tag.

But in case of server side validation with custom validator, you need to be assured that the control being validated is visible and having value.

For an example,

<asp:TextBox ID="txt" runat="server"></asp:TextBox>

<asp:CustomValidator ControlToValidate="txt" OnServerValidate="test" ClientValidationFunction="test()" ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator"></asp:CustomValidator>

<asp:button id="btnSubmit" runat="server"

OnClick="btnSubmit_Click" Text="Submit" />

Public Function test(ByVal obj As Object, ByVal objArgs As ServerValidateEventArgs) As Boolean

If Not obj Is Nothing Then

Return true

End If

End Function

Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs)

End Sub

is it possible to add APP_Code folder in web application project in Visual Studio 2005 or later?Posted by: Virendradugar

No. It's not possible. Web application project does not allow users to add app_code folder where website project does.

Process Used for Maintain State Server Session ?Posted by: Abhijit Jana

NOTE: This is objective type question, Please click question title for correct answer.

Page 87: ASP

Which process is used to run ASP.NET Application from Visual Studio IDE ?Posted by: Abhijit Jana

WebDev.WebServer.Exe

How can we disable session in Page Level ?Posted by: Abhijit Jana

We can disable session state in page level using EnableSessionState attributes with in Page directive<%@ page Langauge="C#" EnableSessionState="False" ...

How can we disabled session for an ASP.NET Application ?Posted by: Abhijit Jana

We can easily do it by following configuration in web.config<SessionState Mode="Off"> in System.Web Section.

What are the different level of settings are available for configure cookies in browser ?Posted by: Abhijit Jana

Below are the listed Cookies setting available on Browser.1. Accept All Cookies2. Low3. Medium4. Medium High5. Block All Cookies

We can reached there by Tool -> Internet Option -> Go To Privacy Tab . [ IE ]

What is IsPostback property in asp.net and how does it work?Posted by: Virendradugar

IsPostBack property indicates that whether this is the first time user has requested fort the page or it is reloaded based on any response on postback.

This property checks for __VIEWSTATE or __EVENTTARGET parameter in Request object. if these parameters are absent that means it is requested for the first time and if these parameters are present then this request is not first request.

Name the classes thet are used to send a mail?Posted by: Syedshakeer

1)SmtpClient

2)MailMessage

Which of the following method is correct to send an Email Message?Posted by: Syedshakeer

NOTE: This is objective type question, Please click question title for correct answer.

Difference between Eval() and Bind()?Posted by: Syedshakeer

Page 88: ASP

Eval(): -Eval() method proviedes only for displaying data from a datasource in a control.Bind(): Bind() methods provides for two-way binding which means that it cannot be used to dispaly as well update data from a datasource

Name the Protocols that are commonly used for sending and retrieving Email Message?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Base class for classes accessing session-state values, session-level settings, and lifetime management methods is…Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

What is difference between TransferRequest and Transfer method?Posted by: BhaktiTransfer: Terminates execution of the current page and starts execution of provided URL. TransferRequest: Performs an asynchronous execution of the provided URL.

Which method is used to rewriting/redirecting server-side execution?Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

It is possible to get class or struct indexed just like arrays using…Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Can we to pass more than one querystring parameter with hyperlink in .aspx file?Posted by: BhaktiYes we can. For an example code can be like, 

<asp:HyperLink ID="hlClientId" runat="server" NavigateUrl='<%# "Page.aspx?param1=" & _

DataBinder.Eval(Container.DataItem, "param1") & _

"&param2=" & DataBinder.Eval(Container.DataItem, "param2") %>' >Hyperlink</asp:HyperLink>

Page 89: ASP

DetailsView Control can be displayed in which Modes?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Generic Collections are located in which NameSpace?Posted by: SyedshakeerSystem.Collections.Generic

Object type collections are located in the whcih NameSpace?Posted by: SyedshakeerSystem.Collections

You can redirect (or) Transfer to a CustomError Page in which block?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Name the constructor which creates a client that can send email to the specified SMTP server?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which protocol for defining the format of an Email messagePosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which attribute is used to apply the skin to a control of that typePosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which method will you use to access second result table of stored procedure with datareader ?Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

What is the name of the base class, from which all the validators controls of ASP.NET is derived?Posted by: Virendradugar

Page 90: ASP

All the ASP.NET validation controls are derived from BaseValidator Class except Validation Summary Control.

which property is used to check the current connection is securePosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

The URL for a Secure Connection starts withPosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

To specify a comment with in a Skin File you must use thePosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

To Create a Email Message in HTML format,set the IsBodyHtml Property toPosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

The FormsAuthentication class is in thePosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which element is used to apply a theme to the current application withint the web.config?Posted by: Syedshakeer<pages theme="name"/>

Is it possible to create cookies with keys? Explain using some example.Posted by: BhaktiYes , it is possible to create cookies with keys. Cookies is a dictionary at the time of initialization, if key is specified with it. (You can determine whether cookie is dictionary or not using HasKeys property.) 

For an example: 

Page 91: ASP

Response.Cookies("Testcookie")("key1") = "key1"

Response.Cookies("Testcookie”)("key2") = "key2"

After this if you make assignment like, 

Response.Cookies("Testcookie”) = “noKey”

Then,” key1” and “key2” of cookie("Testcookie”) will be deleted.

How many ContentsPlaceHolder Controls contains to the MasterPage by default?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

HttpApplicationState class stores data inPosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

When response expires if there are multiple calls to Response.Expires on a single page?Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Explain Server.URLEncode Method.Posted by: BhaktiThis method applies URL encoding rules, including escape characters. Where Spaces are converted to plus signs and non-alphanumeric characters are converted to their hexadecimal codes. 

For an example, 

Response.Write(Server.UrlEncode("http://testurl encode 123.com"));

Will result, http%3a%2f%2ftesturl+encode+123.com

Is it possible to use InProc mode for sessionState in case of web garden?Posted by: VirendradugarNo, it's not possible. As InProc mode is dependent on the worker process and in case of web garden, we

Page 92: ASP

have multiple worker process so session handling becomes difficult. Either we can use StateServer or SQL server mode for web garden. 

Thanks.

Is it possible to set SessionState to readonly mode? Readonly mode means, we can only read data from session but we can not write any data in session variable?Posted by: VirendradugarYes, it is possible. EnableSessionState property has a value "Readonly" which actually makes the session state read only.

Thanks.

What is the difference between Session.Clear() and Session.RemoveAll() method?Posted by: VirendradugarWell, actually there is no difference. Session.RemoveAll() methods internally makes a call to Clear() method only. 

Thanks.

What is Cookie Munging?Posted by: VirendradugarBy default, asp.net uses cookies to store session id for the logged in user. But there is an option in every browser to disable cookies. If cookies are disabled, then any website will not be able to create cookies on user's machine. 

When cookies are disabled, then session Id is gets appended in the URL and passed to the server. Server decodes it and fulfill the requested page. 

Cookie Munging is nothing but how ASP.NET manages session variables without cookies. 

Thanks, Virendra Dugar

What is difference between System.Web.Caching.Cache and System.Web.HttpContext.Current.Cache ?Posted by: BhaktiSystem.Web.Caching.Cache : Class/type used for caching System.Web.HttoContect.Current.Cache: Instance of cache class for current HTTP context from a web request (Gets cache object from current application domain)

Page 93: ASP

What is persistent and non-persistent cookie?Posted by: VirendradugarPersistent Cookies : This can be said as permanent cookies, which gets stored on user's machine. For persistent cookie, one need to set the expiry date. 

Non Persistent Cookies : This is Temporary Cookies which get's stored in browser's memory.

Explain AdRotator control.Posted by: BhaktiAdRotator control is used to present ad images clicking which we can navigate to another web location. With each page load,ad image can be selected randomly or in specified order from predefined well formatted XML document. Well formatted XML document(Advertisement File) contains required information for the image that needs to be displayed. 

Elements of the Advertisement File: ImageUrl: Advertisement Image URL(Absolute/relative) NavigateUrl: Destination web location where user needs to be directed when he clicks the image (if NavigateUrl is not set then image is not clickable) AlternateText: [Optional parameter]Text when the user moves mouse pointer over the image Keyword: [Optional parameter] Keyword Impressions: [Optional parameter] Number indicating weight of the ad in the order of rotation with respect to other ads in the file

Which property do you use to determine how ASP.NET page was invoked?Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Which method will you use to Delete the view-state information for all the server control's child control(s)?Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

With which method you can set design-time data for a control ?Posted by: BhaktiNOTE: This is objective type question, Please click question title for correct answer.

Page 94: ASP

What is difference between ResolveUrl and ResolveClientUrl ? Which do you prefer to use?Posted by: BhaktiResolveUrl - Returns URL relative to the site root using control’s TemplateSourceDirectory property.

ResolveClientUrl – Returns URL relative to the folder containing the source file in which the control is instantiated. 

I would prefer to use ResolveUrl as URL returned can be used anywhere in the site to make it work correctly. 

Thanks, Bhakti Shah

What is cross page posting in ASP.NET?Posted by: BhaktiSometimes, other than round-trip cycle of asp.net web page we need to post one page to another page by configuring controls to be posted to different target page. This is referenced as cross page posting in ASP.NET.

What are the main components of IIS 7.0?Posted by: VirendradugarMain Components of IIS 7.0 are HTTP.Sys, Svchost.Exe, Application Pool , Worker Process (W3WP.exe) and Configuration Store.

What is a web garden?Posted by: VirendradugarBy default an application pool runs with a single worker process (w3wp.exe). We can allocate multiple worker process in a single application pool. An application which can have multiple W3WP process, is known as web Garden.

What is the unit of the Duration property in the OutputCache directives of the UserControl in asp.netPosted by: PosterThe unit of the OutputCache duration is #ofseconds. 

This is specified in number of seconds. 

<%@ OutputCache Duration="60" Shared="True" VaryByParam="None" %>

Page 95: ASP

Above code will cache the user control for 60 seconds ie. 1 minute and the same cached user control will be shared across whole website (as Shared property is set to true). 

For more details, visit http://msdn.microsoft.com/en-us/library/hdxfb6cy.aspx 

Thanks

What is a primary difference between the standard validator controls and the mobile validator controls?Posted by: VirendradugarThe mobile validation controls don’t provide client-side validation.

Where is Cache data stored—in memory, on the hard disk, in a database, or on a state server?Posted by: VirendradugarThe Cache object is stored in memory.

How can we copy the file from one location to other?Posted by: LakhangargUsing File.Copy Method we can copy the file from one location to other. 

System.IO.File.Copy("Source File Path", "Destination File Path");

Can we delete directory having other directory and files?Posted by: LakhangargYes, we can delete directories directly that have files and other directories using 

System.IO.Directory.Delete("Directory Path", true);

If a users has disabled cookies in his browsers, what can be done to enable forms authentication?Posted by: VirendradugarUse the AutoDetect setting.

What can you do to make a Web page more useful to a user who does not use a mouse?Posted by: VirendradugarThere are number of things which can be done so that Site can be accessed without a mouse. 

Page 96: ASP

1.Provided access keys for all the controls.You can use access keys for Web controls using AccessKey property. 2. Define Logical Tab order. 3. Specify default button on the form. 4. Set default focus on the form in a logical location where data entry normally begins.

How can you define a control property using a global resource at design time?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

For a blank ASP.NET Page or ViewState Disabled page, will there be any value stored in the _VIEWSTATE field? Note : The Viewstate of an ASP.NET page is created during the page life cycle, and saved into the rendered HTML using in the "__VIEWSTATE" hidden HTML field.Posted by: VirendradugarAnswer is YES. 

The reason is that ASP.NET Page itself stores some bytes of information into the _VIEWSTATE field.

Which component is required for all pages that use Web Parts?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Does ViewState is responsible for maintaining data across the Page Post Back for Postback controls (like textbox, dropdownlist) and non-postbackcontrols(like label)?Posted by: VirendradugarIt is false. For NonPostback controls it is true but for postback controls, ASP.NET retrieves their values one by one from the HTTP request and copies them to the control values while creating the HTTP response.

If for a Compare Validator control, ControlToCompare and ValueToCompare properties are set, then which property will take precedence?Posted by: VirendradugarThe ControlToCompare property takes precedence.

What is the difference between ListBox (Filled with data) and DropDownList (Filled with data), in terms of SelectedIndex property?

Page 97: ASP

Posted by: VirendradugarThe default value of the SelectedIndex property of the Listbox is -1, which indicates that no item is selected in the Listbox. However, the DropDownList control overrides this property and sets the default value to 0, which indicates the first item in the list.

When file upload control is used, you can add maximum 4 mb size of the file. Using which property one can extend the limit of file size?Posted by: VirendradugarMaxRequestlength Property needs to be set. It takes value in KB. It can support max 2GB file.

By Default, ASP.NET does not allow HTML tags to be sent to server via client side due to security reason. Which property needs to be set that allows HTML tags to be processed by server?Posted by: VirendradugarValidateRequest Property needs to be set to false. By default it's true so it does not allow unencoded HTML tags to be processed at server. It can be set at page level or at application level via web.config.

What is the Difference between RegisterStartupScript and RegisterClientScriptBlock?Posted by: LakhangargRegisterStartupScript Places the script at the bottom of the asp.net page instead of at the top. and RegisterClientScriptBlock inserts script immediately below the opening tag of the Page . means after <form> tag.

In an ASP.NET website, when the web.config file is getting called?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

which namespace is used to implement active directory services?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

What is the difference between Postback and callback?Posted by: VirendradugarCallback send a request to the web page from the client script. A client side function will send request to the server and a marked method is invoked on the server. It does the processing on the server and returns the result back to the client. To enable client side callbacks, ICallbackEventHandler interface needs to be used and one need to implement

Page 98: ASP

RaiseCallBackEvent & GetCallBackResult function. 

Where Postback sends the form data to the server. The server processes the data and sends it back to the browser. The page goes through its full life cycle and is rendered on the browser. 

Callback does not redraw the page where postback does.

You catch an unhandled exception in a Page_Error handler. How can you access the last error?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Is it possible to update a connection string stored in the Web.config file programatically? If Yes, then how?Posted by: VirendradugarYes. 

Create a Configuration object. Then, update the connection string using the ConnectionStrings collection. Finally, call Configuration.Save.

What are the four phases of a Web Setup Project deployment?Posted by: VirendradugarInstall, Commit, Rollback, and Uninstall.

What launch conditions do Web Setup Projects include by default?Posted by: VirendradugarBy default, Web Setup Projects check for IIS and the .NET Framework.

Which of the following can be share between two pages.Posted by: Santosh4uNOTE: This is objective type question, Please click question title for correct answer.

You need to obtain performance information about your Web Application. You should use which of the following?Posted by: Santosh4uNOTE: This is objective type question, Please click question title for correct answer.

What is LINQ

Page 99: ASP

Posted by: Santosh4uNOTE: This is objective type question, Please click question title for correct answer.

what is the transport protocol used to call webservise ?Posted by: Santosh4uNOTE: This is objective type question, Please click question title for correct answer.

Which method would you call to send an e-mail message and wait for the transmission to complete before proceeding?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

What type of exception will the runtime throw if the SMTP server rejects a recipient e-mail address?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Which of the following browser capabilities can you not check using Request.Browser?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

What is the name of the virtual page that you can request to view trace data when the trace data is not displayed on its corresponding Web page?Posted by: VirendradugarThe virtual page is called Trace.axd.

What is the name of the Web page property that you can query to determine that a Web page is being requested without data being submitted?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Which control requires the Web.sitemap file to display site map information?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Is view state lost if a user refreshes a Web page? What if the user copies the URL and open it in other

Page 100: ASP

browser?Posted by: VirendradugarView state is maintained within a page’s HTML, so it is lost if a page is refreshed or if the URL is copied.

What is View State Chunking?Posted by: VirendradugarView state chunking is new in ASP.NET, version 2.0.The ViewState property retains values between multiple requests for the same page. When an ASP.NET page is processed, the current state of the page and controls is hashed into a string and saved in the page as a hidden field. If the data is too long for a single field (as specified in the MaxPageStateField-Length property), then ASP.NET performs view state chunking to split it across multiple hidden fields.

Which might not work if a user has disabled cookies in his or her Web browser: application state or session state?Posted by: VirendradugarSession state, by default, won’t work if a Web browser that supports cookies has cookies disabled. Application state isn’t user-specific, though, and doesn’t need to be tracked in cookies. Therefore, application state works regardless of cookies.

Which typically consumes more memory: application state or session state?Posted by: VirendradugarSession state tends to use much more memory than application state, because copies of all variables are stored for each user.

What are the different code models available in ASP.NET 2.0?Posted by: VirendradugarThere are 2 code models available in ASP.NET 2.0. One is the single-file page and the other one is the code behind page.

Can the App_Code folder contain source code files in different programming languages?Posted by: VirendradugarYes but you need to create two subfolders inside the App_Code and then add both C# and VB.NET in the respective subfolders. You also have to add configuration settings in the web.config for this to work.

Can I use different programming languages in the same application?Posted by: Virendradugar

Page 101: ASP

Yes. You can create a few pages in C# and a few in VB.NET.

How can you detect if a viewstate has been tampered?Posted by: VirendradugarBy setting the EnableViewStateMac to true in the @Page directive. This attribute checks the encoded and encrypted viewstate for tampering.

You catch an unhandled exception in a Page_Error handler. How can you access the last error?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

ViewState is encrypted.Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

Does SessionID change with every request in the asp.net 2.0 application?Posted by: VirendradugarFor any web programmer, its obvious to think and believe that SessionId remains same through out the user session and it was right till asp.net1.1. But in asp.net2.0, this behavior has changed. In the asp.net application new sessionid is returned with the response to every request until session objects are not used.

According to MSDN the reason/solution is: 

“When using cookie-based session state, ASP.NET does not allocate storage for session data until the Session object is used. As a result, a new session ID is generated for each page request until the session object is accessed. If your application requires a static session ID for the entire session, you can either implement the Session_Start method in the application’s Global.asax file and store data in the Session object to fix the session ID, or you can use code in another part of your application to explicitly store data in the Session object.” 

Enojy…

Is it possible that cookies created by asp.net application can only be accessed via server side code only? Is it possible to restrict that client side code can not access any cookie?Posted by: VirendradugarYes. 

Page 102: ASP

it is possible to enable HttpOnly programmatically on any individual cookie by setting the HttpOnly property of the HttpCookie object to true. However, it is easier and more reliable to configure the application to automatically enable HttpOnly for all cookies. To do this, set the httpOnlyCookies attribute of the <httpCookies> element to true. 

<configuration>

<system.web>

<httpCookies httpOnlyCookies=”true”>

Can we set priority (High, Medium, Low) of the mail sent via ASP.NET?Posted by: VIRENDRADUGARYes.

What’s the Difference Between <%# i %> and <%= i %>?Posted by: VIRENDRADUGARWe can use two constructs to access page-level variables in an ASP.NET web template: 

data binding syntax Data binding—the hierarchical mapping of control properties to data container values—is specified by the <%# … %> tags. Code located within a <%# … %> code block is only executed when the DataBindmethod of its parent control container is invoked. 

code rendering syntax The <%= … %> code tags output content to the browser. This content could be hard-coded, or it may contain page-level variables.

You need to identify a type that meets the following criteria : Is always a number and Is not a greater than 65,535. Which type should you choose?Posted by: VirendradugarNOTE: This is objective type question, Please click question title for correct answer.

You creat a Web site that stores user's active themes in user profile objects. You need to apply user's preferred themes when they log on to the Web site. What should you do?Posted by: Virendradugar

Page 103: ASP

NOTE: This is objective type question, Please click question title for correct answer.

Which of the following classes is required to draw an empty circle? (Choose all that apply.) 1. System.Drawing.Graphics 2. System.Drawing.Pen 3. System.Drawing.Brush 4. System.Drawing.BitmapPosted by: Virendradugar1. System.Drawing.Graphics 2. System.Drawing.Pen 

Graphics class is required to draw the empty ellipse in the form of a circle, Pen class is required to set the border properties of the circle to be drawn.

Default setting for the expires attribute of the document.cookie property?Posted by: LakhangargThe duration of the browser session.

What is Event Bubbling?(Asp.net)Posted by: InitiotechServer Controls like DataGrid,DataGridView , DataList etc have other controls inside them. Example an DataGridView can have an TextBox or an button inside it. These Child Controls can not raize events by themselves,but they pass the event to the parent control (DataGridView), which is passed to the page as “ItemCommand” event. This process is known as EventBubling ==================================================== Regards Hefin [...]

What's the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?Posted by: VirendradugarCode behind is relevant to Visual Studio only. SRC is used when you are using notepad or other text editor tool.

Can we execute any web site without the web.config file?Posted by: VirendradugarYes, application will inherit cofiguration setting from machine.config file.

How do you turn off cookies for one page in your site?Posted by: Virendradugar

Page 104: ASP

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 user’s hard disk when a session ends.

What are the expiration policies for Cached objects?Posted by: SandeepvThere are two policies for expiration of Cached objects : - 1.Absolute expiration: Which is a fixed duration for expiration. The object with an absolute expiration period of say 1minute , will expire completely after 1 min .

2. Sliding expiration: Now here the objects expiration period varies according to the access of the object. If the object is frequently accessed its expiration period also goes on resetting. 

I.e . If there is sliding expiration of 1 minute and it is before one minute , then its expiration period is reset to 1 minute.

How do you create a permanent cookie?Posted by: VirendradugarSet expires property to Date.MaxValue (HttpCookie.Expires = Date.MaxValue)

What is wrong with this code? Server.transfer("Default.HTML");Posted by: VirendradugarIt is believed that You can not use Server.Transfer method for .HTML file. It only works for .aspx pages. but that's not true. 

This code is correct.

try { Response.Write("Try Block:"); return; } catch (Exception ex) { throw; } finally { Response.Write("Finally Block"); } What will be the output for the above code?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is the name of class from which web pages are inherited?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which method of HTTP Handler gets invoked when request is received?

Page 105: ASP

Posted by: VirendradugarProcessRequest() method.

What if Some one types the URL of web.config file in the browser?Posted by: VirendradugarASP.NET configures IIS to prevent direct browser access to web.config files to ensure that their value can not become public. Attempt to access web.config file will cause ASP.NET to return 403: Access forbidden error.

Can an ASPX file contain more than one form marked with runat="server"?Posted by: VirendradugarNo.

Response.Redirect() can be used to redirect from one page to another page inPosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which should be used to redirect on next page in the same server?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is Difference between Callbacks and Postback in ASP.NET?Posted by: VirendradugarCallback : It is a way to send a request to the web page from the client script. Postback is an expensive call with processing overhead. In callback a client function sends a request and a special marked method is invoked on the server. It does the processing & returns the value which is received by another client function to process the result. To have client side callbacks, the page has to implement ICallbackEventHandler & implement functions RaiseCallBackEvent & GetCallBackResult. 

PostBack: Postback is the event which sends the form data to the server. The server processes the data & sends it back to the browser. The page goes through its full life cycle & is rendered on the browser. It can be triggered by using the server controls.

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False"?

Page 106: ASP

Posted by: VirendradugarWhen value of the AutoEventWireup attribute is set to false, one must manually hook up events to event handlers.

When value of the AutoEventWireup attribute is set to true, the ASP.NET page framework can automatically raise events.

What is the name of base class for .NETPosted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Is it Possible to create more than one machine config file.Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Which Function is used to count more than two billion rows in a table?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Is finally block executed if there is no exception?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is the Extension of web Service ?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is Size Limit for Cookies data?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is the Purpose of Server.MapPth?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Page 107: ASP

What is the default authentication system in asp.net web application?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Which type of control Span is in ASP.NETPosted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Is IIS Mandatory to develop a Web application in ASP.NET 2.0?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Name the property to access Referring page URL?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Name of the event that is not fired during page cycle?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Where does ASP.Net stores sessionIDs by default?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What data types do the RangeValidator control support?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

ow to send XML file on server using HTTP protocol?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

If we remove a web.config file from the application , is this application will work?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Page 108: ASP

Which of the following Regular expression is used to validate a 10 digit phone fied?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Validation Controls are non-visible controls?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which control is used to display the list of Error Messages in asp.net pagePosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which of the following is Default ErrorMode in CustomError tag?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which of the following property is used to set a crosspage posting?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

NET class that reads data from a database. Inside this class you need to use a SqlDataReader to read back any records returned from the database. What property of the DataReader should you check before attempting to read any records?Posted by: MajithNOTE: This is objective type question, Please click question title for correct answer.

Which ADO.NET class allows you to specify SQL text to execute, one or more parameters and also choose a specific SQL connection to run against?Posted by: MajithNOTE: This is objective type question, Please click question title for correct answer.

Suppose Page_load event is defined in aspx page and same page_load event in code behind. What will happen now? How program will run?

Page 109: ASP

Posted by: VirendradugarAnswer to this is : 

The Page_load method in the aspx page will only run.It takes precedence over the one in the code behind.

What is cross page posting in ASP.NET2.0 ?Posted by: MajithWhen we have to post data from one page to another in application we used server.transfer method but in this the URL remains the same but in cross page posting there is little different there is normal post back is done but in target page we can access values of server control in the source page.This is quite simple we have to only set the PostBackUrl property of Button,LinkButton or imagebutton which specifies the target page.In target page we can access the PreviousPage property.And we have to use the @PreviousPageType directive.We can access control of PreviousPage by using the findcontrol method.When we set the PostBackURL property ASP.NET framework bind the HTML and Javascript function automatically.

Name Authenication Modes available in web Application?Posted by: Lakhangarg(1) Window authentication. (2) Form Authentication (3) Passport Authentication

How turn off cookies for one page in your site?Posted by: Saantosh--> cookie state= false in web.config file -->Cookie.Discard Property which Gets or sets the discard flag set by the server. When true, then client application not to save the Cookie on the user hard disk when a session ends.

How do you explicitly kill a user session?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is the maximum number of cookies that can be allowed to a web site?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Name two properties common in every validation control?

Page 110: ASP

Posted by: LakhangargControlToValidate property and Text property

Which is the first event in page life-cycle Event?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Default Mode for Session State?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is the Better approach to redirect on other page within the same server? Response.Redirect or Server.TransferPosted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is code-based security?Posted by: LakhangargCode security is the approach of using permissions and permission sets for a given code to run. The admin for example can disable running executables off the Internet or restrict access to corporate database to only few applications.

To send Emails,you need the following classes from the System.Web.Mail namespace?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

How To Get the Referral page's URL?Posted by: Lakhangargwe can get the Referral page's URL using: Request.UrlReferrer.ToString();

Which of the follwoing code have to write for cancel Link in gridview?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

Which of the follwoing property has the default property for gridview paging by setting the 'PageSetting'

Page 111: ASP

Property?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

How you will get the current Page Url?Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

How to disable the page viewstate byPosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

disadvantages of hidden fields?Posted by: Syedshakeer1)Increases the HTML size of the page.

2)You still cannot store structured data

3)Because you can view page of an HTML page, there is no security

4)There is no way to persist the data

Difference between ASP.Net Website and ASP.Net Web Application?Posted by: Syedshakeera.)ASP.Net Website (Microsoft Visual Studio’s default type): i. Local Resource is treated as content based resource, so we can change it and it affects to website.ii. Global Resource is treated as embedded resource, So they are compiled into specific language dlls into bin folder.b.ASP.Net Web Application i.Both Local and Global resource are treated as content based resource, so both are editable. Any change in any type of resource cause whole resource compilation

Difference between Localization and Globalization?Posted by: SyedshakeerGlobalization is process of identifying how many resources needs to be localized to adopt a multiple culture support, while Localization is actual process of translating resource to a specific culture. So Localizationthe part of Globalization.

Page 112: ASP

What is the significance of AutoEventWireUp attribute?Posted by: SyedshakeerGets or sets a value indicating whether events for ASP.NET pages are automatically connected to event-handling functions. 

@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="TestWebApp.WebForm1" The AutoEventWireup attribute may have a value of true or false. When an ASP.NET Web Application is created by using Microsoft Visual Studio .NET, the value of the AutoEventWireup attribute is set as false.We can specify the default value of the AutoEventWireup attribute in the following locations: • The Machine.config file. • The Web.config file. • Individual Web Forms (.aspx files). • Web User Controls (.ascx files) The value of the AutoEventWireup attribute can be declared in the <pages> section in the Machine.config file or the Web.config file, as follows

Should we need to dispose the object after use Explicitly or we need to wait for Garbage Collector to dispose those object?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Which is the Light (Performance wise) Data control from the following?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

What is the Difference Between string and System.Text.StringBuilder?Posted by: LakhangargSystem.Text.StringBuilder strTest=new System.Text.StringBuilder(); Strings are immutable. immutable means every time we alter the string a new object is created. hence lower the performance. while stringBuilder are mutable. so it increase the performance where we need to perform altered, insert and remove operations. But it is not recommended to use StringBuilder always. for small string where you need to perform less operation then use string and in case of large string and more operation use StringBuilder.

What is the best state management variable to save the username for particular session?

Page 113: ASP

Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

Maximum Data that can be stored in a cookie?Posted by: LakhangargNOTE: This is objective type question, Please click question title for correct answer.

How many types of Validation controls are there in ASP.NET?Posted by: RajaThere are mainly 5 types of validation controls are there and 1 control is to summarize the validation errors. 

They are ? RequiredFieldValidator - to check for mandatory field ? RangeValidator - to check for data in the specified range ? RegularExpressionValidator - to check for data in a particular regular expression ? ComapreValidator - to compare two data or data types ? CustomValidator - to attach a custom a control with the help of user defined function ? ValidationSummary - to summarize all validation error.

Which of the following does not contain Id and Runat PropertysPosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

What is the Default Property of ShowFooter in GridviewPosted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

What is a master page ?Posted by: Syedshakeer1) A master page provides a framework in which the content of each page on a web site is presented. Master pages make it easy to create pages that have a consistent look. 

2) The pages that provide the content that’s displayed in a master page are called content pages

3) The content of each content page is displayed in the master page’s content placeholder

Page 114: ASP

How do you implement postback with a text box?Posted by: Babu_akkandiMake AutoPostBack property to true

What is Role-Based security?Posted by: Babu_akkandiA role is a named set of principals that have the same privileges with respect to security (such as a teller or a manager). A principal can be a member of one or more roles. Therefore, applications can use role membership to determine whether a principal is authorized to perform a requested action.

differences between Server-side and Client-side code?Posted by: Babu_akkandiServer side code will process at server side & it will send the result to client. Client side code (javascript) will execute only at client side.

What are the disadvantages and benefits of view state?Posted by: Babu_akkandiAutomatic view-state management is a feature of server controls that enables them to repopulate their property values on a round trip (without you having to write any code). This feature does impact performance, however, since a server control's view state is passed to and from the server in a hidden form field. You should be aware of when view state helps you and when it hinders your page's performance.

What are the different ways you would consider sending data across pages in ASP?Posted by: Babu_akkandi* Session 

* public properties

What method do you use to explicitly kill a users session?Posted by: Babu_akkandiAbandon()

What is cookie less session? How it works?Posted by: Babu_akkandiBy 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. This

Page 115: ASP

can be enabled by setting the following: 

<sessionState cookieless="true" />

http://samples.gotdotnet.com/quickstart/aspplus/doc/stateoverview.aspx

Difference between ASP Session and ASP.NET Session?Posted by: Babu_akkandiasp.net session supports cookie less session & it can span across multiple servers.

What are server controls?Posted by: Babu_akkandiASP.NET server controls are components that run on the server and encapsulate user-interface and other related functionality. They are used in ASP.NET pages and in ASP.NET code-behind classes.

Which one is not the correct ASP.NET Version?Posted by: PosterNOTE: This is objective type question, Please click question title for correct answer.

What are the advantages and disadvantages of Cookies?Posted by: NeeksAdvantages 1. Cookies do not require any server resources since they are stored on the client. 2. Cookies are easy to implement. 3. You can configure cookies to expire when the browser session ends (session cookies) or they can exist for a specified length of time on the client computer (persistent cookies). Disadvantages 1. Users can delete a cookies. 2. Users browser can refuse cookies,so your code has to anticipate that possibility. 3. Cookies exist as plain text on the client machine and they may pose a possible security risk as anyone can open and tamper with cookies.vv

What is Cookie Dictionary?Posted by: NeeksA cookie dictionary is a single cookie object that stores multiple pieces of information. You use the Values property to access and assign new values to the cookie dictionary.

What is the difference between Session Cookies and Persistent Cookies?

Page 116: ASP

Posted by: NeeksPersistent Cookies are same as Session Cookies except that, persistent cookies have an expiration date. The expiration date indicates to the browser that it should write the cookie to the client's hard drive. Keep in mind that because a user can delete cookies from their machine that there is no guarantee that a cookie you "drop" on a user machine will be there the next time they visit your site.

difference between custom control and user controlPosted by: SyedshakeerUser control 

1) Reusability web page 2) We can’t add to toolbox 3) Just drag and drop from solution explorer to page (aspx) 4) U can register user control to. Aspx page by Register tag 5) A separate copy of the control is required in each application 6) Good for static layout 7) Easier to create 8)Not complied into DLL 9) Here page (user page) can be converted as control then We can use as control in aspx 

Custom controls 

1) Reusability of control (or extend functionalities of existing control) 2) We can add toolbox 3) Just drag and drop from toolbox 4) U can register user control to. Aspx page by Register tag 5) A single copy of the control is required in each application 6) Good for dynamics layout 7) Hard to create 8) Compiled in to dll

which of the following controls support databinding.Posted by: SyedshakeerNOTE: This is objective type question, Please click question title for correct answer.

What is the difference between Server.Transfer and Response.Redirect?Posted by: PrakagBoth "Server" and "Response" are objects of ASP.NET. Server.Transfer and Response.Redirect both are used to transfer a user from one page to another. But there is an underlying difference. 

Page 117: ASP

//Usage of Server.Transfer & Response.Redirect Server.Transfer("Page2.aspx"); Response.Redirect("Page2.aspx"); The Response.Redirect statement sends a command back to the browser to request the next page from the server. This extra round-trip is often inefficient and unnecessary, but this established standard works very well. By the time Page2 is requested, Page1 has been flushed from the server’s memory and no information can be retrieved about it unless the developer explicitly saved the information using some technique like session, cookie, application, cache etc. 

The more efficient Server.Transfer method simply renders the next page to the browser without an extra round trip. Variables can stay in scope and Page2 can read properties directly from Page1 because it’s still in memory. This technique would be ideal if it wasn’t for the fact that the browser is never notified that the page has changed. Therefore, the address bar in the browser will still show “Page1.aspx” even though the Server.Transfer statement actually caused Page2.aspx to be rendered instead. This may occasionally be a good thing from a security perspective, it often causes problems related to the browser being out of touch with the server. Say, the user reloads the page, the browser will request Page1.aspx instead of the true page (Page2.aspx) that they were viewing. In most cases, Response.Redirect and Server.Transfer can be used interchangeably. But in some cases, efficiency or usability may be the deciding factor in choosing.

Difference between DataGrid, DataLsit and Repeater?Posted by: SyedshakeerDifference between DataGrid, DataLsit and Repeater? 

DataGrid: 

1) DataGird has a in-built Support for Sort, Filter, and Paging the Data. 

2) Each Row in DataGrid is displayed as a row in the table. 

3) It has an AutoGenarateColumn Property, which can be set to either True or False. Default property is true. 

4) DataGrid has predefined Editing Controls. 

5)Following are the DataGrid Data Control Styles: 

i. AlternatingItemStyle ii. EditItemStyle iii. FooterStyle iv. HeaderStyle v. ItemStyle vi. SelectedItemStyle 

Page 118: ASP

vii. PagerStyle 

6) Following are the DataGrid Data Control Templates(only supported by the TemplateColumna) :

i. HeaderTemplate ii. ItemTemplate iii. EditItemTemplate iv. FooterTemplate 

DataList: 

1) Support Paging, Sorting and editing but explicitly code to do Paging. 

2) It displays the Records in Tabular form. 

3) By default the DataList Displays its Data in a HTML . 

4) You can specify via the repeat columns how many DataSource records should appear HTML .

Eg : 

5)DataList Doesnot have Predefined Editing Controls. 

6) Following are the Data Grid Data Control Styles: 

i. AlternatingItemStyle ii. EditItemStyle iii. FooterStyle iv. HeaderStyle v. ItemStyle vi. SelectedItemStyle vii. SeparatorStyle 

7) Following are DataList Data Control Templates: 

i. AleternatingItemTemplate ii. EditItemTempalte iii. HeaderTemplate iv. ItemTempalte v. SelectedItemTemplate 

Page 119: ASP

vi. SeparatorTemplate vii. SelectedItemTemplate viii. FooterTemplate 

Repeater: 

1) It can be used for lightweight and simple report generation. 

2) It is used to display a Repeated List of items that are bound to the control. 

3) It does not support Paging. 

4) Repeater is faster followed by DataList and finally DataGrid. 

5) To create a table in a Repeater you must include the begin table tag in the HeaderTemplate,a single table row tag in the ItemTemplate and the end table tag in the FooterTemplate 

6)No predefined Styles 

7) Following are Repeater Data Control Templates: 

i. FooterTemplate

What is the difference GridView and between DataGrid(Windows)?Posted by: SyedshakeerGridView : 

1) GridView Control Enables you to add sorting,pagingand editing capabilities without writing any code.

2)GridView Control Automatically Supports paging by setting the ‘PagerSetting’ Property.The Page Setting Property supports four Modles a. Numeric(by default) b. Next Previous c. NumericFirstLast d. Next PreviousLast 

3)It is Used in asp.net 

4)GridView Supports RowUpdating and RowUpdated Events. 

5)GidView is Capable of Pre-Operations and Post-Operations. 

Page 120: ASP

6)GridView Has EditTemplates for this control 

7)It has AutoFormat 

DataGrid(Windows) 

1)DataGid Control raises single Event for operations 

2)DataGird Supports the SortCommand Events that occur when a column is Soted. 

3)DataGrid Supports UpdataCommand Event that occurs when the UpdateButton is clicked for an item in the grid. 

4)DataGrid is used in Windows GUI Application. 

5)It doesnot have EditTemplates for this control 

6)It doesnot have AutoFormat

What’s a bubbled event ?Posted by: CharugoelWhen 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 eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?Posted by: CharugoelWindows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.

Why only boxed types can be unboxed?Posted by: CharugoelUnboxing is the process of converting a Reference type variable to Value type and thus allocating memory on the stack . It happens only to those Reference type variables that have been earlier created by Boxing of a Value Type , therefore internally they contain a value type , which can be obtained through explicit casting . For any other Reference type , they don’t internally contain a Value type to Unboxed via explicit casting . This is why only boxed types can be unboxed.

Page 121: ASP

What’s the difference between System.String and System.StringBuilder classes?Posted by: CharugoelSystem.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.Append Keyword is used in System.StringBuilder but not in System.String.

How’s the DLL Hell problem solved in .NET ?Posted by: CharugoelAssembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

What is meant by urlencode and urldecode?Posted by: Charugoelurlencode() returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits. For example: urlencode(”10.00%”) will return “10%2E00%25?. URL encoded strings are safe to be used as part of URLs. urldecode() returns the URL decoded version of the given string.

What is ViewState ? and how it is managed ?Posted by: CharugoelASP.NET ViewState is a new kind of state service that developers can use to track UI state on a per-user basis. Internally it uses an an old Web programming trick-roundtripping? state in a hidden form field and bakes it right into the page-processing framework.It needs less code to write and maintain state in your Web-based forms.

How to check viewstate tamperingPosted by: PotluriNOTE: This is objective type question, Please click question title for correct answer.

What is State management in ASP.NET?Posted by: AshisamkState management is the process by which you maintain state and page information over multiple requests for the same or different pages. There are 2 types State Management: 

1. Client – Side State Management 

Page 122: ASP

This stores information on the client's computer by embedding the information into a Web page, a uniform resource locator(url), or a cookie. The techniques available to store the state information at the client end are listed down below: 

a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state. 

b. Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state. 

c. Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed. 

d. Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site. 

e. Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL. 

2. Server – Side State Management a. Application State - Application State information is available to all pages, regardless of which user requests a page. 

b. Session State – Session State information is available to all pages opened by a user during a single visit.

Both application state and session state information is lost when the application restarts. To persist user data between application restarts, you can store it using profile properties.

Menton the events in page life cycle and explain them.Posted by: Visitraviyou can see msdn for answer.

How will you upload a file to IIS in Asp and how will you do the same in ASP.net?Posted by: RohitshahFirst of all, we need a HTML server control to allow the user to select the file. This is nothing but the same old <input tag, with the type set to File, such as <input type=file id=”myFile” runat=server />. This will give you the textbox and a browse button. Once you have this, the user can select any file from their computer (or even from a network). Then, in the Server side, we need the following line to save the file to the Web

Page 123: ASP

Server. 

myFile.PostedFile.SaveAs ("DestinationPath") 

Note: The Form should have the following ENC Type <form enctype="multipart/form-data" runat="server">

What does WSDL stand for?Posted by: RohitshahWeb Services Description Language.

What Is The Difference Between ViewState and Session...?Posted by: RohitshahViewState persist the values of controls of particular page in the client (browser) when post back 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.

Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?Posted by: RohitshahThis is where you can set the specific variables for the Application and Session objects.

Difference between DropDownList.Items.Add and DropDownList.Items.Insert methodPosted by: SheoNArayanDropDownList.Items.Add method allows you to add new ListItem into the DropDownList. This item will be added as the last item of the DropDownList. 

dropDownList.Items.Add(new ListItem("Default Panel", "0"));

DropDownList.Items.Insert method allows you to specify the index of the item within the DropDownList where you want to insert the ListItem. 

dropDownList.Items.Insert(0, new ListItem("Default Panel", "0"));

Page 124: ASP

Here Default Value will be added as the first item in the DropDown.

What does the "EnableViewState" property do? Why would I want it on or off?Posted by: RohitshahIt enables the viewstate on the page. It allows the page to save the users input on a form.

Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.Posted by: Rohitshahinetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.

How to convert an ArrayList into an Array?Posted by: RajaLets say you have myPersonList as an ArrayList that has Person object. If you want to convert this ArrayList into array of your Person object, write like this. 

Person[] personArray = (Person[])myPersonList.ToArray(typeof(Person)); 

Here you need to cast the object into its type.

How many types of cookies are there in ASP.NET ?Posted by: Majith1. Single valued 

request.cookies(”dotnetfunda”)=”Sheo” 

2. Multi valued 

request.cookies(”donetfunda”)(”uname”)=”MAJITH?

What event handlers can I include in Global.asax?Posted by: MajithApplication_Start,Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute, 

Page 125: ASP

Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache, Session_Start,Session_End

What is Code group?Posted by: MajithCode groups represent collections of code and each code group has an associated set of permissions.

What is CAS?Posted by: MajithCAS is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running. For example, it is CAS that will prevent a .NET web applet from formatting your hard disk. How does CAS work? The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set. For example, using the default security policy, a control downloaded from a web site belongs to the 'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet' named permission set. (Naturally the 'Internet' named permission set represents a very restrictive range of permissions.)

What is smart navigation?Posted by: Majith* It eliminates the flash caused during navigation * It persists element focus during postbacks * It persists scroll position during postbacks between pages * It retains the lasts page information in the history of the browser

What is different between WebUserControl and in WebCustomControl ?Posted by: MajithWeb user controls :- Web User Control is Easier to create and another thing is that its support is limited for users who use a visual design tool one gud thing is that its contains static layout one more thing a seprate copy is required for each application. Web custom controls:- Web Custom Control is typical to create and gud for dynamic layout and another thing is it have full tool support for user and a single copy of control is required because it is placed in Global Assembly cache.

What’s a bubbled event?Posted by: Majith

Page 126: ASP

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 eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

What’s the difference between Response.Write() and Response.Output.Write()?Posted by: MajithResponse.Output.Write() allows you to write formatted output.

How to convert an Array into an ArrayList?Posted by: RajaLets say you have array of Person object and you are getting an it from LoadPersons() method of your object like this 

Person[] myPersonArray = myPerson.LoadPersons(); 

Now, if you want to convert above array into an ArrayList just write like this 

ArrayList myPersonList = ArrayList.Adapter(myPersonArray );

How to get the authentication mode from web.config file programmatically at runtime?Posted by: RajaWrite following code. 

System.Web.Configuration.AuthenticationSection section =

(AuthenticationSection)WebConfigurationManager.GetSection("system.web/authentication");

Label1.Text = section.Mode.ToString();

You will get the authentication mode set in your web.config file.

How to load a user control dynamically in runtime?Posted by: RajaWrite following code. 

Control c = (Control)Page.LoadControl("~/usercontrol/MyUserControl.ascx");

Page 127: ASP

Page.Form.Controls.Add(c);

Instead of adding this user control into the Form you can add into Panel too so that you can position it at your desired location. In that case you need to delcare a panel in the .aspx page and write following code.

Panel1.Controls.Add(c);

What are the validation controls in asp.net?Posted by: PosterThere are 5 validation control in asp.net 

1. RequiredFieldValidator 2. RangeValidator 3. RegularExpressionValidator 4. CompareValidator 5. CustomValidator 

ValidationSummary is not a validation control but a control that displays summary of all error occurs while validating the page.

Which two properties are on every validation control?Posted by: PosterWe have two common properties for every validation controls 

1. ControlToValidate 2. ErrorMessage.

What method do you use to explicitly kill a user s session?Posted by: PosterSession.Abandon

What event handlers can I include in Global.asax?Posted by: Poster

Page 128: ASP

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_Start, Session_End 

You can optionally include "On" in any of method names. For example, you can name a BeginRequest event handler.Application_BeginRequest or Application_OnBeginRequest.You can also include event handlers in Global.asax for events fired by custom HTTP modules.Note that not all of the event handlers make sense for Web Services (they're designed for ASP.NET applications in general, whereas .NET XML Web Services are specialized instances of an ASP.NET app). For example, the Application_AuthenticateRequest and Application_AuthorizeRequest events are designed to be used with ASP.NET Forms authentication.

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?Posted by: PosterIn earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they're difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems.As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client.

Explain the differences between Server-side and Client-side code?

Page 129: ASP

Posted by: PosterServer side scripting means that all the script will be executed by the server and interpreted as needed. ASP doesn't have some of the functionality like sockets, uploading, etc. For these you have to make a custom components usually in VB or VC++. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript. Download time, browser compatibility, and visible code - since JavaScript and VBScript code is included in the HTML page, then anyone can see the code by viewing the page source. Also a possible security hazards for the client computer

What does AspCompat="true" mean and when should I use it?Posted by: PosterAspCompat is an aid in migrating ASP pages to ASPX pages. It defaults to false but should be set to true in any ASPX file that creates apartment-threaded COM objects--that is, COM objects registered ThreadingModel=Apartment. That includes all COM objects written with Visual Basic 6.0. AspCompat should also be set to true (regardless of threading model) if the page creates COM objects that access intrinsic ASP objects such as Request and Response. The following directive sets AspCompat to true:

<%@ Page AspCompat="true" %> 

Setting AspCompat to true does two things. First, it makes intrinsic ASP objects available to the COM components by placing unmanaged wrappers around the equivalent ASP.NET objects. Second, it improves the performance of calls that the page places to apartment- threaded COM objects by ensuring that the page (actually, the thread that processes the request for the page) and the COM objects it creates share an apartment. AspCompat="true" forces ASP.NET request threads into single-threaded apartments (STAs). If those threads create COM objects marked ThreadingModel=Apartment, then the objects are created in the same STAs as the threads that created them. Without AspCompat="true," request threads run in a multithreaded apartment (MTA) and each call to an STA-based COM object incurs a performance hit when it's marshaled across apartment boundaries. 

Do not set AspCompat to true if your page uses no COM objects or if it uses COM objects that don't access ASP intrinsic objects and that are registered ThreadingModel=Free or ThreadingModel=Both.

Is it possible to prevent a browser from caching an ASPX page?Posted by: PosterJust call SetNoStore on the HttpCachePolicy object exposed through the Response object's Cache property, as demonstrated here: 

<%@ Page Language="C#" %>

<html>

Page 130: ASP

<body>

<%

Response.Cache.SetNoStore ();

Response.Write (DateTime.Now.ToLongTimeString ());

%>

</body>

</html>

SetNoStore works by returning a Cache-Control: private, no-store header in the HTTP response. In this example, it prevents caching of a Web page that shows the current time.

Where does the Web page belong in the .NET Framework class hierarchy?Posted by: PosterNOTE: This is objective type question, Please click question title for correct answer.

What’s the use of "GLOBAL.ASAX" file?Posted by: SheonarayanGlobal.asax is a file that resides in the root directory of your application. It is inaccessible over the web but is used by the ASP.NET application if it is there. It is a collection of event handlers that you can use to change and set settings in your site. The events can come from one of two places - The HTTPApplication object and any HTTPModule object that is specified in web.confg or machine.config.

What’s a SESSION and APPLICATION object ?Posted by: SheonarayanSessioin object is used to store user specific data into server memory. Session["MyData"] = "Store This data"; 

Application object is used to store application specific data into server memory. Application["MyData"] = "Global value";

What are user controls and custom controls?

Page 131: ASP

Posted by: PosterCustom controls: A control authored by a user or a third-party software vendor that does not belong to the .NET Framework class library. This is a generic term that includes user controls. A custom server control is used in Web Forms (ASP.NET pages). A custom client control is used in Windows Forms applications. 

User Controls: In ASP.NET: A user-authored server control that enables an ASP.NET page to be re-used as a server control. An ASP.NET user control is authored declaratively and persisted as a text file with an .ascx extension. The ASP.NET page framework compiles a user control on the fly to a class that derives from the System.Web.UI.UserControl class.

Where do you add an event handler?Posted by: PosterIt's the Attributes property, the Add function inside that property. 

e.g. btnSubmit.Attributes.Add("onMouseOver","someClientCode();")

What are the different types of caching?Posted by: PosterCaching is a technique widely used in computing to increase performance by keeping frequently accessed or expensive data in memory. In context of web application, caching is used to retain the pages or data across HTTP requests and reuse them without the expense of recreating them.ASP.NET has 3 kinds of caching strategiesOutput CachingFragment CachingData 

CachingOutput Caching: Caches the dynamic output generated by a request. Some times it is useful to cache the output of a website even for a minute, which will result in a better performance. For caching the whole page the page should have OutputCache directive.<%@ OutputCache Duration="60" VaryByParam="state" %> 

Fragment Caching: Caches the portion of the page generated by the request. Some times it is not practical to cache the entire page, in such cases we can cache a portion of page<%@ OutputCache Duration="120" VaryByParam="CategoryID;SelectedID"%> 

Data Caching: Caches the objects programmatically. For data caching asp.net provides a cache object for eg: cache["States"] = dsStates;

What are different types of directives in .NET?Posted by: Poster@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .aspx files <%@ Page AspCompat="TRUE" language="C#" %> 

Page 132: ASP

@Control: Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .ascx files. <%@ Control Language="VB" EnableViewState="false" %> 

@Import: Explicitly imports a namespace into a page or user control. The Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @Import directives. <% @ Import Namespace="System.web" %> 

@Implements: Indicates that the current page or user control implements the specified .NET framework interface.<%@ Implements Interface="System.Web.UI.IPostBackEventHandler" %> 

@Register: Associates aliases with namespaces and class names for concise notation in custom server control syntax.<%@ Register Tagprefix="Acme" Tagname="AdRotator" Src="AdRotator.ascx" %>

@Assembly: Links an assembly to the current page during compilation, making all the assembly's classes and interfaces available for use on the page. <%@ Assembly Name="MyAssembly" %><%@ Assembly Src="MySource.vb" %> 

@OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a user control contained in a page<%@ OutputCache Duration="#ofseconds" Location="Any | Client | Downstream | Server | None" Shared="True | False" VaryByControl="controlname" VaryByCustom="browser | customstring" VaryByHeader="headers" VaryByParam="parametername" %> 

@Reference: Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.

Can a user browsing my Web site read my Web.config or Global.asax files?Posted by: PosterNo. The <HTTPHANDLERS>section of Machine.config, which holds the master configuration settings for ASP.NET, contains entries that map ASAX files, CONFIG files, and selected other file types to an HTTP handler named HttpForbiddenHandler, which fails attempts to retrieve the associated file. You can modify it by editing Machine.config or including an section in a local Web.config file.

What's the difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript?Posted by: PosterRegisterClientScriptBlock is for returning blocks of client-side script containing functions. RegisterStartupScript is for returning blocks of client-script not packaged in functions-in other words, code that's to execute when the page is loaded. The latter positions script blocks near the end of the document so elements on the page that the script interacts are loaded before the script runs.<%@ Reference Control="MyControl.ascx" %>

Page 133: ASP

Do session use cookies?Posted by: SheonarayanNo, session is stored in server memory.

What are the various ways of authentication techniques in ASP.NET?Posted by: SheonarayanASP.NET provides three ways to authenticate a user: 

* Windows authentication, * Forms authentication, and * Passport authentication

How to improve performance of web page in asp.net?Posted by: RajaMinimize the use of ViewState, Session, Turn off tracing etc. 

For more see http://dotnetfunda.com/articles/article45.aspx

What is the difference between asp:Label and asp:Literal control?Posted by: Rajaasp:Label control asp:Label control is used to write text on the page with different formatting options like bold, italic, underlined etc.For more on asp:Label see http://dotnetfunda.com/tutorials/controls/label.aspx 

asp:Literal control Literal control is used to write simple text on the page, you can use server side formatting options like bold, italic, underlined. For more on asp:Literal see http://dotnetfunda.com/tutorials/controls/literal.aspx

What is HttpHandler?Posted by: RajaHttpHanlder is the low level Request and Response API to service incoming Http requests. All handlers implement the IHttpHandler interface. There is no need to use any extra namespace to use it as it contains in the System.Web namespace. Handlers are somewhat analogous to Internet Server Application Programming Interface (ISAPI) extensions. 

Page 134: ASP

Each incoming HTTP request received by ASP.NET is ultimately processed by a specific instance of a class that implements IHTTPHanlder. IHttpHanlderFactory provides the infrastructure that handles the actual resolution of URL requests to IHttpHanlder instances. In addition to the default IHttpHandlerFactory classes provided by ASP.NET, developers can optionally create and register factories to support rich request resolution.

What is EnableViewStateMAC?Posted by: RajaWhen EnableViewStateMAC is true for a page, the encoded and encrypted viewstate is checked to verify that it has not been tempered with on the client machine. 

A EnableViewStateMAC is encoded version of the hidden variable that a page's viewstate is persisted to when sent to the browser.

How to copy items from one DropDownList control to another DropDownList control.Posted by: RajaWrite following coder 

foreach (ListItem item in drop1.Items)

{

drop2.Items.Add(item);

}

Where drop1 is the id of first DropDownList and drop2 is the id of second DropDownList control.

How to make sure that despite using validation control on your.aspx page, your page is valid? or how to validate the page in the server side?Posted by: Rajause Page.IsValid method, this revalidate your data server side against each Validation control used.

Page 135: ASP

What is the lifespan for items stored in ViewState?Posted by: RajaItem stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

Explain what a diffgram is, and a good use for one?Posted by: RajaThe DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

what is the control for which by default post back is enabled(true)Posted by: RaghaNOTE: This is objective type question, Please click question title for correct answer.

How do you retrieve username in case of Windows Authentication?Posted by: RajaSystem.Environment.UserName

Types of Configuration files and their difference?Posted by: Raja1. Application level config = Web.config. 2. Machine level config = Machine.config.

How can you manage server-side state?Posted by: RajaNOTE: This is objective type question, Please click question title for correct answer.

How can you manage client-side state?Posted by: RajaNOTE: This is objective type question, Please click question title for correct answer.

Which is statelessPosted by: RajaNOTE: This is objective type question, Please click question title for correct answer.

Difference between DataSet and DataReader

Page 136: ASP

Posted by: RajaDataReader =========== DataReader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). DataReader is readonly so we can't do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires no transaction. As DataReader is forward only so we can't fetch data randomly. .NET Data Providers optimizes the datareader to handle huge amount of data. 

DataSet ======= DataSet is an in memory representation of a collection of Database objects including tables of a relational database schemas. DataSet is always a bulky object that requires a lot of memory space compare to DataReader. We can say that the DataSet is a small database because it stores the schema and data in the application memory area. DataSet fetches all data from the datasource at a time to its memory area. So we can traverse through the object to get the required data like querying database.

What data types do the asp:RangeValidator control support?Posted by: WebmasterNOTE: This is objective type question, Please click question title for correct answer.

What is ViewState?Posted by: WebmasterViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used to retain the state of server-side objects between postabacks.

What is custom tag in web.config file?Posted by: RajaCustom tag allows you to create your own tag and specify key value pair for it.

What is difference between Trace and Debug?Posted by: RajaUse Debug class to debug builds Use Trace class for both debug and release builds.

Page 137: ASP

What is ASP.NET 2.0 Page Life Cycle?Posted by: RajaMain Events ============= 1. OnPreInit 2. OnInit 3. OnInitComplete 4. LoadViewState 5. OnPreLoad 6. OnLoad 7. RaisePostBackEvent 8. OnLoadComplete 9. OnPreRender 10. OnPreRenderComplete 11. SaveViewState 12. OnRender 13. OnUnload 

Detailed Events ============ 1. Constructor 2. Construct 3. TestDeviceFilter 4. AddParsedSubObject 5. DeterminePostBackMode 6. OnPreInit 7. LoadPersonalizationData 8. InitializeThemes 9. OnInit 10. ApplyControlSkin 11. ApplyPersonalization 12. OnInitComplete 13. LoadPageStateFromPersistenceMedium 14. LoadControlState 15. LoadViewState 16. ProcessPostData1 17. OnPreLoad 18. OnLoad 19. ProcessPostData2 20. RaiseChangedEvents 21. RaisePostBackEvent 22. OnLoadComplete 23. OnPreRender 

Page 138: ASP

24. OnPreRenderComplete 25. SavePersonalizationData 26. SaveControlState 27. SaveViewState 28. SavePageStateToPersistenceMedium 29. Render 30. OnUnload

54 ASP and ASP.NET questionsBy admin | December 21, 2006

1. Explain the life cycle of an ASP .NET page.

2. Explain the .NET architecture.

3. What are object-oriented concepts?

4. How do you create multiple inheritance in c# and .NET?

5. When is web.config called?

6. How many weg.configs can an application have?

7. How do you set language in weg.config?

8. What does connection string consist of?

9. Where do you store connection string?

10. What is abstract class?

11. What is difference between interface inhertance and class inheritance?

12. What are the collection classes?

13. What are the types of threading models?

14. What inheritance does VB.NET support?

15. What is a runtime host?

16. Describe the techniques for optimizing your application?

17. Differences between application and session

18. What is web application virtual directory?

19. Differences between Active.exe and Dll

20. Connection pooling in MTS?

21. If cookies is disabled in client browser, will session tracking work?

22. How do you make your site SSL-enabled?

23. Will the following code execute successfully: response.write(’value of i=’+i);

24. What are the provides available with VB.NET?

25. What is a Process, Sesion and Cookie?

26. What are Abstract base classes?

27. What are the Difference between bstract base classes and Abstrat classes

28. What are interface in .NET?

29. How is Polymorphism supports in .NET?

30. What are the 2 types of polymorphism supports in .NET?

31. Types of compatibilities and explain them.

32. What is aggregative? How can it be implements in .NET?

33. Difference between COM components and .NET components?how to register it

34. Difference between early binding and late binding?

35. ASP.NET OBJECTS?

36. Asp.NET life cycle? When request mode

Page 139: ASP

37. Explain ADO and its objects.

38. What is side by side execution?

39. Explain serialization?

40. Explain a class access specifiers and method acess specifiers.

41. What is the difference between overloading and overriding ? how can this be .NET

42. Explain virtual function and its usage.

43. How do you implement inhetance in .NET?

44. If I want to override a method 1 of class A and this class B then how do you declared

45. Explain friend and protected friend.

46. Explain multiple and multi_level inheritance in .NET?

47. Name all kind of access specifiers for a class and for methods?

48. On ODP.NET

49. What is non-derterministic finalization?

50. What is isPostback property?

51. What is dictionary base class?

52. How can a class be extended and how is this mechanism difff from that of

implementation an interface?

53. What are indexes .NET?

54. How can indexes be implemented in .NET?