Create new account I forgot my password    

ASP.NET 2.0 Interview Questions - Intermediate Level
Rating: 84 user(s) have rated this article Average rating: 4.4
Posted by: Suprotim Agarwal, on 6/17/2007, in category "Interview Questions"
Views: this article has been read 68792 times
Abstract: The questions mentioned here are usually asked for intermediate users having 2-3 years of relevant ASP.NET experience.

ASP.NET 2.0 Interview Questions – (Intermediate)
 
The Q&A mentioned over here have been taken from forums, my colleagues and my own experience of conducting interviews. I have tried to mention the contributor wherever possible. If you would like to contribute, kindly use the Contact form. If you think that a credit for a contribution is missing somewhere, kindly use the same contact form and I will do the needful.
What is XHTML? Are ASP.NET Pages compliant with XHTML?
In simple words, XHTML is a stricter and cleaner version of HTML. XHTML stands for EXtensible Hypertext Markup Language and is a W3C Recommendation.
Yes, ASP.NET 2.0 Pages are XHTML compliant. However the freedom has been given to the user to include the appropriate document type declaration.
Can I deploy the application without deploying the source code on the server?
Yes. You can obfuscate your code by using a new precompilation process called ‘precompilation for deployment’. You can use the aspnet_compiler.exe to precompile a site. This process builds each page in your web application into a single application DLL and some placeholder files. These files can then be deployed to the server.
You can also accomplish the same task using Visual Studio 2005 by using the Build->Publish menu.
Does ViewState affect performance? What is the ideal size of a ViewState? How can you compress a viewstate?
Viewstate stores the state of controls in HTML hidden fields. At times, this information can grow in size. This does affect the overall responsiveness of the page, thereby affecting performance. The ideal size of a viewstate should be not more than 25-30% of the page size.
Viewstate can be compressed to almost 50% of its size. .NET also provides the GZipStream or DeflateStream to compress viewstate. Another option is explained by Scott Hanselmann over here.
How can you detect if a viewstate has been tampered?
By setting the EnableViewStateMac to true in the @Page directive. This attribute checks the encoded and encrypted viewstate for tampering.
Can I use different programming languages in the same application?
Yes. Each page can be written with a different programming language in the same application. You can create a few pages in C# and a few in VB.NET.
Can the App_Code folder contain source code files in different programming languages?
No. All source code files kept in the root App_Code folder must be in the same programming language.
Update: However, you can 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.
How do you secure your connection string information?
By using the Protected Configuration feature.
How do you secure your configuration files to be accessed remotely by unauthorized users?
ASP.NET configures IIS to deny access to any user that requests access to the Machine.config or Web.config files.
How can I configure ASP.NET applications that are running on a remote machine?
You can use the Web Site Administration Tool to configure remote websites.
How many web.config files can I have in an application?
You can keep multiple web.config files in an application. You can place a Web.config file inside a folder or wherever you need (apart from some exceptions) to override the configuration settings that are inherited from a configuration file located at a higher level in the hierarchy.
I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy?
By setting the element's Override attribute to false.
What is the difference between Response.Write and Response.Output.Write?
As quoted by Scott Hanselman, the short answer is that the latter gives you String.Format-style output and the former doesn't. 
To get a detailed explanation, follow this link.
What is Cross Page Posting? How is it done?
By default, ASP.NET submits a form to the same page. In cross-page posting, the form is submitted to a different page. This is done by setting the ‘PostBackUrl’ property of the button(that causes postback) to the desired page. In the code-behind of the page to which the form has been posted, use the ‘FindControl’ method of the ‘PreviousPage’ property to reference the data of the control in the first page.
Can you change a Master Page dynamically at runtime? How?
Yes. To change a master page, set the MasterPageFile property to point to the .master page during the PreInit page event.
How do you apply Themes to an entire application?
By specifying the theme in the web.config file.
Eg: <configuration>
<system.web>
<pages theme=”BlueMoon” />
</system.web>
</configuration>
 
How do you exclude an ASP.NET page from using Themes?
To remove themes from your page, use the EnableTheming attribute of the Page directive.
Your client complains that he has a large form that collects user input. He wants to break the form into sections, keeping the information in the forms related. Which control will you use?
The ASP.NET Wizard Control.
To learn more about this control, visit this link.
Do webservices support data reader?
No. However it does support a dataset.
What is use of the AutoEventWireup attribute in the Page directive ?
The AutoEventWireUp is a boolean attribute that allows automatic wireup of page events when this attribute is set to true on the page. It is set to True by default for a C# web form whereas it is set as False for VB.NET forms. Pages developed with Visual Studio .NET have this attribute set to false, and page events are individually tied to handlers.
What happens when you change the web.config file at run time?
ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.
Can you programmatically access IIS configuration settings?
Yes. You can use ADSI, WMI, or COM interfaces to configure IIS programmatically.
How does Application Pools work in IIS 6.0?
As explained under the IIS documentation, when you run IIS 6.0 in worker process isolation mode, you can separate different Web applications and Web sites into groups known as application pools. An application pool is a group of one or more URLs that are served by a worker process or set of worker processes. Any Web directory or virtual directory can be assigned to an application pool.
 
Every application within an application pool shares the same worker process. Because each worker process operates as a separate instance of the worker process executable, W3wp.exe, the worker process that services one application pool is separated from the worker process that services another. Each separate worker process provides a process boundary so that when an application is assigned to one application pool, problems in other application pools do not affect the application. This ensures that if a worker process fails, it does not affect the applications running in other application pools.
 
Use multiple application pools when you want to help ensure that applications and Web sites are confidential and secure. For example, an enterprise organization might place its human resources Web site and its finance Web site on the same server, but in different application pools. Likewise, an ISP that hosts Web sites and applications for competing companies might run each companys Web services on the same server, but in different application pools. Using different application pools to isolate applications helps prevent one customer from accessing, changing, or using confidential information from another customers site.
In HTTP.sys, an application pool is represented by a request queue, from which the user-mode worker processes that service an application pool collect the requests. Each pool can manage requests for one or more unique Web applications, which you assign to the application pool based on their URLs. Application pools, then, are essentially worker process configurations that service groups of namespaces.
Multiple application pools can operate at the same time. An application, as defined by its URL, can only be served by one application pool at any time. While one application pool is servicing a request, you cannot route the request to another application pool. However, you can assign applications to another application pool while the server is running.
 
If you liked the article,  Subscribe to my RSS Feed or Subscribe Via Email







Follow me on twitter

Page copy protected against web site content infringement by Copyscape


How would you rate this article?

User Feedback
Comment posted by abdalla gabshawi on Tuesday, August 07, 2007 9:29 AM
Really nice questions.. So useful and precise
Continue ur extra-good work !!
I'm waiting for the next bulk of questions..
Comment posted by Dot Net Master on Friday, August 10, 2007 10:38 AM
Good Queations & Answers

You can find more questions at

http://www.dotnetinterviewfaqs.com/
Comment posted by Xena on Tuesday, September 04, 2007 12:43 AM
Q:  I'm looking at setting up a login page and depending on the person/user info it directs them to a different folder of info in the same site.  Is this possible and if so can you please help me out with the steps =0)  I want to make sure that it will be secure and that person A can not login to person B info.  Make sense?  Thanks for your help.
Comment posted by JayakrishnaReddy on Wednesday, September 12, 2007 1:30 PM
really very very good questions...thanks a lot for giving this type of info...
Comment posted by Suprotim Agarwal on Sunday, September 30, 2007 6:29 AM
You are most welcome. Thanks you all for your comments.
Comment posted by kalai on Sunday, November 04, 2007 8:44 PM
good questions!
In App_Code folder we can have source code  from different languages by creating sub directory inside the app_Code folder.
Comment posted by HariKrishna on Tuesday, February 05, 2008 6:21 AM
hi this is harikrishna

    thanks for ur's useful interview questions
i want some more questions on this
plz provide me if u have.....

thanks&regards
harikrishna.b
Comment posted by Mukesh Attarde on Wednesday, February 27, 2008 2:17 AM
very very good questions.Thanks
Comment posted by gallopse on Wednesday, February 27, 2008 2:53 AM
Nice Questions for Intermediate Level users.
www.gallopse.com
www.blogs.gallopse.com
visit my websites for more help and knowledge.
Comment posted by Jagadeesh on Tuesday, March 11, 2008 7:37 AM
Nice site...

http://programmingmaterials.blogspot.com/  <-- ASP.NET Interview questions and Answers
Comment posted by Sheo Narayan on Thursday, April 24, 2008 1:12 PM
More ASP.NET interview questions can be found http://www.dotnetfunda.com/interview/ShowCatQuestion.aspx?category=33
Comment posted by Raj on Sunday, May 11, 2008 9:00 PM
Nice questions! worth reading
Comment posted by Sachin on Thursday, May 15, 2008 12:57 AM
Very Useful Questions.
It's really nice.
Comment posted by Anil Kumar Reddy on Friday, May 16, 2008 7:54 AM
Nice site...

http://dotnet-interviews.blogspot.com//  <-- ASP.NET Interview questions and Answers
Comment posted by Rajesh on Friday, May 16, 2008 7:55 AM
I found good interview questions site.

http://dotnet-interviews.blogspot.com
Comment posted by sakunthalaprakash on Monday, May 19, 2008 4:59 AM
Nice Site... I found many answers. All the answers are very useful. Thanks a lot for giving this like information. Thank You Very Much...! I need More Like This... Please....
Comment posted by Vanitha Krishnan on Thursday, May 22, 2008 7:20 AM
It's very very useful site for an intermediate leveler's because I have selected 2 rounds in an interview.
Comment posted by jyoti on Friday, May 23, 2008 7:45 AM
this is vry useful site . all the best
Comment posted by David Kiff on Monday, June 16, 2008 10:54 AM
"Can the App_Code folder contain source code files in different programming languages?
No. All source code files kept in the App_Code folder must be in the same programming language."

Yes it can!  You can configure it in the web.config file, and you will need to sperate the different lanugages into different folders ie:
app_code\VBNETCode
app_code\CSharpCode
Comment posted by Suprotim Agarwal on Tuesday, June 17, 2008 11:48 AM
Agreed David. Indeed it can be done. I meant two languages kept in the root. Keeping it in folders is a handy technique.
Comment posted by venkateswaran on Thursday, July 03, 2008 3:13 AM
very useful site...
nice question and answer
Comment posted by Stalin on Friday, July 04, 2008 1:30 AM
Absolutely wonderful and Very Useful Stuff.
Comment posted by rituraj gupta on Monday, July 07, 2008 12:10 AM
very useful questions................
Comment posted by Rita Roy on Thursday, August 07, 2008 7:45 AM
The set is a wonderful set to use before an interview. I also saw similar such sets in a couple of websites. I would also suggest readers to go through
http://www.kanbal.com/index.php?/ASP.Net/net-webdev-interview-questions-set-1.html

There seems to be 3 sets of such queries that are really useful
Comment posted by carlos martinez on Thursday, August 14, 2008 4:26 AM
there are more problems with viewstate than just the bandwidth it consumes. the viewstate value that is posted back to the server is deserialised to a dictionary-like structure, and the resulting values are used to populate a new Page object, making heavy use of reflection to match up the viewstate keys with Page member variables. all the deserialisation and reflection is very expensive - usually much more so than simply going to the database (or application cache) to retrieve values and pulling UI changes directly from the request.
Comment posted by er on Friday, September 19, 2008 3:35 PM
dfdwdw gdfdf
Comment posted by sahil31_mohali on Tuesday, January 27, 2009 2:04 AM
really nice article
Comment posted by Anil on Monday, February 09, 2009 12:10 AM
Another comprehensive site for technical interviews is : http://www.cleartechnicalinterview.com
Comment posted by swati on Friday, February 27, 2009 2:24 AM
very use questions.thanks. keep it up.
Comment posted by Ravi on Tuesday, March 03, 2009 1:12 AM
It’s really very good question.
Comment posted by srinu on Friday, June 05, 2009 9:21 AM
actually your write the answers are very difficult method .please explain easest way
Comment posted by shab on Thursday, July 09, 2009 7:25 AM
Very useful questions to brush up our knowledge.keep up ur gud work........
Comment posted by santosh kumar on Friday, September 11, 2009 1:49 PM
Hi Suprotim Agarwal,
Good collection , thanks for providing.

http://www.operativesystems.com
thanks
Comment posted by Mohammad Shahnawaz on Wednesday, November 11, 2009 3:47 AM
this is very helpful 4 interview.
i thankful to you that u have submitted very important and precious question with this forum.
thanks a lot
Comment posted by a on Thursday, January 21, 2010 1:33 AM
a
Comment posted by srikanthchodavarapu on Thursday, January 28, 2010 7:09 AM
Jquery in asp.net

Post your comment
Name:
E-mail: (Will not be displayed)
Comment:
Insert Cancel