trax
  •  trax
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
2013-07-17T16:52:13Z
Base information
I need to delete the forum from the sub domain and move it to my main domain.

So right now i have the forum installed on a sub domain, forum. and there it works perfectly.
I copied the files onto a sub directory on our main domain and that only partly works.

http://nordicfuzzcon.org/Forum 
http://forum.nordicfuzzcon.org 

Both are running against the exact same database just slight config file differences.

Yaf forum version 1.9.6.1
Main domain (and sub directory) runs ASP.NET 4.0/4.5.
Sub domain (and sub directory) runs ASP.NET 4.0/4.5 (yaf web.config).

Problem

When i go to the sub directory version it shows the forum and all previously created threads. I can click on any one forum and show all the threads in there. But if i click on a thread/username and/or the admin link i get the following error:

http://nordicfuzzcon.org...update-18-July-2013.aspx 
http://forum.nordicfuzzc...update-18-July-2013.aspx 

URL: /Forum/Default.aspx
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at ASP.forum_pages_admin_admin_ascx.__DataBind__control29(Object sender, EventArgs e)
   at System.Web.UI.Control.OnDataBinding(EventArgs e)
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
   at System.Web.UI.Control.DataBind()
   at System.Web.UI.Control.DataBindChildren()
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
   at System.Web.UI.Control.DataBind()
   at System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem)
   at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource)
   at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e)
   at System.Web.UI.WebControls.Repeater.DataBind()
   at YAF.Pages.Admin.admin.BindActiveUserData()
   at YAF.Pages.Admin.admin.BindData()
   at YAF.Pages.Admin.admin.Page_Load(Object sender, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.forum_default_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

If i open the same thread/user on the subdomain it works.

Config files

-- Subdomain (working 100%) --
<configuration>
  <configSections>
    <section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" requirePermission="false"/>
  </configSections>    
  <appSettings configSource="app.config"/>  
  <rewriter configSource="URLRewriter.config"/>    
  <system.web>    
    <httpRuntime requestValidationMode="2.0"/>    
    <xhtmlConformance mode="Strict"/>    
    <customErrors defaultRedirect="Error.aspx" mode="Off"/>        
    <globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />    
    <compilation debug="false" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
        <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </compilation>    
    <httpHandlers>
      <add verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
    </httpHandlers>    
    <httpModules>
      <add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core"/>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter"/>
    </httpModules>    
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" enableEventValidation="false" validateRequest="false">
      <controls>
        <!-- Default: use non-dynamic (compiled classes) in YAF -->
        <add tagPrefix="YAF" namespace="YAF.Controls" assembly="YAF.Controls"/>
        <add tagPrefix="YAF" namespace="YAF.Controls.Statistics" assembly="YAF.Controls"/>
        <add tagPrefix="YAF" namespace="YAF.Classes"/>
        <add tagPrefix="YAF" namespace="YAF"/>
      </controls>
      <namespaces>
        <add namespace="YAF.Core"/>
        <add namespace="YAF.Controls"/>
        <add namespace="YAF.Utils"/>
        <add namespace="YAF.Types.Interfaces"/>
        <add namespace="YAF.Types"/>
      </namespaces>
    </pages>    
  </system.web>  
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="YafTaskModule"/>
      <remove name="UrlRewriter"/>
      <add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" preCondition="managedHandler"/>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" preCondition="managedHandler"/>
    </modules>
    <handlers>
      <add name="YafHandler" preCondition="integratedMode" verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
    </handlers>
  </system.webServer>
</configuration>

-- Sub directory (partly working) --
<configuration>
    <configSections>
        <section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" requirePermission="false"/>
    </configSections>
    <rewriter configSource="URLRewriter.config"/>
    <appSettings configSource="app.config" />
    <system.web>
        <customErrors mode="Off"></customErrors>
        <compilation targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" maxRequestLength="10485760" executionTimeout="7200" />
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" enableEventValidation="false" validateRequest="false">
            <controls>
                <!-- Default: use non-dynamic (compiled classes) in YAF -->
                <add tagPrefix="YAF" namespace="YAF.Controls" assembly="YAF.Controls"/>
                <add tagPrefix="YAF" namespace="YAF.Controls.Statistics" assembly="YAF.Controls"/>
                <add tagPrefix="YAF" namespace="YAF.Classes"/>
                <add tagPrefix="YAF" namespace="YAF"/>
            </controls>
            <namespaces>
                <add namespace="System.Web.Helpers" />
                <add namespace="System.Web.Mvc" />
                <add namespace="System.Web.Mvc.Ajax" />
                <add namespace="System.Web.Mvc.Html" />
                <add namespace="System.Web.Optimization" />
                <add namespace="System.Web.Routing" />
                <add namespace="System.Web.WebPages" />
                <add namespace="YAF.Core"/>
                <add namespace="YAF.Controls"/>
                <add namespace="YAF.Utils"/>
                <add namespace="YAF.Types.Interfaces"/>
                <add namespace="YAF.Types"/>
            </namespaces>
        </pages>
        
        <httpModules>
            <add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core"/>
            <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter"/>
        </httpModules>
        <httpHandlers>
            <add verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
        </httpHandlers>
    </system.web>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
            <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
            <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
            <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
            <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
            <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
            <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
            <add name="YafHandler" preCondition="integratedMode" verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
        </handlers>
        <modules>
            <remove name="YafTaskModule"/>
            <remove name="UrlRewriter"/>
            <add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" preCondition="managedHandler"/>
            <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" preCondition="managedHandler"/>
        </modules>
    </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
    <location path="Forum">
        <system.web>
            <httpRuntime requestValidationMode="2.0"/>
        </system.web>
    </location>
</configuration>

App.config
<add key="YAF.EnableURLRewriting" value="true" />
<add key="YAF.URLRewritingMode" value="Translit" />
<add key="YAF.AppRoot" value="~/Forum" />		
<add key="YAF.AllowLoginAndLogoff" value="false" />

The only difference between the subdirectory and the subdomain is the AppRoot. ~/ for subdomain and ~/Forum for subdirectory.


UrlRewriter.config (original file, no modifications, same file in both the sub directory and sub domain)
<rewriter>
  <rewrite url="^~/(.+?)?yaf_login?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=login&amp;$5" processing="stop" />
	<rewrite url="^~/(.+?)?yaf_info?\.aspx\?i=([0-9]+?)&amp;url\=(.+)$" to="~/$1Default.aspx?g=info&amp;i=$2&amp;url=$3" processing="stop" />
	<rewrite url="^~/(.+)?yaf_topics([0-9]+)p([0-9]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=topics&amp;f=$2&amp;p=$3&amp;$7" processing="stop" />
	<rewrite url="^~/(.+)?yaf_topics([0-9]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=topics&amp;f=$2&amp;$6" processing="stop" />
	<rewrite url="^~/(.+)?yaf_forum([0-9]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=forum&amp;c=$2&amp;$6" processing="stop" />
  <rewrite url="^~/(.+)?yaf_postst([0-9]+)find([-a-z]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=posts&amp;t=$2&amp;find=$3&amp;$7" processing="stop" /> 
	<rewrite url="^~/(.+)?yaf_postst([0-9]+)p([0-9]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=posts&amp;t=$2&amp;p=$3&amp;$7" processing="stop" />
	<rewrite url="^~/(.+)?yaf_postst([0-9]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=posts&amp;t=$2&amp;$6" processing="stop" />
  <rewrite url="^~/(.+)?yaf_postsm([0-9]+)find([-a-z]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=posts&amp;m=$2&amp;find=$3&amp;$7" processing="stop" />
  <rewrite url="^~/(.+)?yaf_postsm([0-9]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=posts&amp;m=$2&amp;$6" processing="stop" />
	<rewrite url="^~/(.+)?yaf_profile([0-9]+)(_([-a-z0-9]+))?\.aspx(\?(.+))?$" to="~/$1Default.aspx?g=profile&amp;u=$2&amp;$6" processing="stop" />
  <rewrite url="^~/(.+)?yaf_rsstopic([0-9]+)ft([0-9]+)t([0-9]+)(_([-a-z0-9]+))?\.xml(\?(.+))?$" to="~/$1Default.aspx?g=rsstopic&amp;pg=$2&amp;ft=$3&amp;t=$4&amp;$7" processing="stop" />
  <rewrite url="^~/(.+)?yaf_rsstopic([0-9]+)ft([0-9]+)f([0-9]+)(_([-a-z0-9]+))?\.xml(\?(.+))?$" to="~/$1Default.aspx?g=rsstopic&amp;pg=$2&amp;ft=$3&amp;f=$4&amp;$7" processing="stop" /> 
  <rewrite url="^~/(.+)?yaf_rsstopic([0-9]+)ft([0-9]+)(_([-a-z0-9]+))?\.xml(\?(.+))?$" to="~/$1Default.aspx?g=rsstopic&amp;pg=$2&amp;ft=$3&amp;$7" processing="stop" />
  <rewrite url="^~/(.+)?yaf_([-0-9a-z_]+?)\.aspx\?(.+)?$" to="~/$1Default.aspx?g=$2&amp;$3" processing="stop" />
	<rewrite url="^~/(.+)?yaf_([-0-9a-z_]+?)\.aspx$" to="~/$1Default.aspx?g=$2" processing="stop" />   
</rewriter>


Any ideas why it keeps generating Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object. ?
Sponsor
trax
  •  trax
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
2013-07-18T16:59:49Z
Solved.

I missed that profile should inherit from YafUserProfiles.

- Web.config -
<profile enabled="true" defaultProvider="AspNetSqlProfileProvider" inherits="YAF.Utils.YafUserProfile">
...
</profile>

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved