hankthetank
Newcomer
I have created several Application variables in an ASP.Net solution. I can manipulate these variables fine in a Web Form code-behind page but for some reason I get an error when I try to use them in a VB code page.
I am converting ASP pages to .Net and I have converted any ASP include pages into a Public Class in a .vb page. For example;
index.aspx.vb
option.vb (this was previously the ASP include file)
The error generated by the line above is "System.NullReferenceException: Object reference not set to an instance of an object."
I have tried creating an instance of the System.Web.HttpApplication class as follows ;
but still get the same error.....Can anyone please help??? I'm tearing my hair out here!!
Thanks
Matt
I am converting ASP pages to .Net and I have converted any ASP include pages into a Public Class in a .vb page. For example;
index.aspx.vb
Code:
Public Class Index
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Write (Application("CommsURL")) ' this works fine
Dim clsOption As New _Option
Response.Write (clsOption.DisplayAppVar())
clsOption = Nothing
End Sub
End Class
option.vb (this was previously the ASP include file)
Code:
Public Class _Option
Inherits System.Web.UI.Page
Public Function DisplayAppVar()
DisplayAppVar = Application("CommsURL") ' this generates an error
End Function
End Class
The error generated by the line above is "System.NullReferenceException: Object reference not set to an instance of an object."
I have tried creating an instance of the System.Web.HttpApplication class as follows ;
Code:
Dim clsHttpApp as new System.Web.HTTPApplication
DisplayAppVar = clsHttpApp.Application("CommsURL")
but still get the same error.....Can anyone please help??? I'm tearing my hair out here!!
Thanks
Matt