Website:
The Web Site project is compiled on the fly. You end up with a lot more DLL files, which can be a pain. It also gives problems when you have pages or controls in one directory that need to reference pages and controls in another directory since the other directory may not be compiled into the code yet. Another problem can be in publishing.
If Visual Studio isn't told to re-use the same names constantly, it will come up with new names for the DLL files generated by pages all the time. That can lead to having several close copies of DLL files containing the same class name,
which will generate plenty of errors. The Web Site project was introduced with Visual Studio 2005, but it has turned out not to be popular.
Web Application:
The Web Application Project was created as an add-in and now exists as part
of SP 1 for Visual Studio 2005. The main differences are the Web Application Project
was designed to work similarly to the Web projects that shipped with Visual Studio 2003. It will compile the application into a single DLL file at build
time. To update the project, it must be recompiled and the DLL file
published for changes to occur.
Another nice feature of the Web Application
project is it's much easier to exclude files from the project view. In the
Web Site project, each file that you exclude is renamed with an excluded
keyword in the filename. In the Web Application Project, the project just
keeps track of which files to include/exclude from the project view without
renaming them, making things much tidier.
Reference
The article ASP.NET 2.0 - Web Site vs Web Application project also gives reasons on why to use one and not the other. Here is an excerpt of it:
- You need to migrate large Visual Studio .NET 2003 applications to VS
2005? use the Web Application project.
- You want to open and edit any directory as a Web project without
creating a project file? use Web Site
project.
- You need to add pre-build and post-build steps during compilation?
use Web Application project.
- You need to build a Web application using multiple Web
projects? use the Web Application project.
- You want to generate one assembly for each page? use the Web Site project.
- You prefer dynamic compilation and working on pages without building
entire site on each page view? use Web
Site project.
- You prefer single-page code model to code-behind model? use Web Site
project.
Web Application Projects versus Web Site Projects (MSDN) explains the differences between the web site and web application projects. Also, it discusses the configuration to be made in Visual Studio.
In general, anytime you are debugging or developing a Dynamic Data website, one should goto the Site.master file and set the ScriptManager's attribute EnablePartialRendering to false:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false"/>
This will make exceptions more apparent that otherwise seem to be swept under the rug because of the use of Update Panels that wrap around the DetailsView, FormViews and GridViews on the List/Edit/Insert/Details/ListDetails page templates.
I think the real problem you are running into has something to do with error handling and update panels. When debugging in IE, do you see a little exclamation point in the bottom left of the screen? If so, click on it and you will see the javascript error (Sys.WebForms.PageRequestManagerServerErrorException) that has occured because of the unhandled exception.
For more on this, check out ScottGu's Blog on the topic.
@Aaron's comment: that is too early to capture the errors he is referring to. I think, in this scenario, he wants to handle the Updated event because the EntitydataSource will not actually throw an exception until after it gives this event's handlers a chance to run: (MSDN):
If an error occurs when changes are
persisted to the data source, the
Updated event is raised and the
Exception property of the
EntityDataSourceChangedEventArgs
object is set to the returned
Exception. If you handle the exception
in the Updated event handler, set the
ExceptionHandled property to true.
This prevents the exception from being
raised again. When you specify a value
of false for the ExceptionHandled
property, the EntityDataSource
re-raises the exception.
Best Answer
Exceptions can be detected, if not caught, in the CUD event arguments on the DetailsView and the DataSource controls, e.g. events such as
DetailsView_ItemInserted
, andDetailsDataSource_Inserting
haveException Exception
andbool ExceptionHandled
properties for handling exceptions.