no stylesheets loading after upgrade from 1.4.5

Mar 26, 2009 at 7:15 PM
Hi there,

I'm new to BlogEngine.NET and this looks to be a very promising solution for my blogging needs, however I've been having some problems getting it up and running. I got 1.4.5 to work but there looks to be an issue that is resolved in one of the more recent builds with Windows Live Writer dates that I need.

I copied over the bits from the latest build available (25892) and FTP'ed them over as well as recompiled and uploaded the three new bin files (BlogEngineCore.dll etc) via VS2008 and the site works now, however it appears there are no stylesheets being applied to the site. The odd thing is that if I go to any of the admin sections of the site as well as "preview" applying themes, the pages render fine. Just the actual site doesnt apply the styles.

In IE the following error shows up:

Webpage error details

Message: 'BlogEngine' is undefined
Line: 5
Char: 1
Code: 0
URI: http://example.com/blog/

Line 5 being a very long line:

<head profile=" <link' />http://gmpg.org/xfn/11"><link rel="stylesheet" href="/blog/themes/Standard/css.axd?name=style.css&amp;v=1.4.5.14" type="text/css" /><link rel="shortcut icon" href="pics/blogengine.ico" type="image/x-icon" /><link rel="contents" title="Archive" href="/blog/archive.aspx" /><link rel="start" title="Name of the blog" href="/blog/" /><link type="application/rdf+xml" rel="meta" title="SIOC" href="http://example.com/blog/sioc.axd" /><link type="application/apml+xml" rel="meta" title="APML" href="http://example.com/blog/apml.axd" /><link type="application/rdf+xml" rel="meta" title="FOAF" href="http://example.com/blog/foaf.axd" /><link type="application/rss+xml" rel="alternate" title="Name of the blog (RSS)" href="http://example.com/blog/syndication.axd?format=rss" /><link type="application/atom+xml" rel="alternate" title="Name of the blog (ATOM)" href="http://example.com/blog/syndication.axd?format=atom" /><link type="application/rsd+xml" rel="edituri" title="RSD" href="http://example.com/blog/rsd.axd" /><meta http-equiv="content-type" content="text/html; charset=utf-8" /><script type="text/javascript" src="/blog/js.axd?path=%2fblog%2fblog.js&amp;v=1.4.5.14"></script><script type="text/javascript">BlogEngine.webRoot='/blog/';BlogEngine.i18n.hasRated='You already rated this post';BlogEngine.i18n.savingTheComment='Saving the comment...';BlogEngine.i18n.comments='Comments';BlogEngine.i18n.commentWasSaved='The comment was saved. Thank you for the feedback';BlogEngine.i18n.commentWaitingModeration='Thank you for the feedback. The comment is now awaiting moderation';BlogEngine.i18n.cancel='Cancel';BlogEngine.i18n.filter='Filter';BlogEngine.i18n.apmlDescription='Enter the URL to your website or to your APML document';</script><link type="application/opensearchdescription+xml" rel="search" title="Name of the blog" href="http://example.com/blog/opensearch.axd" /><title>


I'm by no means a developer so I asked a colleague for help and he was able to pinpoint it to a HTTP 500 error on blog.js and style.css but neither of us know what is the cause. There are a lot of references to 1.4.5.14 of which i'm assuming now with the updated code, this is no longer truly the version I'm running. Could this be why i'm getting a rendering issue?

I'm hoping someone can help on this forum. Should I go back to a older build? Thanks in advance for any help you can provide!

Coordinator
Mar 26, 2009 at 10:52 PM
It looks like the BE handlers aren't working -- js.axd, css.axd ... probably your RSS feed too (syndication.axd).

I'm guessing you're probably on IIS7.  Do you have a <system.webServer> section in your web.config file?  If so, try replacing your <system.webServer> section with the one I posted here.  If you don't already have a <system.webServer> section in your web.config file, then add that one I posted into your web.config file.  It would go at the end of the web.config file, right before the closing </configuration> tag.
Mar 27, 2009 at 12:58 AM

Thanks for the reply!

Yes this is on IIS 7. I made the suggested changes to the web.config in the blog folder and now instead of not rendering the pages with the appropriate stylesheets, I get this error- with the pages/sites not even viewable. :(

<fieldset>

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

</fieldset>
Coordinator
Mar 27, 2009 at 2:23 AM
The only change you made that led to this new error was in the web.config file?  Also, do you know if you have your IIS7 website configured to be using an integrated mode app pool (rather than a classic mode app pool)?  The integrated mode app pool is preferrable.  If you have direct access to IIS7, you would want to select the "Default App Pool" for your website.  The Default App Pool is tied to the integrated mode app pool.

Just in case you edited the web.config file incorrectly, you might want to try the web.config file below.  It's the standard BE web.config file with the suggested changes/improvements I made in that other issue.


<?xml version="1.0"?>
<configuration>
    <configSections>
        <sectionGroup name="BlogEngine">
            <section name="blogProvider" requirePermission="false" type="BlogEngine.Core.Providers.BlogProviderSection, BlogEngine.Core" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
        </sectionGroup>
    </configSections>
    <BlogEngine>
        <blogProvider defaultProvider="XmlBlogProvider">
            <providers>
                <add name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>
                <add name="DbBlogProvider" type="BlogEngine.Core.Providers.DbBlogProvider, BlogEngine.Core" connectionStringName="BlogEngine"/>
            </providers>
        </blogProvider>
    </BlogEngine>
    <!-- configSource is not implemented in Mono.
    <connectionStrings configSource="sql.config" />
  -->
    <connectionStrings>
        <clear/>
        <add name="LocalSqlServer" connectionString="dummy"/>
        <!-- Mono complains if LocalSqlServer isn't specified -->
        <add name="BlogEngine" connectionString="Data Source=MySQLServer;User ID=user;Password=password;persist security info=False;initial catalog=BlogEngine;" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    
    <appSettings>
        <add key="BlogEngine.FileExtension" value=".aspx"/>
        <!-- You can e.g. use "~/blog/" if BlogEngine.NET is not located in the root of the application -->
        <add key="BlogEngine.VirtualPath" value="~/"/>
        <!-- The regex used to identify mobile devices so a different theme can be shown -->
        <add key="BlogEngine.MobileDevices" value="(nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)"/>
        <!-- The name of the role with administrator permissions -->
        <add key="BlogEngine.AdminRole" value="Administrators"/>
        <!--This value is to provide an alterantive location for storing data.-->
        <add key="StorageLocation" value="~/App_Data/"/>
        <!--A comma separated list of script names to hard minify. It's case-sensitive. -->
        <add key="BlogEngine.HardMinify" value="blog.js,widget.js,WebResource.axd"/>
    </appSettings>
    
    <system.web>
        <compilation debug="true">
            <assemblies>
                <add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            </assemblies>
        </compilation>
        
        <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="auto" uiCulture="auto"/>
        <httpRuntime enableVersionHeader="false" useFullyQualifiedRedirectUrl="true" maxRequestLength="16384" executionTimeout="3600" requestLengthDiskThreshold="16384"/>
        <machineKey validationKey="D9F7287EFDE8DF4CAFF79011D5308643D8F62AE10CDF30DAB640B7399BF6C57B0269D60A23FBCCC736FC2487ED695512BA95044DE4C58DC02C2BA0C4A266454C" decryptionKey="BDAAF7E00B69BA47B37EEAC328929A06A6647D4C89FED3A7D5C52B12B23680F4" validation="SHA1" decryption="AES"/>
        
        <authentication mode="Forms">
            <forms timeout="129600" name=".AUXBLOGENGINE" protection="All" slidingExpiration="true" loginUrl="~/login.aspx" cookieless="UseCookies"/>
        </authentication>
        
        <pages enableSessionState="false" enableViewStateMac="true" enableEventValidation="true">
            <controls>
                <add namespace="Controls" tagPrefix="blog"/>
            </controls>
        </pages>

        <customErrors mode="RemoteOnly" defaultRedirect="~/error404.aspx">
            <error statusCode="404" redirect="~/error404.aspx"/>
        </customErrors>
        
        <membership defaultProvider="XmlMembershipProvider">
            <providers>
                <clear/>
                <add name="XmlMembershipProvider" type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core" description="XML membership provider" passwordFormat="Hashed"/>
                <add name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
                <add name="DbMembershipProvider" type="BlogEngine.Core.Providers.DbMembershipProvider, BlogEngine.Core" passwordFormat="Hashed" connectionStringName="BlogEngine"/>
            </providers>
        </membership>
        
        <roleManager defaultProvider="XmlRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES">
            <providers>
                <clear/>
                <add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core" description="XML role provider"/>
                <add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
                <add name="DbRoleProvider" type="BlogEngine.Core.Providers.DbRoleProvider, BlogEngine.Core" connectionStringName="BlogEngine"/>
            </providers>
        </roleManager>
        
        <siteMap defaultProvider="PageSiteMap" enabled="true">
            <providers>
                <add name="PageSiteMap" description="The site map provider that reads in the .sitemap XML files." type="BlogEngine.Core.Web.Controls.PageSiteMap, BlogEngine.Core"/>
                <add name="SecuritySiteMap" description="Used for authenticated users." type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" securityTrimmingEnabled="true" siteMapFile="Web.sitemap"/>
            </providers>
        </siteMap>
        
        <httpModules>
            <add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule, BlogEngine.Core"/>
            <add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite, BlogEngine.Core"/>
            <add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule, BlogEngine.Core"/>
            <add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule, BlogEngine.Core"/>
            <!--Remove the default ASP.NET modules we don't need-->
            <remove name="PassportAuthentication"/>
            <remove name="Profile"/>
            <remove name="AnonymousIdentification"/>
        </httpModules>
        
        <httpHandlers>
            <add verb="*" path="file.axd" type="BlogEngine.Core.Web.HttpHandlers.FileHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="image.axd" type="BlogEngine.Core.Web.HttpHandlers.ImageHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="syndication.axd" type="BlogEngine.Core.Web.HttpHandlers.SyndicationHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="sitemap.axd" type="BlogEngine.Core.Web.HttpHandlers.SiteMap, BlogEngine.Core" validate="false"/>
            <add verb="*" path="trackback.axd" type="BlogEngine.Core.Web.HttpHandlers.TrackbackHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="pingback.axd" type="BlogEngine.Core.Web.HttpHandlers.PingbackHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="opensearch.axd" type="BlogEngine.Core.Web.HttpHandlers.OpenSearchHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="metaweblog.axd" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="rsd.axd" type="BlogEngine.Core.Web.HttpHandlers.RsdHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="css.axd" type="BlogEngine.Core.Web.HttpHandlers.CssHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="js.axd" type="BlogEngine.Core.Web.HttpHandlers.JavaScriptHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="rating.axd" type="BlogEngine.Core.Web.HttpHandlers.RatingHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="opml.axd" type="BlogEngine.Core.Web.HttpHandlers.OpmlHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="blogml.axd" type="BlogEngine.Core.Web.HttpHandlers.BlogMLExportHandler, BlogEngine.Core" validate="false"/>
            <add verb="*" path="sioc.axd" type="BlogEngine.Core.Web.HttpHandlers.Sioc, BlogEngine.Core" validate="false"/>
            <add verb="*" path="apml.axd" type="BlogEngine.Core.Web.HttpHandlers.Apml, BlogEngine.Core" validate="false"/>
            <add verb="*" path="foaf*.axd" type="BlogEngine.Core.Web.HttpHandlers.Foaf, BlogEngine.Core" validate="false"/>
        </httpHandlers>
    </system.web>
    
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />

        <modules>
            <add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule, BlogEngine.Core" />
            <add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite, BlogEngine.Core" />
            <add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule, BlogEngine.Core" />
            <add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule, BlogEngine.Core" />
        </modules>

        <handlers accessPolicy="Read, Write, Script, Execute">
            <remove name="PageHandlerFactory-Integrated" />
            <add name="FileHandler" verb="*" path="file.axd" type="BlogEngine.Core.Web.HttpHandlers.FileHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="ImageHandler" verb="*" path="image.axd" type="BlogEngine.Core.Web.HttpHandlers.ImageHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Syndication" verb="*" path="syndication.axd" type="BlogEngine.Core.Web.HttpHandlers.SyndicationHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Sitemap" verb="*" path="sitemap.axd" type="BlogEngine.Core.Web.HttpHandlers.SiteMap, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Trackback" verb="*" path="trackback.axd" type="BlogEngine.Core.Web.HttpHandlers.TrackbackHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Pingback" verb="*" path="pingback.axd" type="BlogEngine.Core.Web.HttpHandlers.PingbackHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="OpenSearch" verb="*" path="opensearch.axd" type="BlogEngine.Core.Web.HttpHandlers.OpenSearchHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="MetaWeblog" verb="*" path="metaweblog.axd" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="RSD" verb="*" path="rsd.axd" type="BlogEngine.Core.Web.HttpHandlers.RsdHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="CssHandler" verb="*" path="css.axd" type="BlogEngine.Core.Web.HttpHandlers.CssHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Javascript" path="js.axd" verb="*" type="BlogEngine.Core.Web.HttpHandlers.JavaScriptHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Rating" verb="*" path="rating.axd" type="BlogEngine.Core.Web.HttpHandlers.RatingHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Opml" verb="*" path="opml.axd" type="BlogEngine.Core.Web.HttpHandlers.OpmlHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="BlogML" verb="*" path="blogml.axd" type="BlogEngine.Core.Web.HttpHandlers.BlogMLExportHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="SIOC" verb="*" path="sioc.axd" type="BlogEngine.Core.Web.HttpHandlers.Sioc, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Apml" verb="*" path="apml.axd" type="BlogEngine.Core.Web.HttpHandlers.Apml, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="Foaf" verb="*" path="foaf*.axd" type="BlogEngine.Core.Web.HttpHandlers.Foaf, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
            <add name="PageHandlerFactory-Integrated" verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
        </handlers>
    </system.webServer>

</configuration>
Mar 27, 2009 at 4:01 AM
Edited Mar 27, 2009 at 4:40 AM
thanks this worked i must not have done something right earlier. I also took the old web.config form 1.4.5 and that worked as well.

I seem to be getting these two errors in IE it doesnt seem to affect the display of the page but I'd like to resolve it if possible:

Message: Syntax error
Line: 3
Char: 1
Code: 0
URI: http://example.com/blog/js.axd?path=http%3a%2f%2fexample.com%2fblog%2fWebResource.axd%3fd%3dj246orv_38DeKtGbza6y6A2%26amp%3bt%3d633595082073246099

Message: Object expected
Line: 163
Char: 1
Code: 0
URI: http://example.com/blog/


Line 3 is simply:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

and 163 is

WebForm_InitCallback();//]]>

but i thought these were commented out so am not sure why theres a problem.

Coordinator
Mar 27, 2009 at 5:59 AM
Two things come to mind.  You might have something cached in IE.  If you do a no-cache refresh (Ctrl-F5), see if that eliminates the error.

You could try unchecking the "Compress WebResource.axd" option in the Advanced Settings section on the Settings tab in the control panel.

If you're still getting the error, are you seeing the same error in Firefox?  Tools -> Error Console will show any errors that might be happening.

You could also try temporarily switching to the Standard theme (if you're not already using that theme) to see if the error occurs in that theme (or any other theme).
Mar 27, 2009 at 9:24 PM
Thanks Ben,

I unchecked the "Compress WebResource.axd" option and it worked like a champ! thanks again!