I was deploying an ASP.NET application on IIS 5.1 the other day, when I was hit by the following error when trying to access some of the aspx pages from the browser.
/*********************************************************************************/
Server Error in '/' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls.
Source Error:
Line x: [/asp:content]
Line x+1:
/*********************************************************************************/
All pages were content pages of some master page. And nothing was written after the closing content tag.
At first I thought this was some kind of .NET vs IIS version mismatch or that I needed to change some IIS settings, since this was running fine on different IIS versions.
But to my surprise, some pages were displayed fine.
After banging my head few times, I found out the cause. The pages that were complaining had some spaces and empty lines after the closing content tag. This should mean nothing in html, but I guess IIS 5.1 didn't like these.
Clearing everything so that the closing content tag is practically the last thing written in a page, did the trick.
Hope this becomes helpful to anyone facing the same issue.
Sunday, November 7, 2010
Subscribe to:
Posts (Atom)