I have created a DNN Module, Everything looks fine in VWD, no errors. However when I try to load the page, I get the following error. My .vb is also included, the upload, download, & paypal code is actually in there 12 times, I removed some of them to make this post shorter.
![]() |
Error: PGT is currently
unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at YourCompany.Modules.PGT.ViewPGT..ctor() in C:\Users\David\Desktop\sites\DNN\DesktopModules\PGT\ViewPGT.ascx.vb:line 152 at ASP.desktopmodules_pgt_viewpgt_ascx..ctor() in C:\Users\David\Desktop\sites\DNN\DesktopModules\PGT\ViewPGT.ascx.vb:line 912304 at __ASP.FastObjectFactory_app_web_6gkdbv9i.Create_ASP_desktopmodules_pgt_viewpgt_ascx() at System.Web.Compilation.BuildResultCompiledType.CreateInstance() at System.Web.UI.TemplateControl.LoadControl(IWebObjectFactory objectFactory, VirtualPath virtualPath, Type t, Object[] parameters) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace --- |
'
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2006
' by Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
'
Imports DotNetNuke
Imports System.IO
Imports System.Web.UI
Imports System.Web.UI.Page
Imports System.Collections.Generic
Imports System.Reflection
Imports DotNetNuke.Security.PortalSecurity
Imports DotNetNuke.Entities.Modules.ModuleController
Imports DotNetNuke.Entities.Modules.ModuleSettingsBase
Imports DotNetNuke.Entities.Modules.ModuleInfo
Partial Class DesktopModules_PGT_ViewPGT
Inherits Entities.Modules.PortalModuleBase
End Class
Namespace YourCompany.Modules.PGT
''' -----------------------------------------------------------------------------
''' <summary>
''' The ViewDynamicModule class displays the content
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' </history>
''' -----------------------------------------------------------------------------
Partial Class ViewPGT
Inherits Entities.Modules.PortalModuleBase
Implements Entities.Modules.IActionable
#Region "Private Members"
Private strTemplate As String
#End Region
#Region "Event Handlers"
''' -----------------------------------------------------------------------------
''' <summary>
''' Page_Load runs when the control is loaded
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' </history>
''' -----------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
If Not Page.IsPostBack Then
If CType(Settings("template"), String) <> "" Then
strTemplate = CType(Settings("template"), String)
Else
strTemplate = Localization.GetString("Template.Text", LocalResourceFile)
End If
Dim objPGTs As New PGTController
Dim colPGTs As List(Of PGTInfo)
' get the content from the PGT table
colPGTs = objPGTs.GetPGTs(ModuleId)
If colPGTs.Count = 0 Then
If Localization.GetString("DefaultContent", LocalResourceFile) <> "" Then
' add the content to the PGT table
Dim objPGT As PGTInfo = New PGTInfo
objPGT.ModuleId = ModuleId
objPGT.Content = Localization.GetString("DefaultContent", LocalResourceFile)
objPGT.CreatedByUser = Me.UserId
objPGTs.AddPGT(objPGT)
' get the content from the PGT table
colPGTs = objPGTs.GetPGTs(ModuleId)
End If
End If
' bind the content to the repeater
lstContent.DataSource = colPGTs
lstContent.DataBind()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Protected Sub lstContent_ItemDataBound(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles
lstContent.ItemDataBound
Dim strContent As String = strTemplate
Dim strValue As String
' add content to template
Dim objProperties As ArrayList = Common.Utilities.CBO.GetPropertyInfo(GetType(PGTInfo))
Dim intProperty As Integer
Dim objPropertyInfo As PropertyInfo
For intProperty = 0 To objProperties.Count - 1
objPropertyInfo = CType(objProperties(intProperty), PropertyInfo)
If strContent.IndexOf("[" & objPropertyInfo.Name.ToUpper & "]") <> -1 Then
strValue = Server.HtmlDecode(DataBinder.Eval(e.Item.DataItem, objPropertyInfo.Name).ToString())
strContent = strContent.Replace("[" & objPropertyInfo.Name.ToUpper & "]", strValue)
End If
Next intProperty
' assign the content
Dim lblContent As Label = CType(e.Item.FindControl("lblContent"), Label)
lblContent.Text = strContent
End Sub
#End Region
#Region "Optional Interfaces"
''' -----------------------------------------------------------------------------
''' <summary>
''' Registers the module actions required for interfacing with the portal framework
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
''' <history>
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property ModuleActions() As
Entities.Modules.Actions.ModuleActionCollection Implements
Entities.Modules.IActionable.ModuleActions
Get
Dim Actions As New Entities.Modules.Actions.ModuleActionCollection
Actions.Add(GetNextActionID,
Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent,
LocalResourceFile),
Entities.Modules.Actions.ModuleActionType.AddContent, "", "",
EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)
Return Actions
End Get
End Property
#End Region
Dim coach As String = school & " - Coach"
Dim school As String = CType(Settings("school"), String).ToString
Dim league As String = CType(Settings("league"), String).ToString
Dim sport As String = CType(Settings("sport"), String).ToString
Dim subPrice As String = CType(Settings("subPrice"), String).ToString
Dim subTerm1 As String = CType(Settings("subTerm1"), String).ToString
Dim subTerm2 As String = CType(Settings("subTerm2"), String).ToString
Dim singlePrice As String = CType(Settings("singlePrice"), String).ToString
Dim singleTerm1 As String = CType(Settings("singleTerm1"), String).ToString
Dim singleTerm2 As String = CType(Settings("singleTerm2"), String).ToString
Dim strPath1 As String = "~/uploads/" & school & "/1/"
Dim FileName1 As String = Path.GetFileNameWithoutExtension(strPath1)
Dim DLPath1 As String = strPath1 & FileName1
Dim strPath2 As String = "~/uploads/" & school & "/2/"
Dim FileName2 As String = Path.GetFileNameWithoutExtension(strPath2)
Dim DLPath2 As String = strPath2 & FileName2
Dim strPath3 As String = "~/uploads/" & school & "/3/"
Dim FileName3 As String = Path.GetFileNameWithoutExtension(strPath3)
Dim DLPath3 As String = strPath3 & FileName3
Dim strPath4 As String = "~/uploads/" & school & "/4/"
Dim FileName4 As String = Path.GetFileNameWithoutExtension(strPath4)
Dim DLPath4 As String = strPath4 & FileName4
Dim strPath5 As String = "~/uploads/" & school & "/5/"
Dim FileName5 As String = Path.GetFileNameWithoutExtension(strPath5)
Dim DLPath5 As String = strPath5 & FileName5
Dim strPath6 As String = "~/uploads/" & school & "/6/"
Dim FileName6 As String = Path.GetFileNameWithoutExtension(strPath6)
Dim DLPath6 As String = strPath6 & FileName6
Dim strPath7 As String = "~/uploads/" & school & "/7/"
Dim FileName7 As String = Path.GetFileNameWithoutExtension(strPath7)
Dim DLPath7 As String = strPath7 & FileName7
Dim strPath8 As String = "~/uploads/" & school & "/8/"
Dim FileName8 As String = Path.GetFileNameWithoutExtension(strPath8)
Dim DLPath8 As String = strPath8 & FileName8
Dim strPath9 As String = "~/uploads/" & school & "/9/"
Dim FileName9 As String = Path.GetFileNameWithoutExtension(strPath1)
Dim DLPath9 As String = strPath9 & FileName9
Dim strPath10 As String = "~/uploads/" & school & "/10/"
Dim FileName10 As String = Path.GetFileNameWithoutExtension(strPath10)
Dim DLPath10 As String = strPath10 & FileName10
Dim strPath11 As String = "~/uploads/" & school & "/11/"
Dim FileName11 As String = Path.GetFileNameWithoutExtension(strPath11)
Dim DLPath11 As String = strPath11 & FileName11
Dim strPath12 As String = "~/uploads/" & school & "/12/"
Dim FileName12 As String = Path.GetFileNameWithoutExtension(strPath12)
Dim DLPath12 As String = strPath12 & FileName12
Public Sub Page_Load2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
'--------------------------------------------------------------------------------------------------------------------
Access
'
'--------------------------------------------------------------------------------------------------------------------
If IsInRole(coach) Then
FileUpload1.Visible = True
Upload1.Visible = True
ULLabel1.Visible = True
FileUpload2.Visible = True
Upload2.Visible = True
ULLabel2.Visible = True
FileUpload3.Visible = True
Upload3.Visible = True
ULLabel3.Visible = True
FileUpload4.Visible = True
Upload4.Visible = True
ULLabel4.Visible = True
FileUpload5.Visible = True
Upload5.Visible = True
ULLabel5.Visible = True
FileUpload6.Visible = True
Upload6.Visible = True
ULLabel6.Visible = True
FileUpload7.Visible = True
Upload7.Visible = True
ULLabel7.Visible = True
FileUpload8.Visible = True
Upload8.Visible = True
ULLabel8.Visible = True
FileUpload9.Visible = True
Upload9.Visible = True
ULLabel9.Visible = True
FileUpload10.Visible = True
Upload10.Visible = True
ULLabel10.Visible = True
FileUpload11.Visible = True
Upload11.Visible = True
ULLabel11.Visible = True
FileUpload12.Visible = True
Upload12.Visible = True
ULLabel12.Visible = True
Label2.Visible = True
Label3.Visible = False
Label4.Visible = True
Else
FileUpload1.Visible = False
Upload1.Visible = False
ULLabel1.Visible = False
FileUpload2.Visible = False
Upload2.Visible = False
ULLabel2.Visible = False
FileUpload3.Visible = False
Upload3.Visible = False
ULLabel3.Visible = False
FileUpload4.Visible = False
Upload4.Visible = False
ULLabel4.Visible = False
FileUpload5.Visible = False
Upload5.Visible = False
ULLabel5.Visible = False
FileUpload6.Visible = False
Upload6.Visible = False
ULLabel6.Visible = False
FileUpload7.Visible = False
Upload7.Visible = False
ULLabel7.Visible = False
FileUpload8.Visible = False
Upload8.Visible = False
ULLabel8.Visible = False
FileUpload9.Visible = False
Upload9.Visible = False
ULLabel9.Visible = False
FileUpload10.Visible = False
Upload10.Visible = False
ULLabel10.Visible = False
FileUpload11.Visible = False
Upload11.Visible = False
ULLabel11.Visible = False
FileUpload12.Visible = False
Upload12.Visible = False
ULLabel12.Visible = False
Label2.Visible = False
Label3.Visible = True
Label4.Visible = False
End If
If IsInRole(school + " Temp1") Then
Download1.Visible = True
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy1.Visible = False
ElseIf IsInRole(school + " Temp2") Then
Download1.Visible = False
Download2.Visible = True
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy2.Visible = False
ElseIf IsInRole(school + " Temp3") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = True
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy3.Visible = False
ElseIf IsInRole(school + " Temp4") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = True
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy4.Visible = False
ElseIf IsInRole(school + " Temp5") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = True
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy5.Visible = False
ElseIf IsInRole(school + " Temp6") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = True
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy6.Visible = False
ElseIf IsInRole(school + " Temp7") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = True
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy7.Visible = False
ElseIf IsInRole(school + " Temp8") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = True
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy8.Visible = False
ElseIf IsInRole(school + " Temp9") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = True
Download10.Visible = False
Download11.Visible = False
Download12.Visible = False
Buy9.Visible = False
ElseIf IsInRole(school + " Temp10") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = True
Download11.Visible = False
Download12.Visible = False
Buy10.Visible = False
ElseIf IsInRole(school + " Temp11") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = True
Download12.Visible = False
Buy11.Visible = False
ElseIf IsInRole(school + " Temp12") Then
Download1.Visible = False
Download2.Visible = False
Download3.Visible = False
Download4.Visible = False
Download5.Visible = False
Download6.Visible = False
Download7.Visible = False
Download8.Visible = False
Download9.Visible = False
Download10.Visible = False
Download11.Visible = False
Download12.Visible = True
Buy12.Visible = False
ElseIf IsInRole(school) Or IsInRole(coach) Then
Download1.Visible = True
Download2.Visible = True
Download3.Visible = True
Download4.Visible = True
Download5.Visible = True
Download6.Visible = True
Download7.Visible = True
Download8.Visible = True
Download9.Visible = True
Download10.Visible = True
Download11.Visible = True
Download12.Visible = True
Buy1.Visible = False
Buy2.Visible = False
Buy3.Visible = False
Buy4.Visible = False
Buy5.Visible = False
Buy6.Visible = False
Buy7.Visible = False
Buy8.Visible = False
Buy9.Visible = False
Buy10.Visible = False
Buy11.Visible = False
Buy12.Visible = False
Else
Download1.Visible = False
Buy1.Visible = True
Download2.Visible = False
Buy2.Visible = True
Download3.Visible = False
Buy3.Visible = True
Download4.Visible = False
Buy4.Visible = True
Download5.Visible = False
Buy5.Visible = True
Download6.Visible = False
Buy6.Visible = True
Download7.Visible = False
Buy7.Visible = True
Download8.Visible = False
Buy8.Visible = True
Download9.Visible = False
Buy9.Visible = True
Download10.Visible = False
Buy10.Visible = True
Download11.Visible = False
Buy11.Visible = True
Download12.Visible = False
Buy12.Visible = True
End If
Label10.Text = ("Purchase Season pass to all " & school
& "," & league & " " & sport & " Game Tapes - $"
& subPrice)
vid1.Text = FileName1
vid2.Text = FileName2
vid3.Text = FileName3
vid4.Text = FileName4
vid5.Text = FileName5
vid6.Text = FileName6
vid7.Text = FileName7
vid8.Text = FileName8
vid9.Text = FileName9
vid10.Text = FileName10
vid11.Text = FileName11
vid12.Text = FileName12
End Sub
Protected Sub Upload1_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Upload1.Click
If FileUpload1.HasFile Then
Try
If Not Directory.Exists(strPath1) Then
Directory.CreateDirectory(strPath1)
End If
FileUpload1.SaveAs(Server.MapPath(strPath1 + FileUpload1.FileName))
ULLabel1.Text = "File Uploaded!"
Catch ex As Exception
ULLabel1.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
ULLabel1.Text = "You have not specified a file."
End If
End Sub
'--------------------------------------------------------------------------------------------------------------------
PayPal
'
'--------------------------------------------------------------------------------------------------------------------
Protected Sub Subscription_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Subscription.Click
Response.Write(PayPalPostForm0().ToString)
End Sub
Public Function PayPalPostForm0() As String
Dim PostUrl As String = "https://www.paypal.com/cgi-bin/webscr"
Dim Cmd As String = "_xclick-subscriptions"
Dim no_shipping As String = "1"
Dim BusinessEmail As String = "_________@truvista.net"
Dim Currency As String = "USD"
Dim ItemName As String = school
Dim a3 As String = subPrice
Dim ret As String = "http://www._______________.com/dnn/desktopmodules/uldl/Payment_success.aspx"
Dim cancel As String = "http://www.___________.com"
Dim Note As String = "1"
Dim p3 As String = subTerm1
Dim t3 As String = subTerm2
Dim bn As String = "PP-SubscriptionsBF"
'Create the Form to write to the page with PayPal parameters
Dim ppForm As New StringBuilder
ppForm.Append("<Form name=" + """" + "frmPP" + """" + "
id=" + """" + "frmPP" + """" + " action=" + """" + PostUrl + """" + "
method=" + """" + "post" + """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "cmd" + """" + " value=" + """" + Cmd + """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "no_shipping" + """" + " value=" + """" + no_shipping
+ """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "business" + """" + " value=" + """" + BusinessEmail
+ """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "currency_code" + """" + " value=" + """" + Currency
+ """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "item_name" + """" + " value=" + """" + ItemName +
"""" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "a3" + """" + " value=" + """" + a3 + """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "return" + """" + " value=" + """" + ret + """" +
">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "no_shipping" + """" + " value=" + """" + no_shipping
+ """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "cancel_return" + """" + " value=" + """" + cancel +
"""" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "no_note" + """" + " value=" + """" + Note + """" +
">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "bn" + """" + " value=" + """" + bn + """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "p3" + """" + " value=" + """" + p3 + """" + ">")
ppForm.Append("<input type=" + """" + "hidden" + """" +
" name=" + """" + "t3" + """" + " value=" + """" + t3 + """" + ">")
Return ppForm.ToString
End Function
'--------------------------------------------------------------------------------------------------------------------
Download
'
'--------------------------------------------------------------------------------------------------------------------
Protected Sub Download1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Download1.Click
Response.TransmitFile(Server.MapPath(DLPath1))
End Sub
End Class
End Namespace
![]() |
0 |
![]() |