Mono Support Why webparts on homepage keeps the user on homepage ? 

Viewed 32725 time(s), 19 post(s), 12/5/2012 4:31:51 PM - by super
1/17/2013 8:06:06 AM
15993 Reputation 2214 Total posts

Hi,

let us fix one thing before you move on, go to the "~\Portal\MonoX\T4Templates\RewrittenPaths.tt" and change the following:

From

static string RootFolder;
static string defaultNamespace = "MonoSoftware.MonoX";
To
static string RootFolder;
static string defaultNamespace = "YourNamespace";
After that please run the T4 template and recompile the app, then try to load that page and you should have fix the error.

When you do so get back to us we can go further and solve the redirect issue you have.

Regards

11
1/24/2013 2:31:48 PM
6018 Reputation 709 Total posts

Khorvat,

Since this was getting confusing, I started from the first step...fresh installation.

Then I have copied Default.cs and designer file from " GitHub"

Then I pasted the default.cs and designer file in my solution portal.

Now without even touching the default.cs code when I try to rebuilt and run I get WHOOPS error and I see this in log

2013-01-24 09:26:08,254 [10] ERROR MonoX [BaseHttpApplication] - Application Error
System.Web.HttpParseException (0x80004005): The type 'MonoSoftware.MonoX.Pages.Default' is ambiguous: it could come from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\ProjectName.Web.DLL' or from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\MonoX.DLL'. Please specify the assembly explicitly in the type name. ---> System.Web.HttpParseException (0x80004005): The type 'MonoSoftware.MonoX.Pages.Default' is ambiguous: it could come from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\ProjectName.Web.DLL' or from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\MonoX.DLL'. Please specify the assembly explicitly in the type name. ---> System.Web.HttpException (0x80004005): The type 'MonoSoftware.MonoX.Pages.Default' is ambiguous: it could come from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\ProjectName.Web.DLL' or from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\MonoX.DLL'. Please specify the assembly explicitly in the type name.
   at System.Web.UI.Util.GetTypeFromAssemblies(IEnumerable assemblies, String typeName, Boolean ignoreCase)
   at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
   at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
   at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
   at System.Web.UI.TemplateParser.ProcessException(Exception ex)
   at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualPath virtualPath)
   at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
   at System.Web.UI.TemplateParser.ParseInternal()
   at System.Web.UI.TemplateParser.Parse()
   at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
   at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
   at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
   at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


My Default.aspx.cs is this: (just like I downloaded from " GitHub" - no modifications)
using System;
using System.Linq;
 
namespace MonoSoftware.MonoX.Pages
{
    public partial class Default : BasePage
    {
    }
}



In my RewrittenPaths.tt I changed this as you suggested:

From


static string RootFolder;
static string defaultNamespace = "MonoSoftware.MonoX";

To


static string RootFolder;
static string defaultNamespace = "MonoSoftware.MonoX.Pages";

(match with namespace in default.cs)

I get this error in log:
2013-01-24 09:30:59,597 [10] ERROR MonoX [BaseHttpApplication] - Application Error
System.Web.HttpParseException (0x80004005): The type 'MonoSoftware.MonoX.Pages.Default' is ambiguous: it could come from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\MonoX.DLL' or from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\ProjectName.Web.DLL'. Please specify the assembly explicitly in the type name. ---> System.Web.HttpParseException (0x80004005): The type 'MonoSoftware.MonoX.Pages.Default' is ambiguous: it could come from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\MonoX.DLL' or from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\ProjectName.Web.DLL'. Please specify the assembly explicitly in the type name. ---> System.Web.HttpException (0x80004005): The type 'MonoSoftware.MonoX.Pages.Default' is ambiguous: it could come from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\MonoX.DLL' or from assembly 'C:\Users\PC\Desktop\MonoX-Sol-Custom\bin\ProjectName.Web.DLL'. Please specify the assembly explicitly in the type name.
   at System.Web.UI.Util.GetTypeFromAssemblies(IEnumerable assemblies, String typeName, Boolean ignoreCase)
   at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
   at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
   at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
   at System.Web.UI.TemplateParser.ProcessException(Exception ex)
   at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualPath virtualPath)
   at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
   at System.Web.UI.TemplateParser.ParseInternal()
   at System.Web.UI.TemplateParser.Parse()
   at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
   at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
   at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
   at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)



12
1/24/2013 3:19:01 PM
6018 Reputation 709 Total posts

When I do this in my default.aspx.cs page, I don't get any error :

using System;
using System.Linq;
using MonoSoftware.MonoX.Utilities;
using MonoSoftware.Core;
using MonoSoftware.MonoX.Resources;
using MonoSoftware.MonoX.Caching;
 
namespace MonoSoftware.MonoX
{
    public partial class Default : BasePage
    {
            }
    
}

In this no error situation I keep this RewrittenPath.tt same as this:

static string RootFolder;
static string defaultNamespace = "MonoSoftware.MonoX";


But when I add this in default.aspx.cs:
using System;
using System.Linq;
using MonoSoftware.MonoX.Utilities;
using MonoSoftware.Core;
using MonoSoftware.MonoX.Resources;
using MonoSoftware.MonoX.Caching;
 
namespace MonoSoftware.MonoX
{
    public partial class Default : BasePage
    {
#region Page Events
        protected override void OnLoad(EventArgs e)
        {
           
            MyblogContainer.UrlSingleBlogPost = UrlUtility.RewritePagePath(MyblogContainer.UrlSingleBlogPost, RewrittenPaths.BlogPost.DefaultPage);
            MyctlNewGroupsLK.DefaultPageName = RewrittenPaths.GroupList.DefaultPage;
            base.OnLoad(e);
        }
            #endregion
    }
 
     
        
       
}
Error 102 The name 'MyblogContainer' does not exist in the current context \Default.aspx.cs 15 13 Portal
Error 103 The name 'MyblogContainer' does not exist in the current context \Default.aspx.cs 15 76 Portal
Error 104 The name 'MyctlNewGroupsLK' does not exist in the current context \Default.aspx.cs 16 13 Portal




Why I am getting this error when I have this in my default.aspx page?

<MonoX:BlogContainer ID="MyblogContainer" runat="server" UsePrettyPhoto="true" DateFormatString="d" RelatedContentVisible="true" EnableSyntaxHighlighter="true" GravatarRenderType="NotSet" RewritePageTitle="false" />

<MonoX:NewGroups runat="server" ID="MyctlNewGroupsLK" CacheDuration="600" PagingEnabled="false" MaxDescriptionChars="90" AvatarSize="32" PageSize="5" RewritePageTitle="false"></MonoX:NewGroups>





13
1/25/2013 8:03:52 AM
15993 Reputation 2214 Total posts

This is because you have used the exact same namespace and class name in your inherited class as MonoX's Default page.

namespace MonoSoftware.MonoX
{
    public partial class Default : BasePage
Change that and it should work as expected.

Regards

14
1/25/2013 12:58:31 PM
6018 Reputation 709 Total posts

Khorvat,

What should I change namespace to (please show me an example) ? and where to change? only in default.aspx.cs ? or RewrittenPath.tt too ?

15
1/25/2013 1:11:20 PM
15993 Reputation 2214 Total posts

If you copy the demo page - Default.aspx (with Default.aspx.cs) you need to change the following to properly inherit from MonoX demo page:

From:
 
using System;
using System.Linq;
 
namespace MonoSoftware.MonoX.Pages
{
    public partial class Default : BasePage
    {       
    }
}
 
To:
using System;
using System.Linq;
 
namespace YourProject.Web.Pages
{
    public partial class Default : MonoSoftware.MonoX.Pages.Default
    {       
    }
}
Mark-up

From:
 
<%@ Page
    Language="C#"
    AutoEventWireup="true"
    MasterPageFile="/MonoX/MasterPages/Default.master"
    Inherits="MonoSoftware.MonoX.Pages.Default"
    Title="MonoX - Portal Framework for ASP.NET"
    Codebehind="Default.aspx.cs" %>
 
To:
 
<%@ Page
    Language="C#"
    AutoEventWireup="true"
    MasterPageFile="/MonoX/MasterPages/Default.master"
    Inherits="YourProject.Web.Pages.Default"
    Title="MonoX - Portal Framework for ASP.NET"
    Codebehind="Default.aspx.cs" %>
Regards

16
1/25/2013 1:12:40 PM
15993 Reputation 2214 Total posts

I forgot to add that you need to change the namespace of the T4 template to:

From:
 
<#+
static string RootFolder;
static string defaultNamespace = "MonoSoftware.MonoX";
 
void Render() {
    RootFolder = new FileInfo(Host.TemplateFile).Directory.Parent.Parent.FullName;
#>
 
To:
 
<#+
static string RootFolder;
static string defaultNamespace = "YourProject.Web";
 
void Render() {
    RootFolder = new FileInfo(Host.TemplateFile).Directory.Parent.Parent.FullName;
#>


Regards

17
1/25/2013 7:17:59 PM
6018 Reputation 709 Total posts

Khorvat

I am getting these 5 error after doing the above mentioned changes:

Error   3   The name 'RewrittenPaths' does not exist in the current context \Default.aspx.cs    22  111 Portal
Error   4   The name 'RewrittenPaths' does not exist in the current context \Default.aspx.cs    23  48  Portal
Error   5   The name 'MyblogContainer' does not exist in the current context    \Default.aspx.cs    22  13  Portal
Error   6   The name 'MyblogContainer' does not exist in the current context    \Default.aspx.cs    22  76  Portal
Error   7   The name 'MyctlNewGroupsLK' does not exist in the current context \Default.aspx.cs  23  13  Portal



I don't understand why those ids are not in context when I have controls with those IDs on my default.aspx page ? and what about Rewritten tt template errors ?

18
1/28/2013 8:22:44 AM
15993 Reputation 2214 Total posts

Hi,

you need to check if you registered your RewrittenPaths in Default.aspx.cs and can you let me know what type of ASP.NET WebForms project are you using WebSite or WAP ? In case of WAP you need to get the Visual Studio to generate the control declarations in the designer file (which sometimes can be hard to get due to other errors on the page or control).

Regards

19
1 2
This is a demo site for MonoX. Please visit Mono Software for more info.