Tag Archives: Dotnetnuke

Dotnetnuke Error: BC30451

For all interested parties if you run into this error after compiling a custom module…

Dotnetnuke BC30451: Name ‘Initialize’ is not declared.

It is most likely you didn’t change your reference paths in Visual Studio.

Brian Dukes ran into this problem, discussed here. His solution was to copy a fresh copy of the core Dotnetnuke.dll into your root /bin folders but if you don’t change the reference paths in Visual Studio, each time you compile your custom module the Dotnetnuke.dll will be replaced with the an older one if it exists.

Don’t forget to change the reference paths for both your main module project and the corresponding sqldataprovider project because it will also have the same reference paths.

HTH, Thuan.

Dotnetnuke Infinite Redirect Loop

It had be a long time since I had worked with Dotnetnuke but it was time for me to upgrade a few of my Dotnetnuke sites.  And as always DNN’s installation/upgrading is again culpable for all my recent stress.

The site upgrade in question was going from DNN 3.3.7 to DNN 4.9.0 and the error I kept on getting was an infinite loop redirecting me back to this URL: http://mysite/default.aspx?alias=http://mysite/myalias with a blank screen.

Internet Explorer didn’t know what to do with it so it infinitely reloaded the URL.  Firefox was a little smarter, it detected the loop therefore stopped it and gave out this error message: “Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”

So the search was on, using these keywords… dotnetnuke, infinite, redirect, and loop. I found a couple promising articles with potential solutions to my problem…

http://www.bestwebsites.co.nz/dotnetnuke/solving-the-dotnetnuke-redirect-loop/

http://weblogs.asp.net/christoc/archive/2008/06/19/dotnetnuke-homepage-won-t-load-keeps-redirecting.aspx

But after  much trial and error with my trust settings and going straight to the database and changing my portal’s aliases per those solutions, I was still at a dead end.

It wasn’t until I carefully read this John Mitchell forum thread did I find my solution. The problem was the new Default.aspx page. After the upgrade the page code went from…

<%@ Page Language=”vb” AutoEventWireup=”false” Explicit=”True” Inherits=”DotNetNuke.Framework.DefaultPage” CodeFile=”Default.aspx.vb” %>
<%@ Register TagPrefix=”dnn” Namespace=”DotNetNuke.Common.Controls” Assembly=”DotNetNuke” %>
<asp:literal id=”skinDocType” runat=”server”></asp:literal>
<html <%=xmlns%> <%=LanguageCode%>>
<head id=”Head” runat=”server”>
<meta id=”MetaRefresh” runat=”Server” http-equiv=”Refresh” name=”Refresh” />
<meta id=”MetaDescription” runat=”Server” name=”DESCRIPTION” />
<meta id=”MetaKeywords” runat=”Server” name=”KEYWORDS” />
<meta id=”MetaCopyright” runat=”Server” name=”COPYRIGHT” />
<meta id=”MetaGenerator” runat=”Server” name=”GENERATOR” />
<meta id=”MetaAuthor” runat=”Server” name=”AUTHOR” />
<meta name=”RESOURCE-TYPE” content=”DOCUMENT” />
<meta name=”DISTRIBUTION” content=”GLOBAL” />
<meta name=”ROBOTS” content=”INDEX, FOLLOW” />
<meta name=”REVISIT-AFTER” content=”1 DAYS” />
<meta name=”RATING” content=”GENERAL” />
<meta http-equiv=”PAGE-ENTER” content=”RevealTrans(Duration=0,Transition=1)” />
<style type=”text/css” id=”StylePlaceholder” runat=”server”></style>
<asp:placeholder id=”CSS” runat=”server” />
</head>
<body id=”Body” runat=”server” >
<noscript></noscript>
<dnn:Form id=”Form” runat=”server” ENCTYPE=”multipart/form-data” style=”height: 100%;” autocomplete=”off”>
<asp:Label ID=”SkinError” runat=”server” CssClass=”NormalRed” Visible=”False”></asp:Label>
<asp:PlaceHolder ID=”SkinPlaceHolder” runat=”server” />
<input id=”ScrollTop” runat=”server” name=”ScrollTop” type=”hidden” />
<input id=”__dnnVariable” runat=”server” name=”__dnnVariable” type=”hidden” />
</dnn:Form>
</body>
</html>

to…

<%@ Page language=”VB” %>
<%@ Import Namespace=”DotNetNuke” %>

<script runat=”server”>

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim DomainName As String
Dim ServerPath As String
Dim URL() As String
Dim intURL As Integer

‘ parse the Request URL into a Domain Name token
URL = Split(Request.Url.ToString(), “/”)
For intURL = 2 To URL.GetUpperBound(0)
Select Case URL(intURL).ToLower
Case “admin”, “desktopmodules”, “mobilemodules”, “premiummodules”
Exit For
Case Else
‘ check if filename
If InStr(1, URL(intURL), “.aspx”) = 0 Then
DomainName = DomainName & IIf(DomainName <> “”, “/”, “”) & URL(intURL)
Else
Exit For
End If
End Select
Next intURL

‘ format the Request.ApplicationPath
ServerPath = Request.ApplicationPath
If Mid(ServerPath, Len(ServerPath), 1) <> “/” Then
ServerPath = ServerPath & “/”
End If

DomainName = ServerPath & “Default.aspx?alias=” & DomainName

Response.Redirect(DomainName,True)

End Sub

</script>

This made me look at all my files a second time. What I found was that the old Default.aspx was backed up as old_Default.aspx and a new one was created. So my solution was simply to replace the original Default.aspx page with the new one generated from the upgrade.

And although, my solution got the site working again and under ASP.NET v2 (the reason for my upgrade), it also leaves me to question what I did, if I messed anything fundamental up, and why the Dotnetnuke Team changed the Default.aspx page.

If anyone could enlighten me on this, please leave a comment.