Tuesday, February 8, 2011

Could not load type Pagebase


This error showed up when I uploaded my ASP.NET AJAX enabled website to my IIS Webhosting service provider. I was breaking my head and thinking what went wrong.

I published my application in a sub-folder inside the main root folder.
The new application I was trying to publish was inside a subfolder like www.advancedtechnologyworks.com\PrayerHelp\
I was checking the Web.Config file inside the sub-folder “PrayerHelp” and all was fine.
Then finally I discovered there was another “Web.Config” on the main domain which was causing this issue.
The Web.Config file was like this
<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
       <appSettings/>
       <connectionStrings>
       </connectionStrings>
       <system.web>
              <compilation debug="true" targetFramework="4.0">
              </compilation>
              <authentication mode="Windows"/>
              <pages pageBaseType="PageBase" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
              </pages>
              <anonymousIdentification enabled="true"/>
              <customErrors mode="Off"/>
              <profile enabled="false">
                     <properties>
                           <!-- Available values for the StyleSheetTheme attribute: "Green", "Brown", "Red".-->
                           <add name="StylesheetTheme" defaultValue="Red" allowAnonymous="true"/>
                     </properties>
              </profile>
       </system.web>
</configuration>

I also identified this “PageBase.cs” file was inside the “App_Code” folder in the main domain folder.
I created the same “App_Code” folder inside the sub-folder “PrayerHelp” and copied this “PageBase.cs” file.  Eureka!  Everything started to work.
So when this error shows up, examine all the Web.Config files and see whether there is a reference to a new class file and make sure that class file is placed inside the App_Code folder.
Hope this tip helps someone.


No comments:

Post a Comment

All Blogs so far ...