ASP.NET Interview Questions and Answers (1544) - Page 8

Which should be used to redirect on next page in the same server?

NOTE: This is objective type question, Please click question title for correct answer.
Response.Redirect() can be used to redirect from one page to another page in

NOTE: This is objective type question, Please click question title for correct answer.
What is wrong with this code? Server.transfer("Default.HTML");

It 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.
What if Some one types the URL of web.config file in the browser?

ASP.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.
What is the name of class from which web pages are inherited?

NOTE: This is objective type question, Please click question title for correct answer.
How do you create a permanent cookie?

Set expires property to Date.MaxValue (HttpCookie.Expires = Date.MaxValue)
What are the expiration policies for Cached objects?

There 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 turn off cookies for one page in your site?

Use the Cookie.Discard Property which Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user’s hard disk when a session ends.
What's the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?

Code 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?

Yes, application will inherit cofiguration setting from machine.config file.
What is Event Bubbling?(

Server 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 [...]
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.Bitmap

1. 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.
What’s the Difference Between <%# i %> and <%= i %>?

We 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.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories