Top 5 ASP.net Interview Questions with Answers – Dr. Charles Wood, Duquesne University
Learn more about ASP.net: http://www.amazon.com/dp/B00T751A0I
Dr. Charles Wood: https://www.linkedin.com/in/profwood
To Tweet to Dr. Charles Wood: @ProfCWood
1. What is the Web.config file and what is it used for?
A web.config file is very important. It contains all the configurations about the database and even for some controls. A web.config file allows you to store information in a secure environment so that hackers have a tough time in getting at it and the servers divide the information easily. This a very nice way to keep your configuration separate from your program. So that when you program gets out, so that the configuration file that hackers use to get into your program does not get out. So, most people use the web.config file quite liberally and should.
2. What is the difference between OLEDB and ODBC?
OLEDB and ODBC are database connectivity questions on how do you connect to the database. ODBC is very old. It is open database connectivity and Microsoft came up with it so that you can connect with multiple databases using the same internal code so that if you wanted to switch say, Oracle to SQL server, you switch the database but you do not rewrite the code. It is very nice. But it only works with databases.
OLE DB works with all sorts of data sources, including databases. Most people say that ODBC is absorbed by OLEDB and everyone should be using OLEDB from now on. I think I agree with that one too. So, if you want to use fax information, phone information, email information, Voice Over IP information – all that is available in OLEDB. You can write routines that provide information to you. That is very important.
3. What is the use of Global.asax in your VB.net environment?
Global.asax if a file that controls a lot of the http handling, especially the session variables. If you want to use sessions, you pretty much have to use global.asax but do not worry. If you make a new project, the global.asax is thrown in there for you. You do not have to worry too much about it.
4. Difference between Response.Redirect and Server.Transfer?
Response.redirect sends a message to the client machine saying that, hey you wanted to go my webpage but go to this webpage instead. This happen when you move a webpage. A server.transfer does not tell the client machine anything. It says that I know you wanted to go to my webpage, I am going to go to a server lever, grab information about webpage and give it to you – the client, without telling the client anything. So, many client machines does not want to use response.redirect. We do not want to be redirected when the server tells us to be redirected and so they immediately stops you from redirecting them wheras a server transfer allows you to redirect without actually allowing them to redirecting them, instead your URL will still appear in the client machine.
So, it actually depends. If you want to keep your URL and hide information from other machines, say, your site, then server.transfer works better. If you want to redirect the client to another webpage, then response.redirect is more appropriate.
5. What are the difference between webforms and MVC?
Webforms came out first as an outgrowth of some of the classic ASP, the pre .net stuffs. They are very nicely used. They are very easy to use, easy to understand and easy to learn. MVC has a slightly larger learning curve but most people say that Microsoft came up with MVC to speed up development and webforms are someday going to die. Now, whether or not they are true is another story. Microsoft says it is not true but the webform is probably good to use if you already have a bunch of webforms developers already then there is no need to add new MVC products and they will not be able to work on your stuffs. On the other hand, if you have new development with new developers, you might consider MVC. The one thing you should keep note that Grids are better in webforms and MVC people might say that AJAX and Grids are fine in MVC. However, I would suggest MVC because this is where the cutting edge is and development is faster in MVC.