In my setup I have a couple of "folder" document types whose only purpose is to help organize the site tree. These pages don't have any template assigned to them. I noticed when navigating to them I end up getting the following error. I'm guessing I could create a template that would redirect to the home page or 404 page and assign it to these document types, but I was wondering if there was a more elegant way to fix this?
Server Error in '/' Application.
Sequence contains no elements
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains no elements
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
1- If you want to have a 404 error page you only need to update your umbracoSetting.config file in your config directory
<errors> <!-- the id of the page that should be shown if the page is not found --> <error404>---Your Error Page ID--</error404> </errors>
2- you can have a property named i.e RedirectTo in you all pages i.e in properties tab, and in you top masterpage/ layout/ ... check whether this property has any value, if so navigate to the given address/node
I'm not actually using the errors section of the umbracoSetting.config file because I have a custom 404 handler built as this is a multi-site installation. My 404 page is working in all cases (including pages that are using the umbracoURLAlias property), except for the "folder" nodes that don't have a template assigned to them. It sounds like your second solution is similar to what I was originally thinking, where I would just build out a new template for these "folder" nodes and have the template redirect to another page (like the 404 page). But, I was hoping to find out why the error was occurring in the first place as this seems like a bug (I get the .net error "Sequence contains no elements" if there is no template assigned to a node).
I dont believe that is a bug. Umbraco tries to render the page while no templates is assigned to this page. You should be able to see this error page while developing so you can find your best solution for it.
There was a bug that gave this error message in version 6.0.2 or something...and last week I even saw it on a 6.1.6 solution. I managed to fix it easily since I'm using CE SQL and had it in version control. When it happened to me I was trying to add a property to a document type.
After spending some more time looking around this seems to be a pretty common problem. In any case I created a new template that would just redirect to my 404 page for these document types that aren't supposed to actually display a webpage, which seems to work well. Thank you for the suggestions.
Sequence contains no elements
In my setup I have a couple of "folder" document types whose only purpose is to help organize the site tree. These pages don't have any template assigned to them. I noticed when navigating to them I end up getting the following error. I'm guessing I could create a template that would redirect to the home page or 404 page and assign it to these document types, but I was wondering if there was a more elegant way to fix this?
Server Error in '/' Application.
Sequence contains no elements
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains no elements
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446
There are multiple solutions for this problem:
1- If you want to have a 404 error page you only need to update your umbracoSetting.config file in your config directory
2- you can have a property named i.e RedirectTo in you all pages i.e in properties tab, and in you top masterpage/ layout/ ... check whether this property has any value, if so navigate to the given address/node
Hi Amir,
I'm not actually using the errors section of the umbracoSetting.config file because I have a custom 404 handler built as this is a multi-site installation. My 404 page is working in all cases (including pages that are using the umbracoURLAlias property), except for the "folder" nodes that don't have a template assigned to them. It sounds like your second solution is similar to what I was originally thinking, where I would just build out a new template for these "folder" nodes and have the template redirect to another page (like the 404 page). But, I was hoping to find out why the error was occurring in the first place as this seems like a bug (I get the .net error "Sequence contains no elements" if there is no template assigned to a node).
Thanks,
nathan
I dont believe that is a bug. Umbraco tries to render the page while no templates is assigned to this page. You should be able to see this error page while developing so you can find your best solution for it.
Hi Nathan
What version of Umbraco are you using?
There was a bug that gave this error message in version 6.0.2 or something...and last week I even saw it on a 6.1.6 solution. I managed to fix it easily since I'm using CE SQL and had it in version control. When it happened to me I was trying to add a property to a document type.
This search on google reveals more information https://www.google.dk/search?q=Sequence+contains+no+elements&oq=Sequence+contains+no+elements&aqs=chrome..69i57j0l5.468j0j4&sourceid=chrome&es_sm=119&ie=UTF-8#q=Sequence+contains+no+elements+umbraco+proworks
Perhaps you could benefit from this blogpost by Proworks http://www.proworks.com/blog/2013/03/11/umbraco-602-upgrade-bug-solution/
Hope this helps.
/Jan
Hi Jan,
After spending some more time looking around this seems to be a pretty common problem. In any case I created a new template that would just redirect to my 404 page for these document types that aren't supposed to actually display a webpage, which seems to work well. Thank you for the suggestions.
Thanks,
nathan
is working on a reply...