ASP.NET Interview Questions - Experienced Developers

Posted by: Suprotim Agarwal , on 6/17/2007, in Category Interview Questions
Views: 695688
Abstract: The ASP.NET questions and answers mentioned here are usually asked to intermediate to experienced developers having 2-3 years of relevant ASP.NET development experience.

The ASP.NET Q&A mentioned over here are for experienced developers. If you are looking for ASP.NET Questions and Answers for Freshers, head over here: ASP.NET Interview Questions and Answers

ASP.NET Interview Questions and Answers – Experienced Developers

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.

More info can be found at

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 orDeflateStream 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.

You can also view ViewState information as described in this article How to view information in ViewState using ASP.NET 2.0 and 3.5

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.



<pages theme=”BlueMoon” />



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 company’s 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.

Note: This ASP.NET Questions and Answers for Experienced Developers 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.

This article has been editorially reviewed by Suprotim Agarwal.

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigious Microsoft MVP award for Sixteen consecutive years. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that offers Digital Marketing and Branding services to businesses, both in a start-up and enterprise environment.

Get in touch with him on Twitter @suprotimagarwal or at LinkedIn

Page copy protected against web site content infringement 	by Copyscape

Feedback - Leave us some adulation, criticism and everything in between!
Comment posted by abdalla gabshawi on Tuesday, August 7, 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
Comment posted by Xena on Tuesday, September 4, 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 4, 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 5, 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.....

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.
visit my websites for more help and knowledge.
Comment posted by Jagadeesh on Tuesday, March 11, 2008 7:37 AM
Nice site...  <-- 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
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...  <-- ASP.NET Interview questions and Answers
Comment posted by Rajesh on Friday, May 16, 2008 7:55 AM
I found good interview questions site.
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:
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 3, 2008 3:13 AM
very useful site...
nice question and answer
Comment posted by Stalin on Friday, July 4, 2008 1:30 AM
Absolutely wonderful and Very Useful Stuff.
Comment posted by rituraj gupta on Monday, July 7, 2008 12:10 AM
very useful questions................
Comment posted by Rita Roy on Thursday, August 7, 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

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 9, 2009 12:10 AM
Another comprehensive site for technical interviews is :
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 3, 2009 1:12 AM
It’s really very good question.
Comment posted by srinu on Friday, June 5, 2009 9:21 AM
actually your write the answers are very difficult method .please explain easest way
Comment posted by shab on Thursday, July 9, 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.
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
Comment posted by srikanthchodavarapu on Thursday, January 28, 2010 7:09 AM
Jquery in
Comment posted by garry on Friday, September 3, 2010 2:43 AM
The link in the question
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?
is not working.
Please make it available asap.
Comment posted by Suprotim Agarwal on Saturday, September 4, 2010 4:32 AM
garry: Yes that link's broken. I have replaced it with another one.
Comment posted by Soran Singh Fouzdar on Sunday, September 19, 2010 2:18 AM
I didn't get extra thing about .Net Framework so keep it up for better responce.
Comment posted by chai on Wednesday, September 22, 2010 12:11 AM
i found some useful ques on
Comment posted by ROBOT on Thursday, September 30, 2010 8:44 AM
very nice questions...keep it up........
Comment posted by ajith gk on Sunday, December 12, 2010 5:49 AM
These are very nice questions.... I congratulating you for uploading these type of amazing interview question to this site.... I am completed my graduation - BCA and waiting 4 result.. My final year project was done in - language C#.. Now i'm working in a software development and training company named INFODAWN as a trainee in - C#.... I asked a question to you for getting the c# code.. How to record a sound in
Comment posted by vaibhav parmar on Thursday, December 30, 2010 6:09 AM
hello u have wrong that Do webservices support data reader? wrong answer webservices support it and i have used it.
like this
<WebMethod()> _
    Public Function getCountries(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
        Dim strquery As String = "Select * from vi_Country"
        Dim samplesource As New List(Of CascadingDropDownNameValue)    
        Dim dr As SqlDataReader = SqlHelper.ExecuteReader(ConfigurationManager.ConnectionStrings("VisionConnString").ToString(), CommandType.Text, strquery)
            While dr.Read
                Dim cCountryId = dr("couCountryId").ToString()
                Dim countryname = dr("couCountryName").ToString()
                samplesource.Add(New CascadingDropDownNameValue(countryname, cCountryId))
            End While
            Return samplesource.ToArray()
        Catch ex As Exception
            Throw ex
        End Try
    End Function

so check it and correct it.
Comment posted by hare_krsna16 on Wednesday, May 11, 2011 9:45 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 Ajay Phadtare on Tuesday, May 31, 2011 12:21 AM
Sir I want All Interview Question on if possible please send m all question & answer of all
thanking you

Ajay Phadtare

Comment posted by Praveen on Friday, December 9, 2011 6:44 AM
Thanks, your blog is not bad. Add some more collections. Its very useful to .Net programmers.
Comment posted by harendra singh on Wednesday, December 21, 2011 1:35 AM
thanku your blog is very good .and very important question
Comment posted by Bharti on Wednesday, December 28, 2011 4:22 AM
Comment posted by shashi on Thursday, February 2, 2012 10:56 AM
Sir I want All Interview Question on if possible please send m all question & answer of all
thanking you
Comment posted by sathya on Friday, April 6, 2012 7:45 AM
can u tell me what all things in dotnet must be known to a one year experienced guy to get a job in mnc companys??
plz mail me the details to
thank you.
Comment posted by sandeep singh on Tuesday, April 10, 2012 6:46 AM
very good site
Comment posted by mdfdjfkjd on Monday, April 16, 2012 4:38 AM
Comment posted by karan on Friday, April 27, 2012 8:32 AM
Please provide interview questions for .net 4.0 and 3.5 questions also
Comment posted by Application development with Microsoft .NET applic on Tuesday, May 29, 2012 6:26 AM
Application development with Microsoft .NET application blocks
Comment posted by b on Monday, June 4, 2012 11:28 AM
Comment posted by b on Tuesday, June 5, 2012 8:55 AM
Comment posted by Muthu on Tuesday, June 26, 2012 11:21 PM
Its really usefull, need more code based sample Q&A for the same .....
Comment posted by jp on Friday, August 3, 2012 10:46 AM
Comment posted by pooja goel on Friday, August 31, 2012 12:48 AM
what is difference between static constructor and instance constructor?
Comment posted by sad on Tuesday, September 25, 2012 7:46 AM
Comment posted by dsfdsf on Tuesday, September 25, 2012 7:52 AM
Comment posted by albert on Sunday, September 30, 2012 12:05 AM
You can go through the stuff in
It is only a start up and can expect more things in future
Comment posted by Albert on Tuesday, October 2, 2012 1:32 PM
You can go through the stuff in
It is only a start up and can expect more things in future
Comment posted by ASP.NET Interview Questions & Answers on Wednesday, November 28, 2012 10:02 AM
Interview Questions and Answers on ASP.Net Lots of interesting Interview Questions and Answers are available from the ASP.Net.
Comment posted by matt on Thursday, May 30, 2013 3:38 AM
c# interview question and answers

Comment posted by Hameedullah on Tuesday, June 4, 2013 12:19 AM
Im student BCS in Afghanisan
Comment posted by dssdfv on Wednesday, July 3, 2013 6:52 AM
Comment posted by Dhirendra kumara on Friday, July 26, 2013 12:08 PM
It was very useful and please post some other basic questions.Once again Thank you
Comment posted by Dhirendra kumara on Friday, July 26, 2013 12:08 PM
It was very useful and please post some other basic questions.Once again Thank you
Comment posted by ajay on Friday, May 2, 2014 6:50 AM
It was very useful and please post some other basic questions.Once again Thank you.
If you want to get more interview question with good explanation then use this link
Comment posted by besant on Monday, August 18, 2014 2:49 AM
it is very helpful for fresher

<a href="">Web Designing Training in Chennai</a>
Comment posted by Sumit on Monday, September 29, 2014 8:45 AM
I just discovered a good site for interview questions..visit